# Checkout
The REST Checkout API is deprecated as of version 2024-07. Please see the developer changelog for more information.
If you're building an app with the Sales Channel SDK, then you can use the Checkout API to let customers purchase products from Shopify stores that have installed your sales channel.
Shopify uses the Checkout resource to manage a user's cart as it transitions to a paid order. This process includes specifying which line items are included in the checkout, attaching a customer's shipping and payment details, and calculating tax and shipping rates. Credit card payments can be attached to a Checkout using the Payment resource.
You can't use the Checkout API to create a new checkout user experience for an individual store. For that you need to use an SDK that's powered by the Storefront API instead, such as the JavaScript Buy, iOS Buy, and Android Buy SDKs.
amount
, title
, description
, value
,
and value_type
.
payment_due
in presentment currency.fixed_amount
and percentage
.presentment_currency
.
* Type: x-string
* Example: {"currency"=>"USD"}
* customer_id: The ID of the customer associated with this checkout.
* Type: x-string
* Example: {"customer_id"=>1234}
* discount_code: The discount code that is applied to the checkout. This populates applied_discount
with
the appropriate metadata for that discount code. To remove a discount code, send an empty string or
null
.
* Type: x-string
* Example: {"discount_code"=>"30_DOLLARS_OFF"}
* email: The customer's email address. A checkout needs to have a value for email
or phone
before it can be completed.
* Type: x-string
* Example: {"email"=>"bob.norman@mail.example.com"}
* gift_cards: A list of gift card objects, each containing information about a gift card applied to this checkout.
Gift cards can be applied to a checkout by passing { "checkout": { "gift_cards": [{ "code": "a gift card code" }, { "code": "another gift card code" }] } }
.
Each gift card object has the following properties:
gift_cards
array without that gift card.
* Type: x-string
* Example: [{"amount_used"=>"30.00", "balance"=>"70.00", "id"=>1014759463, "last_characters"=>"abdr"}]
* line_items: A list of line item objects, each containing information about an item in the checkout. Each line item object has the following properties:
applied_discounts
.manual
.price
multiplied by quantity
.null
.
* Type: x-string
* Example: {"id"=>123, "name"=>"#0123", "status_url"=>"https://checkout.shopify.com/123/checkouts/4207896aad57dfb159?key=123abc"}
* payment_due: The amount left to be paid in presentment currency. This is equal to the sum of the checkout line prices, taxes, and shipping minus discounts and gift cards.
* Type: x-string
* Example: {"payment_due"=>"99.95"}
* payment_url: The URL that must be used to store credit cards in Shopify's card vault. These URLs are subject to change, so you should always use the one supplied here. The general pattern for the URLs is https://elb.deposit.shopifycs.com/sessions
.
* Type: x-string
* Example: {"payment_url"=>"https://elb.deposit.shopifycs.com/sessions"}
* phone: The customer's phone number for receiving SMS notifications. A checkout needs to have a value for email
or phone
before it can be completed.
* Type: x-string
* Example: {"phone"=>"+13125551212"}
* presentment_currency: The three-letter code (ISO 4217 format) for the currency that the customer used for payment at checkout. For the shop's default currency, see currency
.
* Type: x-string
* Example: {"presentment_currency"=>"JPY"}
* requires_shipping: Whether the checkout requires shipping. If true
, then shipping_line
must be set before creating a payment.
* Type: x-string
* Example: true
* reservation_time: The reservation time in seconds for the line item products. Default value: null
. This property is not writable.
* Type: x-string
* Example: {"reservation_time"=>nil}
* reservation_time_left: The time in seconds that the line item products will be held. Default value: 0
. This property is not writable.
* Type: x-string
* Example: {"reservation_time_left"=>0}
* shipping_address: The mailing address to where the checkout will be shipped. It has the following properties:
handle
.
A shipping line is required when requires_shipping
is true
. Learn more about
selecting shipping rates.
* Type: x-string
* Example: {"handle"=>"shopify-Standard-10.00", "price"=>"10.00", "title"=>"Standard"}
* shipping_rate: The selected shipping rate. This property is not writable.
* Type: x-string
* Example: {"id"=>"shopify-Standard-10.00", "price"=>"10.00", "title"=>"Standard"}
* source_name: The source of the checkout. To use this field for sales attribution, you must register the channels that your app is managing. You can register the channels that your app is managing by completing this Google Form. After you've submited your request, you need to wait for your request to be processed by Shopify. You can find a list of your channels in the Partner Dashboard, in your app's Marketplace extension. You can specify a handle as the source_name
value in your request.
* Type: string
* Example: {"source_name"=>"instagram"}
* source_identifier: The ID of the order placed on the originating platform.
This value doesn't correspond to the Shopify ID that's generated from a completed draft.
* Type: string
* Example: {"source_identifier"=>"ORDERID-123"}
* source_url: A valid URL to the original order on the originating surface.
This URL is displayed to merchants on the Order Details page.
If the URL is invalid, then it won't be displayed.
* Type: string
* Example: {"source_url"=>"{URL_to_order}"}
* subtotal_price: The price of the checkout in presentment currency before shipping, taxes, and tips.
* Type: x-string
* Example: {"subtotal_price"=>"398.00"}
* tax_lines: An array of tax_line
objects, each of which represents a tax rate applicable to the checkout. Each tax line object has the following properties:
null
.
* Type: x-string
* Example: {"user_id"=>1234}
* web_url: The URL pointing to the checkout accessible from the web.
* Type: x-string
* Example: {"web_url"=>"https://checkout.shopify.com/112233/checkouts/4207896aad57dfb159?key=123abc"}
## Creates a checkout
Creates a checkout
### Endpoint
/admin/api/#{api_version}/checkouts.json (POST)
### Parameters
* api_version (required):
### Responses
#### 202
Creates a checkout
Examples:
##### Create a checkout with a product variant and quantity
Request:
```
POST /admin/api/unstable/checkouts.json
{"checkout":{"line_items":[{"variant_id":39072856,"quantity":5}]}}
```
Response:
```
HTTP/1.1 202 Accepted
{"checkout":{"completed_at":null,"created_at":"2024-09-19T10:12:06-04:00","currency":"USD","presentment_currency":"USD","customer_id":null,"customer_locale":"en","device_id":null,"discount_code":null,"discount_codes":[],"email":null,"legal_notice_url":null,"location_id":null,"name":"#1068673450","note":"","note_attributes":{},"order_id":null,"order_status_url":null,"order":null,"payment_due":"995.00","payment_url":"https://app.local/cardserver/sessions","payments":[],"phone":null,"shopify_payments_account_id":null,"privacy_policy_url":null,"refund_policy_url":null,"requires_shipping":true,"reservation_time_left":0,"reservation_time":null,"source_identifier":null,"source_name":"755357713","source_url":null,"subscription_policy_url":null,"subtotal_price":"995.00","shipping_policy_url":null,"tax_exempt":false,"taxes_included":false,"terms_of_sale_url":null,"terms_of_service_url":null,"token":"cf870cb932379a1e95ae241d63c31bf2","total_price":"995.00","total_tax":"0.00","total_tip_received":"0.00","total_line_items_price":"995.00","updated_at":"2024-09-19T10:12:06-04:00","user_id":null,"web_url":"https://jsmith.myshopify.com/548380009/checkouts/cf870cb932379a1e95ae241d63c31bf2","line_items":[{"id":"f9564b7795ab4e7adda16c0635dcd6ac","key":"f9564b7795ab4e7adda16c0635dcd6ac","product_id":632910392,"variant_id":39072856,"sku":"IPOD2008GREEN","vendor":"Apple","title":"IPod Nano - 8GB","variant_title":"Green","image_url":"https://cdn.shopify.com/s/files/1/0005/4838/0009/products/ipod-nano.png?v=1726755057","taxable":true,"requires_shipping":true,"gift_card":false,"price":"199.00","compare_at_price":null,"line_price":"995.00","properties":{},"quantity":5,"grams":567,"fulfillment_service":"manual","applied_discounts":[],"discount_allocations":[],"tax_lines":[]}],"gift_cards":[],"tax_lines":[],"tax_manipulations":[],"shipping_line":null,"shipping_rate":null,"shipping_address":null,"credit_card":null,"billing_address":null,"applied_discount":null,"applied_discounts":[],"discount_violations":[]}}
```
##### Create a checkout without any line items
Request:
```
POST /admin/api/unstable/checkouts.json
{"checkout":{"email":"me@example.com"}}
```
Response:
```
HTTP/1.1 202 Accepted
{"checkout":{"completed_at":null,"created_at":"2024-09-19T10:11:55-04:00","currency":"USD","presentment_currency":"USD","customer_id":1073339456,"customer_locale":"en","device_id":null,"discount_code":null,"discount_codes":[],"email":"me@example.com","legal_notice_url":null,"location_id":null,"name":"#1068673449","note":"","note_attributes":{},"order_id":null,"order_status_url":null,"order":null,"payment_due":"0.00","payment_url":"https://app.local/cardserver/sessions","payments":[],"phone":null,"shopify_payments_account_id":null,"privacy_policy_url":null,"refund_policy_url":null,"requires_shipping":false,"reservation_time_left":0,"reservation_time":null,"source_identifier":null,"source_name":"755357713","source_url":null,"subscription_policy_url":null,"subtotal_price":"0.00","shipping_policy_url":null,"tax_exempt":false,"taxes_included":false,"terms_of_sale_url":null,"terms_of_service_url":null,"token":"7fd53cf7cb9450ef58f81af3388c9376","total_price":"0.00","total_tax":"0.00","total_tip_received":"0.00","total_line_items_price":"0.00","updated_at":"2024-09-19T10:11:55-04:00","user_id":null,"web_url":"https://jsmith.myshopify.com/548380009/checkouts/7fd53cf7cb9450ef58f81af3388c9376","line_items":[],"gift_cards":[],"tax_lines":[],"tax_manipulations":[],"shipping_line":null,"shipping_rate":null,"shipping_address":null,"credit_card":null,"billing_address":null,"applied_discount":null,"applied_discounts":[],"discount_violations":[]}}
```
#### 422
Creates a checkout
Examples:
##### Creating a checkout with errors, such as using the ID of a variant that doesn't exist or that isn't published to your sales channel, fails with a 422 response and returns errors
Request:
```
POST /admin/api/unstable/checkouts.json
{"checkout":{"line_items":[{"variant_id":123456789,"quantity":1}]}}
```
Response:
```
HTTP/1.1 422 Unprocessable Entity
{"errors":{"line_items":{"0":{"variant_id":[{"code":"product_not_available","message":"product is not published for this customer.","options":{}}]}}}}
```
##### Creating a checkout with line item errors fails and returns the errors mapped by index
Request:
```
POST /admin/api/unstable/checkouts.json
{"checkout":{"line_items":[{"variant_id":39072856,"quantity":1},{"variant_id":1,"quantity":1},{"variant_id":1,"quantity":1},{"variant_id":49148385,"quantity":1},{"variant_id":1,"quantity":1}]}}
```
Response:
```
HTTP/1.1 422 Unprocessable Entity
{"errors":{"line_items":{"1":{"variant_id":[{"code":"product_not_available","message":"product is not published for this customer.","options":{}}]},"2":{"variant_id":[{"code":"product_not_available","message":"product is not published for this customer.","options":{}}]},"4":{"variant_id":[{"code":"product_not_available","message":"product is not published for this customer.","options":{}}]}}}}
```
## Completes a checkout
Completes a checkout
### Endpoint
/admin/api/#{api_version}/checkouts/{token}/complete.json (POST)
### Parameters
* api_version (required):
* token (required):
### Responses
#### 202
Completes a checkout
Examples:
##### Complete a checkout without requiring payment
Request:
```
POST /admin/api/unstable/checkouts/b490a9220cd14d7344024f4874f640a6/complete.json
{}
```
Response:
```
HTTP/1.1 202 Accepted
{"checkout":{"completed_at":null,"created_at":"2012-10-12T07:05:27-04:00","currency":"USD","presentment_currency":"USD","customer_id":207119551,"customer_locale":"en","device_id":null,"discount_code":null,"discount_codes":[],"email":"bob.norman@mail.example.com","legal_notice_url":null,"location_id":null,"name":"#86568385","note":"","note_attributes":{"custom engraving":"Happy Birthday","colour":"green"},"order_id":null,"order_status_url":null,"order":null,"payment_due":"0.00","payment_url":"https://app.local/cardserver/sessions","payments":[],"phone":null,"shopify_payments_account_id":null,"privacy_policy_url":null,"refund_policy_url":null,"requires_shipping":false,"reservation_time_left":0,"reservation_time":null,"source_identifier":null,"source_name":"web","source_url":null,"subscription_policy_url":null,"subtotal_price":"0.00","shipping_policy_url":null,"tax_exempt":false,"taxes_included":false,"terms_of_sale_url":null,"terms_of_service_url":null,"token":"b490a9220cd14d7344024f4874f640a6","total_price":"0.00","total_tax":"0.00","total_tip_received":"0.00","total_line_items_price":"0.00","updated_at":"2024-09-19T10:11:58-04:00","user_id":null,"web_url":"https://checkout.local/548380009/checkouts/b490a9220cd14d7344024f4874f640a6","line_items":[{"id":49148385,"key":49148385,"product_id":632910392,"variant_id":49148385,"sku":"IPOD2008RED","vendor":"Apple","title":"IPod Nano - 8GB","variant_title":"Red","image_url":"https://cdn.shopify.com/s/files/1/0005/4838/0009/products/ipod-nano.png?v=1726755057","taxable":true,"requires_shipping":false,"gift_card":false,"price":"0.00","compare_at_price":null,"line_price":"0.00","properties":{},"quantity":1,"grams":200,"fulfillment_service":"manual","applied_discounts":[],"discount_allocations":[],"tax_lines":[]}],"gift_cards":[],"tax_lines":[],"tax_manipulations":[],"shipping_line":null,"shipping_rate":null,"shipping_address":{"id":550558813,"first_name":"Bob","last_name":"Norman","phone":"+1(502)-459-2181","company":null,"address1":"Chestnut Street 92","address2":"","city":"Louisville","province":"Kentucky","province_code":"KY","country":"United States","country_code":"US","zip":"40202"},"credit_card":null,"billing_address":{"id":550558813,"first_name":"Bob","last_name":"Norman","phone":"+1(502)-459-2181","company":null,"address1":"Chestnut Street 92","address2":"","city":"Louisville","province":"Kentucky","province_code":"KY","country":"United States","country_code":"US","zip":"40202"},"applied_discount":null,"applied_discounts":[],"discount_violations":[]}}
```
## Retrieves a checkout
Retrieves a checkout
### Endpoint
/admin/api/#{api_version}/checkouts/{token}.json (GET)
### Parameters
* api_version (required):
* token (required):
### Responses
#### 200
Retrieves a checkout
Examples:
##### Retrieve a completed checkout
Request:
```
GET /admin/api/unstable/checkouts/bd5a8aa1ecd019dd3520ff791ee3a24c.json
```
Response:
```
HTTP/1.1 200 OK
{"checkout":{"completed_at":"2005-07-31T11:57:11-04:00","created_at":"2012-10-12T07:05:27-04:00","currency":"USD","presentment_currency":"USD","customer_id":207119551,"customer_locale":"en","device_id":null,"discount_code":null,"discount_codes":[],"email":"bob.norman@mail.example.com","legal_notice_url":null,"location_id":null,"name":"#901414060","note":"","note_attributes":{"custom engraving":"Happy Birthday","colour":"green"},"order_id":450789469,"order_status_url":"https://checkout.local/548380009/checkouts/bd5a8aa1ecd019dd3520ff791ee3a24c/thank_you","order":{"id":450789469,"name":"#1001","status_url":"https://checkout.local/548380009/checkouts/bd5a8aa1ecd019dd3520ff791ee3a24c/thank_you"},"payment_due":"421.88","payment_url":"https://app.local/cardserver/sessions","payments":[],"phone":null,"shopify_payments_account_id":null,"privacy_policy_url":null,"refund_policy_url":null,"requires_shipping":true,"reservation_time_left":0,"reservation_time":null,"source_identifier":null,"source_name":"web","source_url":null,"subscription_policy_url":null,"subtotal_price":"398.00","shipping_policy_url":null,"tax_exempt":false,"taxes_included":false,"terms_of_sale_url":null,"terms_of_service_url":null,"token":"bd5a8aa1ecd019dd3520ff791ee3a24c","total_price":"421.88","total_tax":"23.88","total_tip_received":"0.00","total_line_items_price":"398.00","updated_at":"2012-10-12T07:05:27-04:00","user_id":null,"web_url":"https://checkout.local/548380009/checkouts/bd5a8aa1ecd019dd3520ff791ee3a24c","line_items":[{"id":"60715a3461f5f853","key":"60715a3461f5f853","product_id":632910392,"variant_id":49148385,"sku":"IPOD2008RED","vendor":"Apple","title":"IPod Nano - 8GB","variant_title":"Red","image_url":"https://cdn.shopify.com/s/files/1/0005/4838/0009/products/ipod-nano.png?v=1726755057","taxable":true,"requires_shipping":true,"gift_card":false,"price":"199.00","compare_at_price":null,"line_price":"199.00","properties":{},"quantity":1,"grams":200,"fulfillment_service":"manual","applied_discounts":[],"discount_allocations":[],"tax_lines":[{"price":"11.94","rate":0.06,"title":"Tax","channel_liable":false}]},{"id":"0703986f986628ba","key":"0703986f986628ba","product_id":632910392,"variant_id":808950810,"sku":"IPOD2008PINK","vendor":"Apple","title":"IPod Nano - 8GB","variant_title":"Pink","image_url":"https://cdn.shopify.com/s/files/1/0005/4838/0009/products/ipod-nano-2.png?v=1726755057","taxable":true,"requires_shipping":true,"gift_card":false,"price":"199.00","compare_at_price":null,"line_price":"199.00","properties":{},"quantity":1,"grams":200,"fulfillment_service":"manual","applied_discounts":[],"discount_allocations":[],"tax_lines":[{"price":"11.94","rate":0.06,"title":"Tax","channel_liable":false}]}],"gift_cards":[],"tax_lines":[{"price":"23.88","rate":0.06,"title":"Tax","compare_at":0.06}],"tax_manipulations":[],"shipping_line":{"handle":"shopify-Free%20Shipping-0.00","price":"0.00","title":"Free Shipping","tax_lines":[]},"shipping_rate":{"id":"shopify-Free%20Shipping-0.00","price":"0.00","title":"Free Shipping"},"shipping_address":{"id":550558813,"first_name":"Bob","last_name":"Norman","phone":"+1(502)-459-2181","company":null,"address1":"Chestnut Street 92","address2":"","city":"Louisville","province":"Kentucky","province_code":"KY","country":"United States","country_code":"US","zip":"40202"},"credit_card":null,"billing_address":{"id":550558813,"first_name":"Bob","last_name":"Norman","phone":"+1(502)-459-2181","company":null,"address1":"Chestnut Street 92","address2":"","city":"Louisville","province":"Kentucky","province_code":"KY","country":"United States","country_code":"US","zip":"40202"},"applied_discount":null,"applied_discounts":[],"discount_violations":[]}}
```
#### 202
Retrieves a checkout
Examples:
##### Retrieve a processing checkout
Request:
```
GET /admin/api/unstable/checkouts/7yjf4v2we7gamku6a6h7tvm8h3mmvs4x.json
```
Response:
```
HTTP/1.1 202 Accepted
{"checkout":{"completed_at":null,"created_at":"2012-10-12T07:05:27-04:00","currency":"USD","presentment_currency":"USD","customer_id":207119551,"customer_locale":"en","device_id":null,"discount_code":null,"discount_codes":[],"email":"bob.norman@mail.example.com","legal_notice_url":null,"location_id":null,"name":"#446514532","note":"","note_attributes":{"custom engraving":"Happy Birthday","colour":"green"},"order_id":null,"order_status_url":null,"order":null,"payment_due":"419.49","payment_url":"https://app.local/cardserver/sessions","payments":[{"id":25428999,"unique_token":"e01e661f4a99acd9dcdg6f1422d0d6f7","payment_processing_error_message":null,"fraudulent":false,"transaction":{"amount":"598.94","amount_in":null,"amount_out":null,"amount_rounding":null,"authorization":"authorization-key","created_at":"2005-08-01T11:57:11-04:00","currency":"USD","error_code":null,"parent_id":null,"gateway":"bogus","id":389404469,"kind":"authorization","message":null,"status":"success","test":false,"receipt":{"testcase":true,"authorization":"123456"},"location_id":null,"user_id":null,"transaction_group_id":null,"device_id":null,"payment_details":{"credit_card_bin":null,"avs_result_code":null,"cvv_result_code":null,"credit_card_number":"•••• •••• •••• 4242","credit_card_company":"Visa","buyer_action_info":null,"credit_card_name":null,"credit_card_wallet":null,"credit_card_expiration_month":null,"credit_card_expiration_year":null,"payment_method_name":"visa"}},"credit_card":null}],"phone":null,"shopify_payments_account_id":null,"privacy_policy_url":null,"refund_policy_url":null,"requires_shipping":true,"reservation_time_left":0,"reservation_time":null,"source_identifier":null,"source_name":"web","source_url":null,"subscription_policy_url":null,"subtotal_price":"398.00","shipping_policy_url":null,"tax_exempt":false,"taxes_included":false,"terms_of_sale_url":null,"terms_of_service_url":null,"token":"7yjf4v2we7gamku6a6h7tvm8h3mmvs4x","total_price":"419.49","total_tax":"21.49","total_tip_received":"0.00","total_line_items_price":"398.00","updated_at":"2012-10-12T07:05:27-04:00","user_id":null,"web_url":"https://checkout.local/548380009/checkouts/7yjf4v2we7gamku6a6h7tvm8h3mmvs4x","line_items":[{"id":"60715a3461f5f853","key":"60715a3461f5f853","product_id":632910392,"variant_id":49148385,"sku":"IPOD2008RED","vendor":"Apple","title":"IPod Nano - 8GB","variant_title":"Red","image_url":"https://cdn.shopify.com/s/files/1/0005/4838/0009/products/ipod-nano.png?v=1726755057","taxable":true,"requires_shipping":true,"gift_card":false,"price":"199.00","compare_at_price":null,"line_price":"199.00","properties":{},"quantity":1,"grams":200,"fulfillment_service":"manual","applied_discounts":[],"discount_allocations":[],"tax_lines":[]},{"id":"0703986f986628ba","key":"0703986f986628ba","product_id":632910392,"variant_id":808950810,"sku":"IPOD2008PINK","vendor":"Apple","title":"IPod Nano - 8GB","variant_title":"Pink","image_url":"https://cdn.shopify.com/s/files/1/0005/4838/0009/products/ipod-nano-2.png?v=1726755057","taxable":true,"requires_shipping":true,"gift_card":false,"price":"199.00","compare_at_price":null,"line_price":"199.00","properties":{},"quantity":1,"grams":200,"fulfillment_service":"manual","applied_discounts":[],"discount_allocations":[],"tax_lines":[]}],"gift_cards":[],"tax_lines":[{"price":"21.49","rate":0.06,"title":"State Tax","compare_at":0.06}],"tax_manipulations":[],"shipping_line":{"handle":"shopify-Free%20Shipping-0.00","price":"0.00","title":"Free Shipping","tax_lines":[]},"shipping_rate":{"id":"shopify-Free%20Shipping-0.00","price":"0.00","title":"Free Shipping"},"shipping_address":{"id":550558813,"first_name":"Bob","last_name":"Norman","phone":"+1(502)-459-2181","company":null,"address1":"Chestnut Street 92","address2":"","city":"Louisville","province":"Kentucky","province_code":"KY","country":"United States","country_code":"US","zip":"40202"},"credit_card":{"first_name":"Bob","last_name":"Norman","first_digits":"1","last_digits":"1","brand":"bogus","expiry_month":8,"expiry_year":2042,"customer_id":null},"billing_address":{"id":550558813,"first_name":"Bob","last_name":"Norman","phone":"+1(502)-459-2181","company":null,"address1":"Chestnut Street 92","address2":"","city":"Louisville","province":"Kentucky","province_code":"KY","country":"United States","country_code":"US","zip":"40202"},"applied_discount":null,"applied_discounts":[],"discount_violations":[]}}
```
##### Retrieve an existing checkout
Request:
```
GET /admin/api/unstable/checkouts/exuw7apwoycchjuwtiqg8nytfhphr62a.json
```
Response:
```
HTTP/1.1 202 Accepted
{"checkout":{"completed_at":null,"created_at":"2012-10-12T07:05:27-04:00","currency":"USD","presentment_currency":"USD","customer_id":207119551,"customer_locale":"en","device_id":null,"discount_code":null,"discount_codes":[],"email":"bob.norman@mail.example.com","legal_notice_url":null,"location_id":null,"name":"#862052962","note":"","note_attributes":{"custom engraving":"Happy Birthday","colour":"green"},"order_id":null,"order_status_url":null,"order":null,"payment_due":"419.49","payment_url":"https://app.local/cardserver/sessions","payments":[],"phone":null,"shopify_payments_account_id":null,"privacy_policy_url":null,"refund_policy_url":null,"requires_shipping":true,"reservation_time_left":0,"reservation_time":null,"source_identifier":null,"source_name":"web","source_url":null,"subscription_policy_url":null,"subtotal_price":"398.00","shipping_policy_url":null,"tax_exempt":false,"taxes_included":false,"terms_of_sale_url":null,"terms_of_service_url":null,"token":"exuw7apwoycchjuwtiqg8nytfhphr62a","total_price":"419.49","total_tax":"21.49","total_tip_received":"0.00","total_line_items_price":"398.00","updated_at":"2012-10-12T07:05:27-04:00","user_id":null,"web_url":"https://checkout.local/548380009/checkouts/exuw7apwoycchjuwtiqg8nytfhphr62a","line_items":[{"id":"60715a3461f5f853","key":"60715a3461f5f853","product_id":632910392,"variant_id":49148385,"sku":"IPOD2008RED","vendor":"Apple","title":"IPod Nano - 8GB","variant_title":"Red","image_url":"https://cdn.shopify.com/s/files/1/0005/4838/0009/products/ipod-nano.png?v=1726755057","taxable":true,"requires_shipping":true,"gift_card":false,"price":"199.00","compare_at_price":null,"line_price":"199.00","properties":{},"quantity":1,"grams":200,"fulfillment_service":"manual","applied_discounts":[],"discount_allocations":[],"tax_lines":[]},{"id":"0703986f986628ba","key":"0703986f986628ba","product_id":632910392,"variant_id":808950810,"sku":"IPOD2008PINK","vendor":"Apple","title":"IPod Nano - 8GB","variant_title":"Pink","image_url":"https://cdn.shopify.com/s/files/1/0005/4838/0009/products/ipod-nano-2.png?v=1726755057","taxable":true,"requires_shipping":true,"gift_card":false,"price":"199.00","compare_at_price":null,"line_price":"199.00","properties":{},"quantity":1,"grams":200,"fulfillment_service":"manual","applied_discounts":[],"discount_allocations":[],"tax_lines":[]}],"gift_cards":[],"tax_lines":[{"price":"21.49","rate":0.06,"title":"State Tax","compare_at":0.06}],"tax_manipulations":[],"shipping_line":{"handle":"shopify-Free%20Shipping-0.00","price":"0.00","title":"Free Shipping","tax_lines":[]},"shipping_rate":{"id":"shopify-Free%20Shipping-0.00","price":"0.00","title":"Free Shipping"},"shipping_address":{"id":550558813,"first_name":"Bob","last_name":"Norman","phone":"+1(502)-459-2181","company":null,"address1":"Chestnut Street 92","address2":"","city":"Louisville","province":"Kentucky","province_code":"KY","country":"United States","country_code":"US","zip":"40202"},"credit_card":null,"billing_address":{"id":550558813,"first_name":"Bob","last_name":"Norman","phone":"+1(502)-459-2181","company":null,"address1":"Chestnut Street 92","address2":"","city":"Louisville","province":"Kentucky","province_code":"KY","country":"United States","country_code":"US","zip":"40202"},"applied_discount":null,"applied_discounts":[],"discount_violations":[]}}
```
## Modifies an existing checkout
Modifies an existing checkout
### Endpoint
/admin/api/#{api_version}/checkouts/{token}.json (PUT)
### Parameters
* api_version (required):
* token (required):
### Responses
#### 202
Modifies an existing checkout
Examples:
##### Select a shipping rate
Request:
```
PUT /admin/api/unstable/checkouts/exuw7apwoycchjuwtiqg8nytfhphr62a.json
{"checkout":{"token":"exuw7apwoycchjuwtiqg8nytfhphr62a","shipping_line":{"handle":"shopify-Free%20Shipping-0.00"}}}
```
Response:
```
HTTP/1.1 202 Accepted
{"checkout":{"completed_at":null,"created_at":"2012-10-12T07:05:27-04:00","currency":"USD","presentment_currency":"USD","customer_id":207119551,"customer_locale":"en","device_id":null,"discount_code":null,"discount_codes":[],"email":"bob.norman@mail.example.com","legal_notice_url":null,"location_id":null,"name":"#862052962","note":"","note_attributes":{"custom engraving":"Happy Birthday","colour":"green"},"order_id":null,"order_status_url":null,"order":null,"payment_due":"421.88","payment_url":"https://app.local/cardserver/sessions","payments":[],"phone":null,"shopify_payments_account_id":null,"privacy_policy_url":null,"refund_policy_url":null,"requires_shipping":true,"reservation_time_left":0,"reservation_time":null,"source_identifier":null,"source_name":"web","source_url":null,"subscription_policy_url":null,"subtotal_price":"398.00","shipping_policy_url":null,"tax_exempt":false,"taxes_included":false,"terms_of_sale_url":null,"terms_of_service_url":null,"token":"exuw7apwoycchjuwtiqg8nytfhphr62a","total_price":"421.88","total_tax":"23.88","total_tip_received":"0.00","total_line_items_price":"398.00","updated_at":"2024-09-19T10:12:04-04:00","user_id":null,"web_url":"https://checkout.local/548380009/checkouts/exuw7apwoycchjuwtiqg8nytfhphr62a","line_items":[{"id":"60715a3461f5f853","key":"60715a3461f5f853","product_id":632910392,"variant_id":49148385,"sku":"IPOD2008RED","vendor":"Apple","title":"IPod Nano - 8GB","variant_title":"Red","image_url":"https://cdn.shopify.com/s/files/1/0005/4838/0009/products/ipod-nano.png?v=1726755057","taxable":true,"requires_shipping":true,"gift_card":false,"price":"199.00","compare_at_price":null,"line_price":"199.00","properties":{},"quantity":1,"grams":200,"fulfillment_service":"manual","applied_discounts":[],"discount_allocations":[],"tax_lines":[{"price":"11.94","rate":0.06,"title":"Tax","channel_liable":false}]},{"id":"0703986f986628ba","key":"0703986f986628ba","product_id":632910392,"variant_id":808950810,"sku":"IPOD2008PINK","vendor":"Apple","title":"IPod Nano - 8GB","variant_title":"Pink","image_url":"https://cdn.shopify.com/s/files/1/0005/4838/0009/products/ipod-nano-2.png?v=1726755057","taxable":true,"requires_shipping":true,"gift_card":false,"price":"199.00","compare_at_price":null,"line_price":"199.00","properties":{},"quantity":1,"grams":200,"fulfillment_service":"manual","applied_discounts":[],"discount_allocations":[],"tax_lines":[{"price":"11.94","rate":0.06,"title":"Tax","channel_liable":false}]}],"gift_cards":[],"tax_lines":[{"price":"23.88","rate":0.06,"title":"Tax","compare_at":0.06}],"tax_manipulations":[],"shipping_line":{"handle":"shopify-Free%20Shipping-0.00","price":"0.00","title":"Free Shipping","tax_lines":[]},"shipping_rate":{"id":"shopify-Free%20Shipping-0.00","price":"0.00","title":"Free Shipping"},"shipping_address":{"id":550558813,"first_name":"Bob","last_name":"Norman","phone":"+1(502)-459-2181","company":null,"address1":"Chestnut Street 92","address2":"","city":"Louisville","province":"Kentucky","province_code":"KY","country":"United States","country_code":"US","zip":"40202"},"credit_card":null,"billing_address":{"id":550558813,"first_name":"Bob","last_name":"Norman","phone":"+1(502)-459-2181","company":null,"address1":"Chestnut Street 92","address2":"","city":"Louisville","province":"Kentucky","province_code":"KY","country":"United States","country_code":"US","zip":"40202"},"applied_discount":null,"applied_discounts":[],"discount_violations":[]}}
```
##### Update the shipping address and email of a checkout
Request:
```
PUT /admin/api/unstable/checkouts/exuw7apwoycchjuwtiqg8nytfhphr62a.json
{"checkout":{"token":"exuw7apwoycchjuwtiqg8nytfhphr62a","email":"john.smith@example.com","shipping_address":{"first_name":"John","last_name":"Smith","address1":"126 York St.","city":"Los Angeles","province_code":"CA","country_code":"US","phone":"(123)456-7890","zip":"90002"}}}
```
Response:
```
HTTP/1.1 202 Accepted
{"checkout":{"completed_at":null,"created_at":"2012-10-12T07:05:27-04:00","currency":"USD","presentment_currency":"USD","customer_id":1073339457,"customer_locale":"en","device_id":null,"discount_code":null,"discount_codes":[],"email":"john.smith@example.com","legal_notice_url":null,"location_id":null,"name":"#862052962","note":"","note_attributes":{"custom engraving":"Happy Birthday","colour":"green"},"order_id":null,"order_status_url":null,"order":null,"payment_due":"417.90","payment_url":"https://app.local/cardserver/sessions","payments":[],"phone":null,"shopify_payments_account_id":null,"privacy_policy_url":null,"refund_policy_url":null,"requires_shipping":true,"reservation_time_left":0,"reservation_time":null,"source_identifier":null,"source_name":"web","source_url":null,"subscription_policy_url":null,"subtotal_price":"398.00","shipping_policy_url":null,"tax_exempt":false,"taxes_included":false,"terms_of_sale_url":null,"terms_of_service_url":null,"token":"exuw7apwoycchjuwtiqg8nytfhphr62a","total_price":"417.90","total_tax":"19.90","total_tip_received":"0.00","total_line_items_price":"398.00","updated_at":"2024-09-19T10:11:59-04:00","user_id":null,"web_url":"https://checkout.local/548380009/checkouts/exuw7apwoycchjuwtiqg8nytfhphr62a?key=e34c7e49696165ae5d3f7460f14b9683","line_items":[{"id":"60715a3461f5f853","key":"60715a3461f5f853","product_id":632910392,"variant_id":49148385,"sku":"IPOD2008RED","vendor":"Apple","title":"IPod Nano - 8GB","variant_title":"Red","image_url":"https://cdn.shopify.com/s/files/1/0005/4838/0009/products/ipod-nano.png?v=1726755057","taxable":true,"requires_shipping":true,"gift_card":false,"price":"199.00","compare_at_price":null,"line_price":"199.00","properties":{},"quantity":1,"grams":200,"fulfillment_service":"manual","applied_discounts":[],"discount_allocations":[],"tax_lines":[{"price":"9.95","rate":0.05,"title":"Tax","channel_liable":false}]},{"id":"0703986f986628ba","key":"0703986f986628ba","product_id":632910392,"variant_id":808950810,"sku":"IPOD2008PINK","vendor":"Apple","title":"IPod Nano - 8GB","variant_title":"Pink","image_url":"https://cdn.shopify.com/s/files/1/0005/4838/0009/products/ipod-nano-2.png?v=1726755057","taxable":true,"requires_shipping":true,"gift_card":false,"price":"199.00","compare_at_price":null,"line_price":"199.00","properties":{},"quantity":1,"grams":200,"fulfillment_service":"manual","applied_discounts":[],"discount_allocations":[],"tax_lines":[{"price":"9.95","rate":0.05,"title":"Tax","channel_liable":false}]}],"gift_cards":[],"tax_lines":[{"price":"19.90","rate":0.05,"title":"Tax","compare_at":0.05}],"tax_manipulations":[],"shipping_line":null,"shipping_rate":null,"shipping_address":{"id":550558813,"first_name":"John","last_name":"Smith","phone":"(123)456-7890","company":null,"address1":"126 York St.","address2":"","city":"Los Angeles","province":"California","province_code":"CA","country":"United States","country_code":"US","zip":"90002"},"credit_card":null,"billing_address":{"id":550558813,"first_name":"Bob","last_name":"Norman","phone":"+1(502)-459-2181","company":null,"address1":"Chestnut Street 92","address2":"","city":"Louisville","province":"Kentucky","province_code":"KY","country":"United States","country_code":"US","zip":"40202"},"applied_discount":null,"applied_discounts":[],"discount_violations":[]}}
```
#### 422
Modifies an existing checkout
Examples:
##### Updating a shipping address with an invalid zip code fails and returns errors
Request:
```
PUT /admin/api/unstable/checkouts/exuw7apwoycchjuwtiqg8nytfhphr62a.json
{"checkout":{"token":"exuw7apwoycchjuwtiqg8nytfhphr62a","shipping_address":{"first_name":"John","last_name":"Smith","address1":"126 York St.","city":"Beverly Hills","province_code":"CA","country_code":"US","phone":"(123)456-7890","zip":"1234"}}}
```
Response:
```
HTTP/1.1 422 Unprocessable Entity
{"errors":{"shipping_address":{"zip":[{"code":"invalid_for_country","message":"Enter a valid ZIP code for the United States","options":{"country":"United States"}}]}}}
```
## Retrieves a list of shipping rates
Retrieves a list of available shipping rates for the specified checkout. Implementers need to poll this endpoint until rates become available.
Each shipping rate contains the checkout's new subtotal price, total tax, and total price in the event that this shipping rate is selected. This can be used to update the UI without performing further API requests.
To apply a shipping rate, update the checkout's shipping line with the handle of the selected rate.
### Endpoint
/admin/api/#{api_version}/checkouts/{token}/shipping_rates.json (GET)
### Parameters
* api_version (required):
* token (required):
### Responses
#### 200
Retrieves a list of shipping rates
Examples:
##### Retrieve available shipping rates
Request:
```
GET /admin/api/unstable/checkouts/exuw7apwoycchjuwtiqg8nytfhphr62a/shipping_rates.json
```
Response:
```
HTTP/1.1 200 OK
{"shipping_rates":[{"id":"shopify-Free%20Shipping-0.00","price":"0.00","title":"Free Shipping","checkout":{"total_tax":"23.88","total_price":"421.88","subtotal_price":"398.00"},"phone_required":false,"delivery_range":null,"estimated_time_in_transit":null,"handle":"shopify-Free%20Shipping-0.00"}]}
```
##### Retrieving shipping rates when none are available for the current shipping address or cart returns an empty array
Request:
```
GET /admin/api/unstable/checkouts/zs9ru89kuqcdagk8bz4r9hnxt22wwd42/shipping_rates.json
```
Response:
```
HTTP/1.1 200 OK
{"shipping_rates":[]}
```
#### 202
Retrieves a list of shipping rates
Examples:
##### Retrieving shipping rates before they're available returns an empty array
Request:
```
GET /admin/api/unstable/checkouts/exuw7apwoycchjuwtiqg8nytfhphr62a/shipping_rates.json
```
Response:
```
HTTP/1.1 202 Accepted
{"shipping_rates":[]}
```