Handle failed webooks after a payment is processed successfully with a different payment method

New Member
2 0 0

Our payment gateway is currently integrated with Shopify using the HPSDK.

In the scenario where there is no successful payment within 30 minutes after the payment session is initiated we trigger webhooks to the Shopify callback_url with the "failed" status value.

We are currently facing the following issue:

  • Merchant has multiple payment methods on their Checkout page
  • User selects our payment gateway first and gets redirected to our payment page where a payment session is initiated
  • User clicks the "Go Back" button in the browser or the browser and opens the Shopify payment page again through email link
  • The customer then selects another payment method eg. "Cash on delivery" and completes payment successfully for the order
  • After 30 minutes after our payment session is initiated we trigger the webhook with the failed value for the same order
  • This subsequently changes the status of the order in the Shopify admin back-end from "Paid" to "Failed"

As you can see this causes issues for the merchant's order management. Can you suggest how we can handle this scenario where we are unable to determine that the order is successful with another payment method?

Is Shopify using the same value of x_reference for all payment methods? How does Shopify handle multiple webhooks coming from different payment methods for the same order?