Draft Order API Asynchronous?

Highlighted
Tourist
9 0 0

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?

0 Likes
Shopify Staff
Shopify Staff
141 23 28

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

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Tourist
9 0 0
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!
0 Likes
Shopify Staff
Shopify Staff
141 23 28

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?

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes