Skip to main content

Basket initiation

When a merchant has catalogue polling integrated and the in-app catalogue display capability enabled, users can browse the merchant's products directly in the OpenApp app. Once the user has selected products, OpenApp initiates the basket in the merchant system before the normal checkout flow continues.

Request

OpenApp executes a HTTP POST to the endpoint configured in the control panel:

POST <initiate-url>

The request body contains the products the user added in the app - each product carries the id and ean from the catalogue, plus the quantity and prices OpenApp knows at that point. If the user is known to the merchant (for example, the user is logged in to the merchant's own app), the optional loggedUser field carries the merchant's stable user identifier.

{
"basket": {
"products": [
{
"ean": "12312",
"id": "id123",
"quantity": 2,
"unitPrice": 7000,
"linePrice": 14000
}
]
}
}

Response

The merchant validates the requested products against current stock and prices, then responds with the authoritative basket in the standard OpenPayBasket format - the same format returned by basket retrieval and basket recalculate. If a product cannot be accommodated (for example, out of stock or quantity exceeding available stock), the merchant returns it with the appropriate error code rather than omitting it, so OpenApp can inform the user.

{
"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"
}