Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Draft Order API Asynchronous?

Draft Order API Asynchronous?

stuforge
Tourist
9 0 4

We've noticed that the Draft Order API can return an invoice url that is not yet ready for traffic.

 

How long a delay do we have to add to the code before using the url returned?

Replies 3 (3)

hassain
Shopify Staff (Retired)
624 104 189

Hi @stuforge ,

 

How often do you see this issue happening where the invoice_url is not ready yet to for traffic after the Draft Order is created? Is there a pattern of behaviour you are seeing in which invoice_url are not being instantly generated (e.g. certain times of the day, or for Draft Order with a large number of items, etc)?

 

The invoice_url should always be instantaneously ready and available as soon as the Draft Order is made, but I can see in rare circumstances where there is a slowdown on our platform in which the invoice_url may be slower to generate. I do not foresee this happening often, but if you have a shop ID and timeframe or a draft order ID, I could check our platform logs to investigate what might be occurring at this time to cause the invoice_url from not being always ready immediately

 

Lastly, there has been discussion about this before and some potential solutions discussed at this forum post, which might help you here: https://community.shopify.com/c/Shopify-APIs-SDKs/Draft-API-Error-URL-not-ready/td-p/574400

 

To learn more visit the Shopify Help Center or the Community Blog.

stuforge
Tourist
9 0 4
It happened the very first time I used the url programmatically so maybe I was just very unlucky? But based on the link you kindly provide it seems like a known issue. I didn’t catch the headers on the displayed ‘not ready page’
The link suggests that a 202 status is returned while the invoice is not ready, can you confirm that officially?
thanks!
hassain
Shopify Staff (Retired)
624 104 189

Hey @stuforge 

 

I do not know for sure if you will get a 202 response, but I am fairly confident that if you are receiving the "Oops, something went wrong." screen from Shopify that the response code should be anything other than a 200 response - so perhaps you can be checking for that?

 

To learn more visit the Shopify Help Center or the Community Blog.