cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Looking For Example

Hello.

 

We are in the early stages of trying to use Authorize.Net.

 

We have been focusing on the following process to establish a new customer and use the hosted AN site to prompt the customer for credit card info.

 

Our process is as follows:

 

1. Call createCustomerProfileRequest to get a new customer profile ID.

 

2. Call getHostedProfilePageRequest to get a token based on the customer profile ID.  In this call, if we set the return URL as:

<setting>
<settingName>hostedProfileReturnUrl</settingName>
<settingValue>"http://xxxx.com/ReturnURL</settingValue>
</setting>

 

3. Display a page for the customer to go to the AN hosted page to create a new Payment Profile.  To do that we are doing a POST to https://test.authorize.net/customer/addPayment (see below).  This works by taking the customer to the AN page to enter and create a payment profile.

 

This all works and we are able to process the response objects except for the the POST (#3).  How can we get the response data for this?  Sample code would be greatly appreciated.

 

POST Html:

<body>
    <form method="post" action="https://test.authorize.net/customer/addPayment" id="formAuthorizeNetTestPage" name="formAuthorizeNetTestPage">
    <!--<form method="post" action="https://test.authorize.net/profile/manage" id="formAuthorizeNetTestPage" name="formAuthorizeNetTestPage">-->
    <!--<form method="post" action="https://test.authorize.net/payment/payment" id="formAuthorizeNetTestPage" name="formAuthorizeNetTestPage">-->
    <input type="hidden" name="token" value="<token is here>" />
  Continue to Authorize.Net to Payment Page
  <button id="btnContinue">Continue to next page1</button>
  </form>

</body>

DNB
Member
5 REPLIES 5

Hello,

 

If the customer returns to your website, you can receive the result of the transaction. How the you receive the results depends on how you integrate the payment form.

 

With the iframe/Lightbox Method

The hosted form cannot directly provide transaction details to the page that hosts the iframe.

However, by hosting on your domain a small JavaScript-powered page called an iframe communicator, you can pass some details between the payment form and the merchant site.

 

When you embed the hosted payment form in an iframe on your page, the form can in turn embed your iframe communicator within an invisible iframe. Through this invisible iframe, messages are sent to your iframe communicator. If you host the iframe communicator on the same domain as the page in which you embedded the form, the iframe communicator relays the messages to your page's listener script.

 

Note: You must use HTTPS in the URL to your iframe communicator.

 

The following example shows the iframe communicator message when the customer successfully submits a transaction through the embedded payment form. ThecreatePaymentProfileResponse property appears only if the customer opts to save a new payment method, and if a new payment profile was successfully created, the success parameter is set to true.

action=transactResponse&response={"accountType":"MasterCard","accountNumber":"XXXX5454",
"transId":"2155590169","responseCode":"1","authorization":"D29J20","merchantName":
"G and S Questions Inc.","billTo":{"phoneNumber":"425 111 2222","firstName":"Bob",
"lastName":"Smith","address":"1234 Test Ave N.E. %5","city":"Tester","state":"WA","zip":
"98009","country":"USA"},"shipTo":{"firstName":"Bob","lastName":"Smith","address":
"1234 Test Ave N.E.","city":"Tester","state":"WA","zip":"98009","country":"USA"},
"orderDescription":"Order description","taxAmount":"1.01","shippingAmount":"2.01",
"dutyAmount":"3.01","customerId":"CUST12345","totalAmount":"62.88","poNumber":
"PO#12345678","orderInvoiceNumber":"INV_pf7JzZb","dateTime":"9/13/2018 5:40:55 PM",
"createPaymentProfileResponse":{"success":"true","message":"null"}}

Note: If you host the form in an iframe, you must include the iframe communicator URL in the hostedPaymentIFrameCommunicatorUrl parameter of your getHostedPaymentPageRequest API call. To ensure that you receive a response code, you must also set showReceipt to false.

 

Redirect Method

When you use the hosted payment form directly, rather than from within an iframe, the continue and cancel buttons send an HTTP GET request to that URL when clicked, and the customer is redirected to the cancel URL or continue URL, depending on which button the customer clicked. No other information about the transaction is provided. When you use the redirect method, the receipt page is always displayed.

 

All Methods

With any of the form integration methods, you can embed information specific to the customer into the continue URL or the cancel URL. Your server's code can embed a tracking code into the URL that can identify the specific customer and order details when the customer returns. URL-encode any name-value pairs embedded in the URL to ensure correct processing in the form request.

 

Additionally, you can register for Webhooks to receive real-time notifications when transactions are either declined or approved. Wehn using Webhooks you will receive a transaction notification regardless of whether the customer closed the browser without clicking the continue button.

Powered by NexWebSites.com -
Certified Authorize.net developers
NexusSoftware
Trusted Contributor

Thanks for the reply.

 

We are using the Redirect or hosted approach.

 

When you say "No other information about the transaction is provided." do you mean the HTTP Get URL (either for the cancel URL or the continue URL) that the customer is returned to does not have any Json/XML data returned?

 

In other words, is the only thing you know is that the customer either completed the redirect (ie. established a new payment method) or the user canceled the operation?

 

Thanks.

 

 

Yes, with the redirect method, the only additional information returned is any URL-encoded name-value pairs that you may have sent with the request. Which is why, if you require transaction information using the Accept Hosted methods, that you use the iFame or Light box with the iFrame communicator, or set up webhooks for the transaction notifications.

Powered by NexWebSites.com -
Certified Authorize.net developers
NexusSoftware
Trusted Contributor

Ok.  I understand what you said.

 

So I have 2 questions:

 

Do we need any information other than whether the customer succeeded or failed to establish a new payment method (card number, etc.)?  Don't we need the new customer payment profile ID that was created?

 

How do we get the URL-encoded name-value pairs back that we sent with the request?  This is where we are lacking.  Do you have an example of a "return" URL page showing how we query the name-values?

 

We are setting the return URL in our prior API call getHostedProfilePageRequest.  We specify the return URL as follows:

<setting>
<settingName>hostedProfileReturnUrl</settingName>
<settingValue>"http://xxxx.com/ReturnURL</settingValue>
</setting>

 

Isn't this the "continue" return URL?  How do we specify the "cancel" return URL?

 

Let me say that we are not charging the customer at this point.  We are only creating a customer and allowing the customer to create a payment profile that we will then charge at a later time.

 

Thanks again for all your help!

 

Before you can send the HTML form post, you will need to retrieve a token using the getHostedProfilePageRequest method. You must include the customer's profile ID in your request.


If the call failed or was canceled then you won't get a token back.


The hostedProfileReturnUrl is the URL for the page the customer returns to when the hosted session ends. The URL-encoded name-value pairs get appended to the ReturnURL that you specified.

 

Note, that because the URL query parameters are being sent via XML, any ampersands '&' need to be valid XML: &amp;

 

<setting>
<settingName>hostedProfileReturnUrl</settingName>
<settingValue>https://xxxx.com/ReturnURL/?customerID=1231&amp;otherParameter=42</settingValue>
</setting>

The method used to parse the query string (URL-encoded name-value pairs) varies and will depend on your server's environment and application's language. In C# for example:

string customerID= Request.QueryString["customerID"];

 

Powered by NexWebSites.com -
Certified Authorize.net developers
NexusSoftware
Trusted Contributor