โ11-14-2019 03:58 AM
Hello,
I just yesterday asked a similar question
I have not figured out the way to pass refId into AZ via their API,
but once that' is passed in, you would have to create a event subscription notification receiver
(basically a separate app or a separate REST end point in your existing backend.
And 'listen' to events comming from authorize.net, in there with event payload, there will be merchantReferenceId (which is the refId that we are somehow supposed to pass in (this is part I still do not know) )
And that's how you will be able to get status and details of the CC Payment.
you will not be able to get it 'inline' when AZ redirects User's webbrowser from their Hosted Payment page back to your http://localhost/Test/authorized/auth-receipt.php
โ11-14-2019 08:41 AM
If your issue regarding Authorized dot net hosted Form response issues is not yet resolved then you can contact me...
I can help in that matter just hit me up at my personal email stromy@mynstrom.com
โ11-22-2019 07:49 AM
We are using Redirect module to capture payments, that is a token is generated by calling getHostedPaymentPageRequest, after receiving the token we do a form post to authorize.net/payment page, for authorize.net to capture the payment details.
We are able to successfully implement the above process, however upon clicking on "Pay" on payments page it is redirecting to receipt page, even if we set "showReceipt\": false for hostedPaymentReturnOptions settings.
Also, after clicking on โContinue to siteโ button on receipt page, its successfully redirected to desired custom โAuthorizeNetReturn.aspxโ page of our application but we are unable to get or read receipt/transaction response data i.e. responseCode,AuthorizationCode and TransactionID on โAuthorizeNetReturn.aspxโ page
Below is the code
ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
{
name = loginID,
ItemElementName = ItemChoiceType.transactionKey,
Item = transactionKey,
};
settingType[] settings = new settingType[7];
string returnURL = CommonHelper.GetStoreLocation(false) + "AuthorizeNetReturn.aspx";
settings[0] = new settingType();
settings[0].settingName = settingNameEnum.hostedPaymentButtonOptions.ToString();
settings[0].settingValue = "{\"text\": \"Pay\"}";
settings[1] = new settingType();
settings[1].settingName = settingNameEnum.hostedPaymentOrderOptions.ToString(); settings[1].settingValue = "{\"show\": true}";
settings[2] = new settingType();
settings[2].settingName = settingNameEnum.hostedPaymentReturnOptions.ToString();
settings[2].settingValue = "{\"url\": \"" + returnURL + "\",\"urlText\":\"Continue to site\",\"cancelUrl\": \"" + returnURL+"\", \"showReceipt\": false}";
settings[3] = new settingType();
settings[3].settingName = settingNameEnum.hostedPaymentPaymentOptions.ToString();
settings[3].settingValue = "{\"cardCodeRequired\": true, \"showCreditCard\": true, \"showBankAccount\": false}";
settings[4] = new settingType();
settings[4].settingName = settingNameEnum.hostedPaymentBillingAddressOptions.ToString();
settings[4].settingValue = "{\"show\": false}";
settings[5] = new settingType();
settings[5].settingName = settingNameEnum.hostedPaymentShippingAddressOptions.ToString();
settings[5].settingValue = "{\"show\": false}";
settings[6] = new settingType();
settings[6].settingName = settingNameEnum.hostedPaymentIFrameCommunicatorUrl.ToString();
settings[6].settingValue = "{\"url\": \"" + returnURL+"?mode=post" + "\"}";
var billTo = new customerAddressType
{
firstName = order.BillingFirstName,
lastName = order.BillingLastName,
address = order.BillingAddress1,
city = order.BillingCity,
state = order.BillingStateProvince,
zip = order.BillingZipPostalCode,
country=order.BillingCountry,
phoneNumber=order.BillingPhoneNumber
};
var shipTo = new customerAddressType
{
firstName = order.ShippingFirstName,
lastName = order.ShippingLastName,
address = order.ShippingAddress1,
city = order.ShippingCity,
state = order.ShippingStateProvince,
zip = order.ShippingZipPostalCode,
country = order.ShippingCountry,
phoneNumber = order.ShippingPhoneNumber
};
var transactionRequest = new transactionRequestType
{
transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),
amount = Convert.ToDecimal(order.OrderTotal.ToString("####.00", new CultureInfo("en-US", false).NumberFormat)),
billTo = billTo,
shipTo=shipTo
};
var request = new getHostedPaymentPageRequest();
request.transactionRequest = transactionRequest;
request.hostedPaymentSettings = settings;
// instantiate the controller that will call the service
var controller = new getHostedPaymentPageController(request);
controller.Execute();
// get the response from the service (errors contained if any)
var response = controller.GetApiResponse();
if (response != null)
{
if (response.messages.resultCode == messageTypeEnum.Ok)
{
remotePostHelper.Add("token", response.token.ToString());
remotePostHelper.Post();
}
}
We went through the documentation of Authorize.net and as per that we tried using both hostedPaymentIFrameCommunicatorUrl and hostedPaymentReturnOptions, but with none we could acheive the desired result.
One more thing which we wanted to mention here is that we are not using iframe, but instead doing a form post to authorize.net/payments to capture credit card details and return back data to our application.
Kindly advise if we were missing out anything, any help will be much appreciated.
โ07-23-2020 08:46 PM
Sorry I cannot see what exactly the problem might be in your code.
However below is a portion of my Java code that setups the the call to receive the token.
May it will be of some help.
I always see the receipt page, but then, once the button there clicked, the user is redirected to the appropriate route on my site.
In my experience (this was mostly last year). AuthorizeNet APIs are not always match documentation. And unless it is a 'show stopper', it might never get improved. So if there is a plausable workaround, share it here, and use it!
------------ java --------
SettingType sett_payBtnOptions = new SettingType();
sett_payBtnOptions.setSettingName("hostedPaymentButtonOptions");
sett_payBtnOptions.setSettingValue("{\"text\": \"Pay\"}");
SettingType sett_payOrderOptions = new SettingType();
sett_payOrderOptions.setSettingName("hostedPaymentOrderOptions");
sett_payOrderOptions.setSettingValue(String.format("{\"show\": true," +
"\"merchantName\":\"%s\"}",
otherCFG.getBusinessName()));
SettingType sett_returnOptions= new SettingType();
sett_returnOptions.setSettingName("hostedPaymentReturnOptions");
sett_returnOptions.setSettingValue(String.format("{\"showReceipt\": true, " + /* Note: If you do not embed the payment form in an iframe, the receipt page is displayed regardless of the value of showReceipt. */
"\"url\":\"%s\"," +
" \"urlText\": \"Continue\"," +
" \"cancelUrl\": \"%s\"," +
" \"cancelUrlText\": \"Cancel\"}",
replyCFG.getFullURL__Accepted(THIS_PPID),
replyCFG.getFullURL__Cancelled(THIS_PPID)));
SettingType sett_CustomerOptions = new SettingType();
sett_CustomerOptions.setSettingName("hostedPaymentCustomerOptions");
sett_CustomerOptions.setSettingValue("{\"showEmail\": true, " +
"\"requiredEmail\": false, \"addPaymentProfile\": false}");
SettingType sett_BillingAdrOptions = new SettingType();
sett_BillingAdrOptions.setSettingName("hostedPaymentBillingAddressOptions");
sett_BillingAdrOptions.setSettingValue("{\"show\": true, " +
"\"required\": false}");
ArrayOfSetting alist = new ArrayOfSetting();
alist.getSetting().add(sett_returnOptions);
alist.getSetting().add(sett_payBtnOptions);
alist.getSetting().add(sett_CustomerOptions);
alist.getSetting().add(sett_BillingAdrOptions);
alist.getSetting().add(sett_payOrderOptions);
GetHostedPaymentPageRequest apiRequest = new GetHostedPaymentPageRequest();
apiRequest.setTransactionRequest(txnRequest);
apiRequest.setHostedPaymentSettings(alist);
GetHostedPaymentPageController controller = new GetHostedPaymentPageController(apiRequest);
controller.execute();
GetHostedPaymentPageResponse //response = new GetHostedPaymentPageResponse();
response = controller.getApiResponse();
if (response!=null) {
if (response.getMessages().getResultCode() == MessageTypeEnum.OK) {
System.out.println(response.getMessages().getMessage().get(0).getCode());
System.out.println(response.getMessages().getMessage().get(0).getText());
System.out.println(response.getToken());
}
else {
System.out.println("Failed to get hosted payment page: " + response.getMessages().getResultCode());
}
}
return response;
โ10-30-2020 09:42 PM
I think you miss out one or two steps of coding I would do suggest to you please relook your coding where you have left one or two line I am sharing the exactly code here Mynordstrom Employee Portal
SettingType sett_payBtnOptions = new SettingType();
sett_payBtnOptions.setSettingName("hostedPaymentButtonOptions");
sett_payBtnOptions.setSettingValue("{\"text\": \"Pay\"}");
SettingType sett_payOrderOptions = new SettingType();
sett_payOrderOptions.setSettingName("hostedPaymentOrderOptions");
sett_payOrderOptions.setSettingValue(String.format("{\"show\": true," +
"\"merchantName\":\"%s\"}",
otherCFG.getBusinessName()));
SettingType sett_returnOptions= new SettingType();
sett_returnOptions.setSettingName("hostedPaymentReturnOptions");
sett_returnOptions.setSettingValue(String.format("{\"showReceipt\": true, " + /* Note: If you do not embed the payment form in an iframe, the receipt page is displayed regardless of the value of showReceipt. */
"\"url\":\"%s\"," +
" \"urlText\": \"Continue\"," +
" \"cancelUrl\": \"%s\"," +
" \"cancelUrlText\": \"Cancel\"}",
replyCFG.getFullURL__Accepted(THIS_PPID),
replyCFG.getFullURL__Cancelled(THIS_PPID)));
SettingType sett_CustomerOptions = new SettingType();
sett_CustomerOptions.setSettingName("hostedPaymentCustomerOptions");
sett_CustomerOptions.setSettingValue("{\"showEmail\": true, " +
"\"requiredEmail\": false, \"addPaymentProfile\": false}");
SettingType sett_BillingAdrOptions = new SettingType();
sett_BillingAdrOptions.setSettingName("hostedPaymentBillingAddressOptions");
sett_BillingAdrOptions.setSettingValue("{\"show\": true, " +
"\"required\": false}");
ArrayOfSetting alist = new ArrayOfSetting();
alist.getSetting().add(sett_returnOptions);
alist.getSetting().add(sett_payBtnOptions);
alist.getSetting().add(sett_CustomerOptions);
alist.getSetting().add(sett_BillingAdrOptions);
alist.getSetting().add(sett_payOrderOptions);
GetHostedPaymentPageRequest apiRequest = new GetHostedPaymentPageRequest();
apiRequest.setTransactionRequest(txnRequest);
apiRequest.setHostedPaymentSettings(alist);
GetHostedPaymentPageController controller = new GetHostedPaymentPageController(apiRequest);
controller.execute();
GetHostedPaymentPageResponse //response = new GetHostedPaymentPageResponse();
response = controller.getApiResponse();
if (response!=null) {
if (response.getMessages().getResultCode() == MessageTypeEnum.OK) {
System.out.println(response.getMessages().getMessage().get(0).getCode());
System.out.println(response.getMessages().getMessage().get(0).getText());
System.out.println(response.getToken());
}
else {
System.out.println("Failed to get hosted payment page: " + response.getMessages().getResultCode());
}
}
โ01-07-2023 06:58 AM - edited โ01-07-2023 07:08 AM
I ensure you there is minors mistake what I have seen in your coding you can please rectify you blends on coding because you missing any one minor mistake you code won't be accepted for further procedure.
SettingType sett_payBtnOptions = new SettingType();
sett_payBtnOptions.setSettingName("hostedPaymentButtonOptions");
sett_payBtnOptions.setSettingValue("{\"text\": \"Pay\"}");
SettingType sett_payOrderOptions = new SettingType();
sett_payOrderOptions.setSettingName("hostedPaymentOrderOptions");
sett_payOrderOptions.setSettingValue(String.format("{\"show\": true," +
"\"merchantName\":\"%s\"}",
otherCFG.getBusinessName()));
SettingType sett_returnOptions= new SettingType();
sett_returnOptions.setSettingName("hostedPaymentReturnOptions");
sett_returnOptions.setSettingValue(String.format("{\"showReceipt\": true, " + /* Note: If you do not embed the payment form in an iframe, the receipt page is displayed regardless of the value of showReceipt. */
"\"url\":\"%s\"," +
" \"urlText\": \"Continue\"," +
" \"cancelUrl\": \"%s\"," +
" \"cancelUrlText\": \"Cancel\"}",
replyCFG.getFullURL__Accepted(THIS_PPID),
replyCFG.getFullURL__Cancelled(THIS_PPID)));
SettingType sett_CustomerOptions = new SettingType();
sett_CustomerOptions.setSettingName("hostedPaymentCustomerOptions");
sett_CustomerOptions.setSettingValue("{\"showEmail\": true, " +
"\"requiredEmail\": false, \"addPaymentProfile\": false}");
SettingType sett_BillingAdrOptions = new SettingType();
sett_BillingAdrOptions.setSettingName("hostedPaymentBillingAddressOptions");
sett_BillingAdrOptions.setSettingValue("{\"show\": true, " +
"\"required\": false}");
ArrayOfSetting alist = new ArrayOfSetting();
alist.getSetting().add(sett_returnOptions);
alist.getSetting().add(sett_payBtnOptions);
alist.getSetting().add(sett_CustomerOptions);
alist.getSetting().add(sett_BillingAdrOptions);
alist.getSetting().add(sett_payOrderOptions);
GetHostedPaymentPageRequest apiRequest = new GetHostedPaymentPageRequest();
apiRequest.setTransactionRequest(txnRequest);
apiRequest.setHostedPaymentSettings(alist);
GetHostedPaymentPageController controller = new GetHostedPaymentPageController(apiRequest);
controller.execute();
GetHostedPaymentPageResponse //response = new GetHostedPaymentPageResponse();
response = controller.getApiResponse();
if (response!=null) {
if (response.getMessages().getResultCode() == MessageTypeEnum.OK) {
System.out.println(response.getMessages().getMessage().get(0).getCode());
System.out.println(response.getMessages().getMessage().get(0).getText());
System.out.println(response.getToken());
}
else {
System.out.println("Failed to get hosted payment page: " + response.getMessages().getResultCode());
}
}
โ01-07-2023 07:06 AM - last edited on โ01-07-2023 07:16 AM by KH-Taylarie