I am trying to get the refId from the transaction details related to a webhook response to a Hosted Accept page (the payment page works, get a token, getting the webhook response with no problems) and the refId (our order number) that is sent to the transaction is not getting returned in the refId from the get trans detail.
The code I use to set the refId is on getting the payment page:
GetHostedPaymentPageRequest apiRequest = new GetHostedPaymentPageRequest();
apiRequest.setTransactionRequest(txnRequest);
apiRequest.setHostedPaymentSettings(alist);
apiRequest.setRefId(refId);
GetHostedPaymentPageController controller = new GetHostedPaymentPageController(apiRequest);
controller.execute();
GetHostedPaymentPageResponse response = new GetHostedPaymentPageResponse();
response = controller.getApiResponse();
The getting and using of the page works fine, but when I get the transaction deatils from the transactionId passed back in the webhook, it returns null for the refId.
The code I am using to get the transaction data works with no problem and is below:
public static GetTransactionDetailsResponse getAnetTransaction(String transactionId)
{
ApiOperationBase.setEnvironment(getEnvMode());
MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
merchantAuthenticationType.setName(CAPCP_PMT_VENDOR_ID_1);
merchantAuthenticationType.setTransactionKey(CAPCP_PMT_VENDOR_ID_2);
ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);
GetTransactionDetailsRequest getRequest = new GetTransactionDetailsRequest();
getRequest.setMerchantAuthentication(merchantAuthenticationType);
getRequest.setTransId(transactionId);
GetTransactionDetailsController controller = new GetTransactionDetailsController(getRequest);
controller.execute();
GetTransactionDetailsResponse getResponse = controller.getApiResponse();
if (getResponse != null)
{
if (getResponse.getMessages().getResultCode() == MessageTypeEnum.OK)
{
System.out.println(new Date().toString() + " - >>>> getAnetTransaction: Got ANET transaction data for OrderNo: " + getResponse.getRefId());
}
else
{
System.out.println(new Date().toString() + " - >>>> getAnetTransaction: Failed to get transaction details: transactionId: " + transactionId
+ " ResultCode: "+ getResponse.getMessages().getResultCode());
}
}
return getResponse;
}
Can someone let me know if I am missing something or this is the incorrect way to link a webhook to the order that is processed?
I have not been able to find anything else on how to link a payment result to the initiating order that is linked to the webhook trans ID as the trans id does not seem to be returned with the page initialization.
Thanks for any help,
Ed
Solved! Go to Solution.
โ01-28-2018 09:43 AM
Hi @synconnv1
As a workaround you can pass the refID in the invoiceNumber field under the order when calling the getHostedPaymentPageRequest.
You should be getting back the invoiceNumber in the getTransactionDetails call .
Hope this helps .
โ01-30-2018 02:42 PM
Hi @synconnv1
Thanks for your post . This is a bug in the Accept Hosted where refID is not getting passed correctly .
Our team is currently working on a fix for it . We will update the post once we are near the release .
Also we are going to enhance our Webhook Notifications to return the merchantRefID and
invoiceNumber in the payload in an upcoming release .
Thanks
โ01-29-2018 10:22 PM
Hey Anurag,
Its good to know its a bug and I am not crazy, but the problem is my client wants to go live and with this bug I have not been able to find any other way to link the transaction coming back from the webhook to my system's order.
Until this gets fixed, how do I get some sort of reference back to my system so I can know what order the payment needs to be posted back to?
Thanks,
Ed
โ01-30-2018 05:45 AM
Hi @synconnv1
As a workaround you can pass the refID in the invoiceNumber field under the order when calling the getHostedPaymentPageRequest.
You should be getting back the invoiceNumber in the getTransactionDetails call .
Hope this helps .
โ01-30-2018 02:42 PM
Has this been fixed ?
โ05-22-2018 12:41 AM
Has this been fixed ?
โ05-22-2018 12:48 AM
I can confirm that this issue has not yet been fixed, but I am told that it has been escalated and is expected in an upcoming release.
โ08-13-2018 07:01 AM
Also confirming that this still doesn't work.
Even if you set the refId on the original transaction, getTransactionDetails does NOT return the value in transRefId.
And to clarify, this is the transRefId field we're talking about. Not the refTransId field (which would contain the original transaction Id for say a refund) and not the refId field (which would contain the refId value submitted with the getTransactionDetails request.
โ08-31-2018 03:39 PM
Glad I found this thread. Was struggling with this today, and frustrated that transRefId was coming back null. Hoping for a fix soon.
โ09-19-2018 06:15 PM
Not fixed yet?
โ01-17-2019 03:23 PM