Background:
I'm creating my first Authorize.net Accept Hosted solution. The plan is to use the merchant's custom PHP cart to collect the shipping, billing address then present the hosted form to collect payment. Many of the customers will be 'guest' customers without customer profiles generated in the PHP cart.
I have successfully created an XML token request using CURL and used the return token to request the payment form and populate an iframe.
The Problem:
We'd like to pass the billing/shipping info entered into the cart to Auth.net so the customer does not need to re-enter the information. The documentation/examples I have been able to find require use of the SDK to create a customer profile in order to do this.
Is there an easier way?
My questions:
Thanks in advance for your help.
Solved! Go to Solution.
08-30-2017 07:15 AM
Hello,
Yes, you can pass both billing and shipping address infomation to the token reques, which will then be pre-populated in the form :
getHostedPaymentPageRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>YOUR_LOGIN_ID</name>
<transactionKey>YOUR_TRANSACTION_KEY</transactionKey>
</merchantAuthentication>
<transactionRequest>
<transactionType>authCaptureTransaction</transactionType>
<amount>20.00</amount>
<billTo>
<firstName>Ellen</firstName>
<lastName>Johnson</lastName>
<company>Souveniropolis</company>
<address>14 Main Street</address>
<city>Pecan Springs</city>
<state>TX</state>
<zip>44628</zip>
<country>USA</country>
</billTo>
<shipTo>
<firstName>China</firstName>
<lastName>Bayles</lastName>
<company>Thyme for Tea</company>
<address>12 Main Street</address>
<city>Pecan Springs</city>
<state>TX</state>
<zip>44628</zip>
<country>USA</country>
</shipTo>
</transactionRequest>
<hostedPaymentSettings>
<setting>
<settingName>hostedPaymentBillingAddressOptions</settingName>
<settingValue>{"show": true, "required":true}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentButtonOptions</settingName>
<settingValue>{"text": "Pay"}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentReturnOptions</settingName>
<settingValue>{"url":"https://www.mystore.com/good","urlText":"Continue","cancelUrl":"https://www.mystore.com/cancel","cancelUrlText":"Cancel"}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentShippingAddressOptions</settingName>
<settingValue>{"show": true, "required":true}</settingValue>
</setting>
</hostedPaymentSettings>
</getHostedPaymentPageRequest>
08-30-2017 08:06 AM - edited 08-30-2017 08:16 AM
Hello,
Yes, you can pass both billing and shipping address infomation to the token reques, which will then be pre-populated in the form :
getHostedPaymentPageRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>YOUR_LOGIN_ID</name>
<transactionKey>YOUR_TRANSACTION_KEY</transactionKey>
</merchantAuthentication>
<transactionRequest>
<transactionType>authCaptureTransaction</transactionType>
<amount>20.00</amount>
<billTo>
<firstName>Ellen</firstName>
<lastName>Johnson</lastName>
<company>Souveniropolis</company>
<address>14 Main Street</address>
<city>Pecan Springs</city>
<state>TX</state>
<zip>44628</zip>
<country>USA</country>
</billTo>
<shipTo>
<firstName>China</firstName>
<lastName>Bayles</lastName>
<company>Thyme for Tea</company>
<address>12 Main Street</address>
<city>Pecan Springs</city>
<state>TX</state>
<zip>44628</zip>
<country>USA</country>
</shipTo>
</transactionRequest>
<hostedPaymentSettings>
<setting>
<settingName>hostedPaymentBillingAddressOptions</settingName>
<settingValue>{"show": true, "required":true}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentButtonOptions</settingName>
<settingValue>{"text": "Pay"}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentReturnOptions</settingName>
<settingValue>{"url":"https://www.mystore.com/good","urlText":"Continue","cancelUrl":"https://www.mystore.com/cancel","cancelUrlText":"Cancel"}</settingValue>
</setting>
<setting>
<settingName>hostedPaymentShippingAddressOptions</settingName>
<settingValue>{"show": true, "required":true}</settingValue>
</setting>
</hostedPaymentSettings>
</getHostedPaymentPageRequest>
08-30-2017 08:06 AM - edited 08-30-2017 08:16 AM
Perfect! Thanks!
08-30-2017 08:21 AM
BTW is there documentation outlining ALL the possible fields that can be sent with the token request?
08-30-2017 08:23 AM
Yes, https://developer.authorize.net/api/reference/index.html#payment-transactions-get-an-accept-payment-... and more information at: http://developer.authorize.net/api/reference/features/accept_hosted.html
08-30-2017 09:46 AM