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.

Important

This operation is only available while the purchase is still in progress.

While the checkout is suspended, the cart can be updated by calling the Checkout API from your backend:

PUT /checkouts/{checkoutId}/cart HTTP/1.1
API Reference

See Update cart for the request schema, property descriptions, examples and error reasons.

Cart items​

The request replaces the whole cart, so send the complete set of items rather than a delta. The id and description values are trimmed of leading and trailing white-space before they are stored.

Cart Validation

The cart cannot consist entirely of items with negative unitPrice values. At least one item in the cart must have a non-negative unit price.

Gift cards. Set type to GiftCard to add a gift card to the cart. Give it a negative unitPrice, a quantity of 1 and a vat of 0.0. Leave out unitWeight, shipping, requiresElectronicId, minimumAge and maximumAge. A cart can hold several gift cards, but no two of them can share the same id, description and unitPrice, so give each gift card its own id. Read more about Gift Cards.

Strong identification. Set requiresElectronicId on an item to force the customer to identify themselves with electronic id, such as Mobilt BankID, at the point of purchase. This lowers the risk of a fraudulent purchase on credit products, for example when selling tickets that are delivered electronically. It does not validate the age of the customer, and it is supported for credit payments for B2C and B2B on the Swedish, Norwegian and Finnish markets.

Age limits. Set minimumAge or maximumAge on an item to require the customer to enter a civic number and verify it with electronic id before paying. When items carry different limits, the oldest minimumAge and the youngest maximumAge apply. Age limits are supported for B2C.

Shipping properties​

The shippingProperties is optional and only relevant if a Delivery Module is used. It consists of key-value pairs that will set shipping properties. Each key must be a string, and the value can be a string, a boolean, a number or null.

The request replaces the whole set, so omit a key to remove that property. If you send a key with a null value, the key stays and Walley stores its value as null. To remove every shipping property, send shippingProperties as null or as an empty object.

Error responses​

The error reasons this endpoint can return are listed per status code in the API Reference. The Error codes page explains the HTTP status codes used across the Checkout API.