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.

Search for order by checkout_id

Search for order by checkout_id

AlexeySergeev
Tourist
9 0 3

Hi!

 

Quite often, external payment providers save a reference to a Shopify order in checkout_id field.

The problem is that if you would like to find such an order, there is no other way than searching for all possible orders and then comparing checkout_id with the reference value. This is quite a slow and ineffective process that eats up a lot of time and uses Shopify execution resources.

 

My question is, can you (the Shopify development team) add the possibility to search for orders by checkout_id value?

Do you have such a thing on your roadmap?

 

P.S. Our (~= your) customers suffer eventually from slow API and that's why I believe it was important to bring this idea to you.

 

Replies 12 (12)

ShopifyDevSup
Shopify Staff
1453 238 522

Hi @AlexeySergeev 👋


Thanks for your feedback, I'll be sure to let our product team know that it would be valuable to have the option to filter orders by `checkout_id`. In order to advocate for this feature, would you mind sharing a few use-cases where this would be a critical function? 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

AlexeySergeev
Tourist
9 0 3

The general use case is the following: our application aggregates our customer's payments with orders/invoices from different platforms and places aggregated information into the accounting system.

 

Example:

- Payment happens in one of the payment providers (Paypal, Stripe, Square, .)

- We search for related order in Shopify, usually, payment platform transaction contains a reference value stored in order.checkout_id. 

 

Basically, that's it. This kind of process works for hundreds of our users, and that's why I brought the topic here in the hope that Shopfy team could provide a better/faster approach for the use case.

 

ShopifyDevSup
Shopify Staff
1453 238 522

Thanks for sharing! 

 

In this case, I'd recommend testing the filters on the `orders` query here to determine if one of those would meet your needs. The below filters may be a good place to start:

 

  • checkout_token
  • credit_card_last4
  • gateway
  • payment_id
  • payment_provider_id


Hope that helps!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

AlexeySergeev
Tourist
9 0 3

Hi!

 

I've tried to figure out if any of the approaches could be used, and it does not look like any of them can help.

For example, the order was paid by a Paypal. The only thing that Paypal provides is a reference that is stored in order.checkout_id

- checkout_token - I don't have it

- credit_card_last4 - I don't have it

- gateway - this only makes the result a little bit narrower if I use the search value 'paypal'. Still, specific order can't be retrieved

- payment-id - I don't have it

- payment_provider_id -  I don't have it

 

So for now I don't see any proper way to find an order by checkout_id.

Do you have any better solution? What do other partners who use Shopify API do in such cases?

 

Best regards

 

 

ShopifyDevSup
Shopify Staff
1453 238 522

Generally, app devs leverage the existing variety of filters to query orders. It may be worthwhile to explore whether other details on the order can be acquired, so that you can employ the existing filters. 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

AlexeySergeev
Tourist
9 0 3

Hi!

 

The last answer doesn't help as I wrote the original(the initial) post because the current Shopify API does not provide a solution for quite the general use case that I described.

dougbright
Shopify Partner
8 0 2

I'd like to add a use case to the mix. Many of our client merchants are affected by the issue at https://community.shopify.com/c/shopify-apis-and-sdks/explanation-of-the-order-number-value-in-the-c... where the checkout confirmation page erroneously displays checkout_id for the {{ order_number }} value in certain situations. We've had to create a backend batch process to take the checkout_id that the page erroneously provided and look up the order information via the API. Because we can't filter orders by checkout_id we're forced to loop through every order to find the checkout_id we need to get the order information.

AlexeySergeev
Tourist
9 0 3

That’s exactly why I opened this thread. It would be quite helpful to be able to search by checkout_id instead of waisting time and resources on such iterations over and over again.

juustanotherdev
Tourist
8 1 2

Hello @AlexeySergeev and @ShopifyDevSup ,

 

I am running in some kind of similar issue and would be thankful for input.

We created our custom application and created a checkout in which the user in the end gets forwarded to the returned 'webUrl' page to complete it.

However after returning to our application there is no possibility to check if the user completed the purchase with the created checkout. Is there any method which allows to check if a created Order (if successful) was resulted via a specific 'Checkout ID'?

 

Kind regards

 

ShopifyDevSup
Shopify Staff
1453 238 522

Hi @juustanotherdev,

 

Have you tried subscribing to the orders/create webhook topic?

The checkout_token field be available on the response from creating the checkout, as well as in that webhook's body.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

AlexeySergeev
Tourist
9 0 3

I don't need a subscription for the webhook. I need to find an order when the application requires it.

ndt_ts
Shopify Partner
27 3 7

I see that the checkout_token and cart_token fields are deprecated and i get null for many of my order/create webhook records!!
is there any way wherein we can relate the order with the payment request id or checkout details??? this is really frustrating!! is there even a solution for this?