Reply
Highlighted
Member
Posts: 3
Registered: ‎02-07-2017
Accepted Solution

How to get Receipt TransactionId and Authorization Code - back to Merchant (getHostedPaymentPageRe)

Hi,

 

I am a Java developer. We are trying to integrate Authorize.net to our application. We are planning to use Authorize.net payment page (used "getHostedPaymentPageRequest" API service). It's redirecting me to Payment page successfully, done the payment successfully. Got to see TransactionID and Authorization Code on Receipt page. But how do i get those details(TransactionID and AuthorizationCode) back to my server on click on 'Continue' button ?  

 

I need TransactionID and AuthorizationCode desperately to store in my local database for corresponding Order.

 

I am using (test.authorize.net)

 

Please help, I am completely stuck. 

 

Below is the code i am using:

 

 

https://apitest.authorize.net/xml/v1/request.api


<getHostedPaymentPageRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
	<merchantAuthentication>
		<name>xxxx</name>
		<transactionKey>yyyy</transactionKey>
	</merchantAuthentication>
	<transactionRequest>
		<transactionType>authCaptureTransaction</transactionType>
		<amount>20.00</amount>
	</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>
	</hostedPaymentSettings>
</getHostedPaymentPageRequest>

 

HTML page:

 

 

<FORM METHOD=POST ACTION= "https://test.authorize.net/payment/payment">
	<input type="hidden" name="token" value="zzzzzz"/>
	<INPUT TYPE=SUBMIT VALUE="Click here for the secure payment form" />
</form>

 

Thanks,

David

Member
Posts: 3
Registered: ‎02-07-2017

Re: How to get Receipt TransactionId and Authorization Code - back to Merchant (getHostedPaymentPag

Any suggestions please ?

 

 

Developer
Posts: 82
Registered: ‎03-28-2014

Re: How to get Receipt TransactionId and Authorization Code - back to Merchant (getHostedPaymentPag

Couple of suggestions:

 

If you embed the hosted page as an iFrame, you can use the iFrameCommunicator to get the transactionId, AuthCode, etc.  See sample code at https://github.com/AuthorizeNet/accept-sample-app/blob/master/index.php line 208 "transactResponse".

 

If you want to use a standard redirect (as it sounds like you're doing) you can register a webhook and get notified asynchronously of the transaction details:  http://developer.authorize.net/api/reference/features/webhooks.html

 

Hope this helps,

 

Brian

Member
Posts: 3
Registered: ‎02-07-2017

Re: How to get Receipt TransactionId and Authorization Code - back to Merchant (getHostedPaymentPag

Thanks for the suggestion. Webhook rocks!