Apply discountCode by Storefront API with GraphQL got error checkout dose not exist

Apply discountCode by Storefront API with GraphQL got error checkout dose not exist

truongnd
Visitor
3 0 3

Hi All, 

I'm making private app to apply auto discount code into checkout. But i was got issue and stuck on it.

First,i created webhook listener checkout update to receive checkout info.

After that i get id from checkout info and then use graphQL to call checkoutDiscountCodeApplyV2 but alway got error "Checkout does not exist"

Can Anyone help me resolve this issue. Thanks a lot!

 

Screen Shot 2021-05-09 at 14.07.25.png

Replies 3 (3)

awwdam
Shopify Staff
249 42 38

Hey @truongnd, from my understanding you can only use a mutation like this on checkouts created by your private app, with the Storefront API - more info here.

awwdam | API Support @ Shopify
- Was my reply helpful? Click Like to let me 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

mattxt
Visitor
1 0 0

@awwdam Do you know what the message "Checkout does not exist" or code "INVALID" means? I am getting the same error when using the JS Buy SDK and I can't figure out what is causing the issue.

Cenco
Shopify Partner
9 0 1

Hi!

 

The checkoutID above seems to be base64 encoded. For the request you may try to decode it first and add it to your query then.

 

Best regards!

---