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.

Re: checkout api - retrieve checkout

checkout api - retrieve checkout

Simon62
Shopify Partner
9 1 3

Is there a way to retrieve the checkout with it's id? 

I'm building a payment gateway - what I want is to get the items and the shipping once it's passed across to my gateway. 

Shopify sends the id, but I have no idea how to access it.

One way would be possibly to use webhooks, but I'd prefer to not store it anywhere - just access as required.

Any ideas?

Replies 3 (3)

Jamie_D_
Shopify Staff (Retired)
533 1 92

Hey Simon,

You should be able to access the details of an open checkout with the following call:

GET https://<my-shop>.myshopify.com/admin/checkouts/<id>.json

This will only work for open checkouts -- once the checkout has been completed and the order has been processed, it will no longer be accessable through the checkouts endpoint.

You can have a look at the documentation for more info.

Cheers,

Jamie
Developer Support

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

Simon62
Shopify Partner
9 1 3

Thankyou - that's not documented anywhere.

I will implement that instead - I was storing it in a redis cache from the checkout created / updated webhook.

testawsintegrat
Shopify Partner
1 0 0

While fetching the abandoned checkout through this way i get a completely different request body returned from when i access it in the browser with an ID and through an api call with a token.

Browser call from within the store (GET https://<my-shop>.myshopify.com/admin/checkouts/<id>.json) with an id returns a json like in the following documentation: 

https://help.shopify.com/en/api/reference/orders/abandoned_checkouts#index

API call with the token (GET https://<my-shop>.myshopify.com/admin/checkouts/<token>.json) from the abandoned checkout webhook returns a json like in the following documentation

https://help.shopify.com/en/api/reference/sales_channels/checkout#show

Is there a possibility i can get the same json like in the browser call from an api call?

Is it possible that i get an abandoned checkout making an api call with the id i get from the webhook?

If not, is it possible to get the abandoned checkout using the since id parameter where i decrement it by minus one from the one id that arrived in the webhook using this endpoint?

https://help.shopify.com/en/api/reference/orders/abandoned_checkouts#index 

Regards,

Filip