Update checkout
The Update checkout request will replace the entire checkout state. If you
update the Checkout while the Checkout is visible, use the
Checkout Client API's to
invoke suspend
before your operation and resume
afterward. You can also update the objects individually:
cart, shippingProperties, fees, reference, metadata.
Please note that this operation cannot be performed if the purchase is completed.
While the checkout is suspended, the checkout can be updated by calling the Checkout API from your backend as demonstrated in the following code:
Update checkout request​
- Request
- Response
- Error
PUT /checkouts/1eec44b5-66d3-4058-a31f-3444229fb727/ HTTP/1.1
Host: api.uat.walleydev.com // (Please note! Different hostname in production)
Authorization: Bearer bXlVc2VybmFtZTpmN2E1ODA4MGQzZTk0M2VmNWYyMTZlMDE...
Content-Type: application/json
{
"cart": [
{
"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
}
],
"shippingProperties": {
"height": 10,
"width": 20,
"isBulky": true
},
"fees": {
"shipping": {
"id": "shipping001",
"description": "Shipping cost (incl. VAT)",
"unitPrice": 59.0,
"vat": 25.0
}
},
"reference": "ABCDEFGHJIKLMNOP",
"metadata": {
"administrator": "John Doe",
"someOtherData": [1, { "myObj": { "key": 1 } }]
}
}
{
"id": "f5f4e86d-95b1-4c1a-8ad0-1d5907236bd7",
"data": null,
"error": null
}
/*
Example error. More errors available below.
*/
{
"id": "c6d8801a-742b-4912-bf32-2772fa10acec",
"data": null,
"error": {
"code": 400,
"message": "Bad or faulty request. Please examine the errors property for details.",
"errors": [
{
"reason": "Validation_Error",
"message": "The Cart field is required."
}
]
}
}
Request Properties​
Request headers
Header | Required | Explanation |
---|---|---|
Authorization | Yes | Instructions on how to generate the authorization header value can be found here. |
- Root request properties
- Cart
- Shipping properties
- Fees
- Reference
- Metadata
Property | Required |
---|---|
cart | Yes |
shippingProperties | No |
fees | No |
reference | No |
metadata | No |
Property | Required | Explanation |
---|---|---|
id | Yes | The article id or equivalent. Max 50 characters. Values are trimmed from leading and trailing white-spaces. Shown on the invoice or receipt. |
description | Yes | Descriptions longer than 50 characters will be truncated. Values are trimmed from leading and trailing white-spaces. Shown on the invoice or receipt. |
type | No | An 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 |
unitPrice | Yes | The unit price of the article including VAT. Both positive and negative values allowed. Max 2 decimals, i.e. 100.00 |
unitWeight | No | The weight of the article. Only positive values are allowed (including zero) |
quantity | Yes | The quantity of the article. Allowed values are 1 to 99999999 . |
vat | Yes | The VAT of the article in percent. Allowed values are 0 to 100 . Max 2 decimals, i.e. 25.00 |
requiresElectronicId | No | To 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. |
minimumAge | No | The 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. |
sku | No | A stock Keeping Unit is a unique alphanumeric code that is used to identify product types and variations. Maximum allowed characters are 1024. |
Shipping properties object that will replace any existing value. It is compromised of key-value pairs that will set shipping properties. Each key must be a string but the value can be any valid JSON value.
If the Delivery Module is used the customer selects delivery method inside Walley Checkout meaning that the fees.shipping
object is obsolete.
To set the shipping fee, add a shipping
object to the fees object of the request. The shipping
object can be null
to remove the shipping fee for the current Checkout.
The shipping
object contain the following properties:
Property | Required | Explanation |
---|---|---|
id | Yes | An id of the fee item. Max 50 characters. The combination of id and description (property below) must be unique within the Checkout session including the articles in the cart. Values are trimmed from leading and trailing white-spaces. Shown on the invoice or receipt. |
description | Yes | Descriptions longer than 50 characters will be truncated. Description and id (property above) must be unique within the Checkout session including the articles in the cart. Values are trimmed from leading and trailing white-spaces. Shown on the invoice or receipt. |
unitPrice | Yes | The unit price of the fee including VAT. Allowed values are 0 to 999999.99 . Max 2 decimals, i.e. 25.00 |
vat | Yes | The VAT of the fee in percent. Allowed values are 0 to 100 . Max 2 decimals, i.e. 25.00 |
A reference to the order, i.e. order ID or similar. Note that the reference provided here will not be shown to the customer but can be correlated with the PurchaseIdentifier shown to the customer. It has a 50-character limit.
Metadata object that will replace any existing metadata. Each key in the object must be a string but the value can be any valid JSON value.
The Update checkout PUT request will replace the entire checkout state. Providing null to any optional root property will remove the existing value.
This endpoint can not be used for updating the reference after a purchase. Use Update order reference once the purchase is completed.
Important error responses​
Error code | Error Reason | Cause |
---|---|---|
400 | Validation_Error | The request contains properties with invalid values. Details are provided in the response body. |
423 | Resource_Locked | Another modifying request is currently being executed for the Checkout session. Retry by sending the request again. |
900 | Purchase_Commitment_Found | The customer has clicked the Complete Purchase button and the Checkout is therefore locked for modifications. |
900 | Purchase_Completed | Purchase is already complete. |