Update Checkout
Sets the tax and additional costs, such as handling or freight charges, on a checkout before the order is placed. Use it when your system calculates these amounts. See Get Checkout for what a checkout is.
HTTP Request
- URL:
/checkout/{id} - Method:
PUT - Headers:
accessToken: Required. Your API access token.Content-Type:application/json
- Required scope:
READ_WRITE_ORDER
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the checkout. |
Request Body
The request body is a JSON object with the tax and costs to set.
| Field | Type | Required | Description |
|---|---|---|---|
tax | Number | No | Tax amount, or tax rate as a decimal (for example 0.0825 for 8.25%). |
taxType | String | No | amount or percentage. Required when you send tax. |
additionalCosts | Array | No | Extra charges. See Additional Cost Object. |
selectedCurrencyAdditionalCosts | Array | No | The same extra charges in the shopper's selected currency. Used together with additionalCosts. |
Additional Cost Object
| Field | Type | Required | Description |
|---|---|---|---|
name | String | No | Name of the charge, for example Handling fee. |
amount | Number | No | Amount of the charge. |
cURL Example
curl --location --request PUT '<BASE_URL>/checkout/6650f1a2d5775459152d7300' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"tax": 44.55,
"taxType": "amount",
"additionalCosts": [
{ "name": "Handling fee", "amount": 5 },
{ "name": "Freight surcharge", "amount": 18.5 }
]
}'
Response
- 200 OK: The checkout was updated.
- 400 Bad Request: The access token is missing or invalid, the body is empty, a value is not valid,
taxTypeis missing, the checkout was not found, or the order has already been placed.
Sample JSON Response
{
"success": true,
"message": "Checkout updated successfully"
}
Response Details
Result Data
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the checkout was updated. |
message | String | Result message. |
Notes
- A charge with the same
nameas an existing one replaces it. New names are added. - When
additionalCostsis sent, it replaces the checkout's additional costs. Leave it out to keep the current ones. - A checkout cannot be updated after its order has been placed.
- To see the new totals, use Get Checkout.