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 token = null

Checkout token = null

ArtemB
Visitor
3 0 0

In my app i process Checkout webhooks and Order webhooks. I trying to associate Order and Checkout on my backend by 'checkout_token' value, but i came across the issue that sometimes i get '/order/paid' hook with 'checkout_token' equals null. It's confusing. Maybe I'm missing an idea. The question is what are the conditions for the 'checkout_token' can be null? Is that correct behavior? How can i associate Checkout and Order differently then? Thanks

Replies 3 (3)

Luke_K
Shopify Staff
402 66 103

Hey @ArtemB 

 

The Checkout Token can indeed be null dependent on some scenarios. If the order was created directly through the API, it will be null. Furthermore, if the order started it's life as a Draft Order, the checkout token would be null too.

 

If the order went through web checkout or POS checkout, then it would possess a checkout token. Hope that helps!

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
ArtemB
Visitor
3 0 0

Hello @Luke_K 

Thanks for the reply!
The suggestion about the Draft Order makes sense, but i think it's not my case. There were six null tokens and much more draft orders.
I haven't seen any other null cases yet, but I'd still like to know the reason. I'll keep an eye on it.

jahilldev
Shopify Partner
26 1 11

Hi @Luke_K ,

 

I've just bumped into this, is there a workable alternative to the checkout token to reconcile requests between the checkout/update hook and order/create? We're currently using this as an identifier to store data between webhook requests and the token being null means a lot of this doesn't work.

 

Is there an alternative you'd suggest? I can see a "checkout ID" but I'm assuming if the checkout token is null, this would be too.

 

Also, is there some schema documentation on the webhook payloads too? That would be a great help in building type definitions and avoiding assumptions on value types (checkout token is not always a string!)

 

Really appreciate any input.

 

James