Refund callback returns 422 'Unable to find pending transaction with id XXX' but refund successful

Highlighted
New Member
3 0 0

Hello there,

 

I have a hosted payment gateway, and I've added checkout and refund endpoints. When I use the 'refund' functionality from the shopify admin, the callback returns a '422 Unable to find pending transaction with id XXX' but the refund is always successful. The x_reference id is the checkout id which I had during the order creation. This is what I received as the x_reference during the redirect to my payment gateway.

Here is how the order is created:

After the payment is deducted, we call the shopify call back (x_url_callback). This creates an order - 'Paid' and 'Unfulfilled'. 

Here is the request payload to the callback to create order:

{x_transaction_type=sale, x_signature=<signature>, x_reference=<original x_reference from checkout API>, x_account_id=<confidential account id>, x_currency=<3 letter currency code>, x_amount=<amount from checkout call>, x_gateway_reference=<unique reference sent from the gateway>, x_result=completed, x_test=false}

 

Here is the request payload to refund an order:

{x_account_id=<confidential account id>, x_amount=<amount received from the refund call>, x_reference=<original x_reference from checkout API>, x_currency=<3 letter currency code>, x_gateway_reference=<unique reference sent from the gateway>, x_test=false, x_url_callback=<url callback>, x_transaction_type=refund, x_signature=<signature>}

 

The refund is always successful  and the order status changes to 'Refunded' and the 'Timeline' shows that the order has been successfully refunded. However the log returns a 422:

Unable to find pending transaction with id <x_reference>

 

Please help answering two questions:

1. Why do I get the above error?

2. Why is the refund successful?

0 Likes