I don't have time right now to delve into the details of coming up with 
a new way to use Authorize.net and what you're trying to do isn't an 
"approved" method of integration.

Their approach for what you're wanting to do is the Direct Post Method:

http://developer.authorize.net/api/dpm

Have you taken a look at its docs and examples?

Once you have that method working and you really want to try something 
new you could try to migrate it to posting via AJAX instead of directly...

On 9/23/12 6:27 PM, Rick Faircloth wrote:
> When you say "endpoint", you mean the "success"
> section of the code? That's always the way I do AJAX
> when I'm sending requests to component methods for processing.
>
> Is there something about sending a post to another
> server/domain that makes that unworkable?
>
>> not actually getting a response at all
> Yes, I've noticed that from the start...nothing in Firebug
> in the Response section in any browser.
>
> The only thing I see different in Firebug in Chrome is under
> headers > RequestHeaders I've got these lines:
>
> Content-Type    application/x-www-form-urlencoded
> Accept          application/json, text/javascript, */*; q=0.01
>
> Is there a disconnect between the content-type (sent? received?)
> and what will be accepted (by my code? by Auth.net's server?)
> Does this tell you anything?
>
> And you asked where in the Authorized.net docs have I seen this
> "endpoint"... well, nowhere, but then, I haven't seen much of
> anything except a ton of PHP code and an example of CF processing
> using CFHTTP.
>
> I noticed that cfpayment uses CFHTTP in part of the programming.
> If I use CFHTTP to process the form, does that mean that I'm now
> handling the form data "on my server", requiring more stringent
> PCI compliance that doing a straight AJAX post?
>
> I'm sure there's just something I don't understand about what's
> going on, especially since this is my first experience with a
> payment gateway, as well as the first time I've ever used AJAX
> to post to another domain/site.
>
> So, is what I'm trying to do with my code even possible?
> I'm getting correct processing on Authorize.net's end. They send
> me the customer and merchant email receipts.
>
> I just can't figure out how to get a response back to my AJAX
> function.
>
> Any more suggestions?
>
> Rick
>
> -----Original Message-----
> From: .jonah [mailto:jonah....@creori.com]
> Sent: Sunday, September 23, 2012 3:51 PM
> To: cf-talk
> Subject: Re: Question about using AJAX with Authorize.net
>
>
> I don't quite know how you're using that endpoint with AJAX.
>
> If you click on that URL in firebug, you'll see you're not actually
> getting a response at all.
>
> Also, try your form in Chrome.
>
> I get this in the console:
> XMLHttpRequest cannot load
> https://test.authorize.net/gateway/transact.dll. Origin http://<my test
> server> is not allowed by Access-Control-Allow-Origin.
>
> Where in the authorize.net docs does it talk about using this endpoint
> in this way?
>
>
> On 9/23/12 5:54 AM, Rick Faircloth wrote:
>>      $(document).ready(function() {
>>
>>         $('#donation_form_submit').click(function() {
>>
>>            var x_login                         =   '25F2wqnuFs';
>>            var x_tran_key                      =   '3B58p37d9PJxUUR9';
>>            var x_relay_response                =   'false';
>>            var x_type                          =   'AUTH_CAPTURE';
>>            var x_method                        =   'CC';
>>            var x_description                   =   'Donation';
>>
>>            var x_card_num                      =   $('#x_card_num').val();
>>            var x_card_num                      =
>> x_card_num.replace(/\D/g,'');
>>
>>            var x_exp_date                      =
>> $('#p_cc_exp_month').val()+$('#p_cc_exp_year').val();
>>
>>            var x_amount                        =
>> $('input[name=x_amount]:checked').val();
>>            var x_first_name                    =
> $('#x_first_name').val();
>>            var x_last_name                     =   $('#x_last_name').val();
>>            var x_address                       =   $('#x_address').val();
>>            var x_city                          =   $('#x_city').val();
>>            var x_state                         =   $('#x_state').val();
>>            var x_zip                           =   $('#x_zip').val();
>>            var x_email                         =   $('#x_email').val();
>>
>>            values  =   {   x_login:                    x_login,
>>                            x_tran_key:                 x_tran_key,
>>                            x_relay_response:           x_relay_response,
>>                            x_type:                     x_type,
>>                            x_method:                   x_method,
>>                            x_description:              x_description,
>>                            x_card_num:                 x_card_num,
>>                            x_exp_date:                 x_exp_date,
>>                            x_amount:                   x_amount,
>>                            x_first_name:               x_first_name,
>>                            x_last_name:                x_last_name,
>>                            x_address:                  x_address,
>>                            x_city:                     x_city,
>>                            x_state:                    x_state,
>>                            x_zip:                      x_zip,
>>                            x_email:                    x_email
>> }
>>
>>            $.ajax      ({  cache:                      false,
>>                            type:                       'post',
>>                            url:
>> 'https://test.authorize.net/gateway/transact.dll',
>>                            dataType:                   'json',
>>                            data:                       values,
>>
>>                            beforeSend:                 function() {
>>
>>    
>> $('#processing_image').fadeIn(250);
>>    
>> $('#processing_text').fadeIn(250);
>>
>>                                                        },
>>
>>                            success:                    function(data) {
>>
>> (this alert never works...) --------------------->      alert('inside
>> success callback');
>>
>>                                                           var parsedData =
>> data.split('|');
>>
>> (nothing appears in the console log ------------->      console.log('Data
>> Response:', data, 'Parsed Response:', parsedData);
>>
>>                                                           if      (
>> parsedData[0] == 1                              )
>> (this alert doesn't show) ----------------------->              {
>> alert('SUCCESS\nCode: ' + parsedData[0])        }
>>
>> (this alert doesn't show) ----------------------->      else    {
>> alert('FAILURE\nCode: ' + parsedData[0] + '\nReason: ' + parsedData[3]) }
>>
>>
>> (this is the success code I've been trying ------>      //if      (
>> response != ''     )
>>                                                           //        {
>> $('#processing_image').hide();
>>                                                           //
>> $('#processing_text').hide();
>>                                                           //
>> $('#processing_success').fadeIn(250);
>>                                                           //
>> $('#response_code').empty().append(response);         }
>>
>>                                                           //else    {
>> $('#response_code').empty().append(response);         }
>>
>>               
>>
>>                                                       } // success function
>>               }); // $.ajax
>>
>>           }); // click function
>>
>>       }); // document ready function
>>
>>
>>
>>           
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352734
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to