We are generating Draft Orders using the REST API and then getting the Invoice URL to redirect customers to in order for them to complete their checkout. However, recently we have noticed a dramatic increase in the number of users who get redirected to the Invoice URL but see an error page.
Is there any way to check if an invoice is ready for payment before redirecting a user to that page?
I found this older thread - https://community.shopify.com/c/customers-discounts-and-orders/draft-order-api-asynchronous/m-p/602273 but the even older thread referenced in here is no longer available.
3 Likes
We use the Shopify API to create a Draft Order then, redirect the user to checkout.
We see this issue as well with some degree of regularity. It really is misleading to customers as well because they just need to reload the page (not go back to previous as directed). It is more than a little frustrating to find no real answers on this. Clearly the response to create the draft kicks off some asynchronous task that “takes time” to prepare the invoice.
Hey @Robert_Radtke & @chriswise71 -
I ran into this too! The docs mention that Draft Orders do indeed have async operations that need to complete before the link will work. They recommend inspecting the headers for a “retry-after” value, then polling the “location” URL sent in the headers (repeating until it’s ready):
https://shopify.dev/docs/api/admin-rest/2023-10/resources/draftorder#post-draft-orders
1 Like
Thank you for pointing that out! Will implement this… not sure why I didn’t see this in the docs before (new addition?)