cancel
Showing results for 
Search instead for 
Did you mean: 

Reference ID not being returned in getting after transaction detail

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

ArslanAsh
Member
0 REPLIES 0