Skip to main content

Basket change

It is possible to change a basket that has already been sent to OpenApp but has not been converted. This can be useful when a user modifies their basket in the webshop without after the basket has already been retrieved by OpenApp. To do so, a basket change callback can be executed, as shown in step 7 of the sequence diagram:

Request

A basket change request is executed by a POST to the following endpoint:

POST {{OpenAppUrl}}/merchant/v1/basket/change

The request body contains information about the order that is being cancelled:

{
"id": "basket-id",
"expiresAt": "2022-03-23T21:00:00Z",
"price": {
"currency": "PLN",
"discounts": [
{
"code": "discount-code-text",
"value": 1000
}
],
"basketValue": 13000
},
"deliveryOptions": [
{
"key": "INPOST_APM",
"cost": 0
},
{
"key": "DPD_COURIER",
"cost": 1000,
"timing": "next business day"
}
],
"products": [
{
"ean": "12312",
"id": "id123",
"name": "Superb product",
"images": [
"http://cdn.merchant.com/static/products/id123/1",
"http://cdn.merchant.com/static/products/id123/2"
],
"quantity": 2,
"unitPrice": 7000,
"linePrice": 14000,
"originalUnitPrice": 7000,
"originalLinePrice": 14000,
"policies": [
{
"type": "AGE",
"criteria": {
"minAge": 18
}
}
]
}
],
"loggedUser": "user-id-from-webshop"
}

Response

In response, OpenApp will confirm the order is cancelled.

warning

Sending a basket change will reload the basket for the user if the user had not yet initiated the payment. If the user had initiated the payment, the payment will complete and the order will be placed according to the original basket. The shop must be able to handle this scenario.

Errors

Error nameCode
InvalidBasketException400
MissingDeliveryOptionsException400
BasketExpiredException400