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.

Checkout API Error Messages are Vague

Checkout API Error Messages are Vague

jbgrunewald
Shopify Partner
21 1 7

Greetings, 

 

We are a sales channel using the checkout API. Recently we had a scenario, where we attempted to create a checkout with an OOS item and received a 422 HTTP response. The error message in the response just stated that there was invalid input, which wasn't terribly helpful in understanding where we erred. It would be awesome if we could get similar message to other APIs, which could indicate the field that is incorrect. 

 

One way I've thought of to mitigate this is to add each line item to the cart one at a time, and handle errors on our side appropriately. However, this does increase the number of requests to the Shopify backend. Please let me know if there's another preferred way to handle OOS items being added to a checkout. 

 

Thanks!

Replies 2 (2)

hassain
Shopify Staff (Retired)
624 104 189

Hey @jbgrunewald ,

 

For Sales Channels, perhaps it might be worth looking into using the GraphQL Storefront API instead for creating the checkout experience? Since it uses GraphQL, the error messaging is different. Also with the Storefront API the rate limiting in on a per customer IP basis, so you do not have to worry about sending too many requests for adding one line item at a time.

 

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

jbgrunewald
Shopify Partner
21 1 7

Thanks, I'll need to take a look at the store front API more closely to make an informed decision. At first glance there may be some blockers to our current setup. We would be grateful if you could pass along the feedback for the checkout API. In the meantime, I'll take a closer look and see if the storefront API might work for our use case.