Consistency Issue with Draft Orders and Invoices

Previously, when creating Draft Orders via the Admin API, we would get the response back from Shopify and immediately redirect the user to the invoice URL that comes back from the Draft Order creation.

Lately, there seems to be some delay between when the draft order is created and the invoice is actually ready. If we redirect the user immediately to the invoice URL they are met with this error page:


So what we’re doing now is polling the invoice URL in our code until we get a 200 response back and then redirecting the user to the URL after that.

Just curious if this is a bug or if this is intended behavior.

Thanks!

8 Likes

Or fails with this screen when trying to get to the checkout page:

2 Likes

Hi @taylor-single ,

There’s a [DraftOrder.ready] property available in the GraphQL Admin API which can be used to check for when it’s ready, the description reads:

Whether the Draft Order is ready and can be completed. Draft Orders might have asynchronous operations that can take time to finish.

Hope you have a great day

1 Like