Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
I use Shopify checkout website to let customers finish checkout.
How can I make sure the checkout was be paid? Is there any best practice to confirm if the checkout is paid or not?
I use retrieve Checkout API to get the checkout data and upload the response to this gist for a better view:
https://gist.github.com/Kcin1993/e563988f1e1e8ec56891dda3e203159d
I am using order === null to identify checkout as unPaid. And try to simulate fail payment with Bogus gateway(test payment)
Thanks for advice
Solved! Go to the solution
This is an accepted solution.
Hey there,
When the checkout is complete, the `order` property will contain the ID, name, and status page URL of the associated order, prior to that, it will default to `null`.
That being said, it's possible for a checkout to be complete, but not technically marked as 'paid'. This is because you can have a transaction authorized, but not yet captured. So you can take a look at the list of transactions associated with the order which is also provided in the checkout payload to make sure that payment is complete. Alternatively, you can use the order ID provided to you to query the `/admin/orders.json` endpoint to retrieve the `financial_status` of the order.
To learn more visit the Shopify Help Center or the Community Blog.
This is an accepted solution.
Hey there,
When the checkout is complete, the `order` property will contain the ID, name, and status page URL of the associated order, prior to that, it will default to `null`.
That being said, it's possible for a checkout to be complete, but not technically marked as 'paid'. This is because you can have a transaction authorized, but not yet captured. So you can take a look at the list of transactions associated with the order which is also provided in the checkout payload to make sure that payment is complete. Alternatively, you can use the order ID provided to you to query the `/admin/orders.json` endpoint to retrieve the `financial_status` of the order.
To learn more visit the Shopify Help Center or the Community Blog.
Checkout API only can retrieve one checkout in one request, in our app we often encounter API limit. As you said above, it can fully confirm the checkout is paid by judge order is null or not. I think using Order API is a better way.
Order API contains checkout id, we store checkout id and use Order API to confirm checkout is paid or not. This way can let our app safe in API limit.
Thanks for your reply. It helps a lot.