Skip to main content

Update cart

The Update Cart request will replace the current cart. If you update the Cart while the Checkout is visible, use the Checkout Client API's to invoke suspend before your operation and resume afterward.

Please note

Please note that this operation cannot be performed if the purchase is completed.

While the checkout is suspended, the cart can be updated by calling the Checkout API from your backend as demonstrated in the following code:

Update cart request​

PUT /checkouts/1eec44b5-66d3-4058-a31f-3444229fb727/cart HTTP/1.1
Host: api.uat.walleydev.com // (Please note! Different hostname in production)
Authorization: Bearer bXlVc2VybmFtZTpmN2E1ODA4MGQzZTk0M2VmNWYyMTZlMDE...
Content-Type: application/json

[
{
"id": "10001",
"description": "A product description",
"unitPrice": 95.0,
"unitWeight": 0.3,
"quantity": 1,
"vat": 25.0,
"requiresElectronicId": true,
"sku": "a unique alphanumeric code for article identification"
},
{
"id": "10002",
"description": "Gift Card",
"type": "GiftCard",
"unitPrice": -100.0,
"quantity": 1,
"vat": 0.0
}
]

Request Properties​

Request headers

HeaderRequiredExplanation
AuthorizationYesInstructions on how to generate the authorization header value can be found here.

Request properties

PropertyRequiredExplanation
idYesThe article id or equivalent. Max 50 characters. Values are trimmed from leading and trailing white-spaces. Shown on the invoice or receipt.
descriptionYesDescriptions longer than 50 characters will be truncated. Values are trimmed from leading and trailing white-spaces. Shown on the invoice or receipt.
typeNoAn optional type of the article. Currently the only valid value is GiftCard. If specified, unitPrice must be negative, quantity must be 1, vat must be 0.0. Furthermore unitWeight, requiresElectronicId and minimumAge cannot be specified. Read more about Gift Cards
unitPriceYesThe unit price of the article including VAT. Both positive and negative values allowed. Max 2 decimals, i.e. 100.00
unitWeightNoThe weight of the article. Only positive values are allowed (including zero)
quantityYesThe quantity of the article. Allowed values are 1 to 99999999.
vatYesThe VAT of the article in percent. Allowed values are 0 to 100. Max 2 decimals, i.e. 25.00
requiresElectronicIdNoTo minimize the risk of a fraudulent purchase on credit products, it is possible to force the customer to strongly identify themselves at the point of purchase using electronic id such as Mobilt BankID. An example would be selling tickets that are delivered electronically. This feature does not validate the age of the customer and is supported for credit payments for B2C and B2B on the Swedish, Norwegian and Finnish markets.
minimumAgeNoThe minimum age required to purchase this product. Allowed values are 1 to 120. When this property is set, we require the user to enter a civic number and verify it with electronic id before making the payment. If multiple items has different minimumAge, we use the highest age. This feature is supported for B2C.
skuNoA stock Keeping Unit is a unique alphanumeric code that is used to identify product types and variations. Maximum allowed characters are 1024.

Important error responses​

Error codeError ReasonCause
400Duplicate_ArticlesCan't add article/fees since multiple articles/fees with same id and description already exist.
400Validation_ErrorThe request contains properties with invalid values. Details are provided in the response body.
423Resource_LockedAnother modifying request is currently being executed for the Checkout session. Retry by sending the request again.
900Purchase_Commitment_FoundThe customer has clicked the Complete Purchase button and the Checkout is therefore locked for modifications.
900Purchase_CompletedPurchase is already complete.