Skip to main content

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​

ParameterTypeDescription
idStringRequired. The ID of the checkout.

Request Body​

The request body is a JSON object with the tax and costs to set.

FieldTypeRequiredDescription
taxNumberNoTax amount, or tax rate as a decimal (for example 0.0825 for 8.25%).
taxTypeStringNoamount or percentage. Required when you send tax.
additionalCostsArrayNoExtra charges. See Additional Cost Object.
selectedCurrencyAdditionalCostsArrayNoThe same extra charges in the shopper's selected currency. Used together with additionalCosts.

Additional Cost Object​

FieldTypeRequiredDescription
nameStringNoName of the charge, for example Handling fee.
amountNumberNoAmount 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, taxType is 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​

FieldTypeDescription
successBooleanWhether the checkout was updated.
messageStringResult message.

Notes​

  • A charge with the same name as an existing one replaces it. New names are added.
  • When additionalCosts is 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.