Update Checkout not working on /api/2023-01/checkouts

Solved

Update Checkout not working on /api/2023-01/checkouts

ChadChad
Shopify Partner
2 0 1

Hi,

I am currently trying to edit a checkout through the Admin API in my private app, but I keep getting an error. For testing purposes, I wanted to first edit only the first and last name in the shipping address. Later on, I would like to edit the price of products (line items) in the checkout.

 

This is the endpoint: https://<SHOP>.myshopify.com/admin/api/2023-01/checkouts/<TOKEN>.json

And this is the body of my PUT request: 

 

 

{
    "checkout": {
        "email": "max.mustermann@mail.de",
        "token": "<TOKEN>",
        "shipping_address": {
            "first_name": "Max",
            "last_name": "Mustermann"
        }
    }
}

This is the response: 404

 

{
    "errors": "Not Found"
}

I am properly authenticated, otherwise I would have received a different error message.

For testing, I have enabled all the scopes listed here while installing my app in the shop: https://shopify.dev/docs/api/usage/access-scopes

And I followed the documentation here: https://shopify.dev/docs/api/admin-rest/2023-01/resources/checkout#put-checkouts-token

What am I doing wrong? All other PUT requests to other endpoints work without any problems.

Accepted Solution (1)

ShopifyDevSup
Shopify Staff
1453 238 512

This is an accepted solution.

Hi @ChadChad,

 

The first potential reason that comes to mind without seeing any more specifics is that perhaps the checkout token didn't come from a checkout that was created with a POST request from that same private app, but that it came from somewhere else such as being harvested from a checkout URL from a live browser session on the Online Store (whose URL's don't always end with a checkout token).

 

The checkout PUT endpoint is intended to only be used to modify checkouts that were created by that same app.

 

Hope you have a great day

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

View solution in original post

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1453 238 512

This is an accepted solution.

Hi @ChadChad,

 

The first potential reason that comes to mind without seeing any more specifics is that perhaps the checkout token didn't come from a checkout that was created with a POST request from that same private app, but that it came from somewhere else such as being harvested from a checkout URL from a live browser session on the Online Store (whose URL's don't always end with a checkout token).

 

The checkout PUT endpoint is intended to only be used to modify checkouts that were created by that same app.

 

Hope you have a great day

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