Start a cart session
In order to start a shopper session, you need to supply brink with a StoreGroupID, CountryCode & LanguageCode
curl --url 'https://shopper.eu-west-1.{env}.brinkcommerce.io/shopper/sessions/start' \
--header 'Content-Type: application/json' \
--data '{
"storeGroupId": "brinkcommerce",
"countryCode": "SE",
"languageCode": "en"
}'
```
This will create a session containing a cart and a token (JWT) that is required for subsequent calls, e.g., adding items to the session. It will also include the available capabilities configured for a specific StoreMarket in Store Management.
Response
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJicmlua2NvbW1lcmNlLXNob3BwZXIiLCJleHAiOjE2Nzg5NjE5NzQsImlhdCI6MTY3NjM2OTk3NCwianRpIjoiNTk3MDQ3YzktZTU4OS00NzJjLWFiMmItNWViNTY0ZDY4NzZiIiwic2Vzc2lvbklkIjoiNTk3MDQ3YzktZTU4OS00NzJjLWFiMmItNWViNTY0ZDY4NzZiIiwic3RvcmVHcm91cElkIjoiYnJpbmtjb21tZXJjZSIsImNvdW50cnlDb2RlIjoiU0UiLCJjdXJyZW5jeUNvZGUiOiJTRUsiLCJsYW5ndWFnZUNvZGUiOiJzdiIsImlzVGF4SW5jbHVkZWRJblByaWNlIjoidHJ1ZSJ9.fkjdJ2N6HxYZF1UxKQzZ_TGcuR6voJGL9r9kM9fh6xo",
"cart": {
"id": "b9077fb9-4752-50ea-8a1c-2e6f42658af3",
"storeGroupId": "brinkcommerce",
"countryCode": "SE",
"currencyCode": "SEK",
"languageCode": "sv",
"isTaxIncludedInPrice": true,
"discountCodes": [],
"created": "2023-02-14T10:19:34.623042807Z",
"updated": "2023-02-14T10:19:34.623042807Z",
"discountAmount": 0,
"revision": 1,
"items": [],
"totals": { "subTotal": 0, "taxTotal": 0, "discountTotal": 0, "grandTotal": 0 }
},
"capabilities": {
"paymentProviders": [
{ "id": "adyen-test", "name": "Adyen" },
{ "id": "kco-test", "name": "KlarnaCheckout" }
],
"shippingProviders": [{ "id": "ingrid-test", "name": "Ingrid" }]
}
}
Updating the shopper session
In order to update a started session, you need to send the token received from the start request as a Bearer token in future requests
curl --url 'https://shopper.eu-west-1.{env}.brinkcommerce.io/shopper/sessions/items' \
--header 'Authorization: {token}' \
--header 'Content-Type: application/json' \
--data '{
"quantity": 1,
"productVariantId": "t-shirt-1.s"
}'
Response
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJicmlua2NvbW1lcmNlLXNob3BwZXIiLCJleHAiOjE2Nzg5NjE5NzQsImlhdCI6MTY3NjM2OTk3NCwianRpIjoiNTk3MDQ3YzktZTU4OS00NzJjLWFiMmItNWViNTY0ZDY4NzZiIiwic2Vzc2lvbklkIjoiNTk3MDQ3YzktZTU4OS00NzJjLWFiMmItNWViNTY0ZDY4NzZiIiwic3RvcmVHcm91cElkIjoiYnJpbmtjb21tZXJjZSIsImNvdW50cnlDb2RlIjoiU0UiLCJjdXJyZW5jeUNvZGUiOiJTRUsiLCJsYW5ndWFnZUNvZGUiOiJzdiIsImlzVGF4SW5jbHVkZWRJblByaWNlIjoidHJ1ZSJ9.fkjdJ2N6HxYZF1UxKQzZ_TGcuR6voJGL9r9kM9fh6xo",
"cart": {
"id": "b9077fb9-4752-50ea-8a1c-2e6f42658af3",
"storeGroupId": "brinkcommerce",
"countryCode": "SE",
"currencyCode": "SEK",
"languageCode": "sv",
"isTaxIncludedInPrice": true,
"discountCodes": [],
"created": "2023-02-14T10:19:34.623042807Z",
"updated": "2023-02-14T10:19:34.623042807Z",
"discountAmount": 0,
"revision": 2,
"items": [
{
"id": "2a566bf4-997f-49ad-b924-0fda42ebafdd",
"productVariantId": "t-shirt-1.S",
"productParentId": "t-shirt-1",
"quantity": 1,
"name": "T-Shirt",
"displayName": "T Shirt",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ac lorem efficitur, interdum justo ac, fermentum metus. Pellentesque porttitor sit amet ipsum ut blandit. Duis quis sagittis lorem. Praesent venenatis hendrerit nunc luctus commodo",
"displayDescription": "Suspendisse a porta diam, at congue metus. Nam sollicitudin augue lorem, id elementum massa luctus id. Phasellus facilisis ex sed massa posuere, ut dapibus erat fringilla. Ut mauris orci, consequat sit amet arcu vitae, ullamcorper fringilla sapien. Sed ac nunc ante.",
"taxGroupId": "apparel",
"basePriceAmount": 50000,
"salePriceAmount": 50000,
"discountAmount": 0,
"taxPercentage": 2500,
"taxPercentageDecimals": 2,
"imageUrl": "http://P.wrihNyaaIjjzulhV+YBiPl,RsEHnqO2kTiReoG,hWqWT",
"customAttributes": [
{ "key": "color", "value": "black" },
{ "key": "size", "value": "S" }
],
"tags": [
{ "key": "category", "value": "t-shirt" },
{ "key": "size", "value": "S" }
],
"created": "2023-02-14T10:19:34.943357529Z",
"updated": "2023-02-14T10:19:34.943357529Z",
"revision": 1,
"totalDiscountAmount": 0,
"totalPriceAmount": 50000,
"totalTaxAmount": 10000
}
],
"totals": { "subTotal": 50000, "taxTotal": 10000, "discountTotal": 0, "grandTotal": 50000 }
},
"capabilities": {
"paymentProviders": [
{ "id": "adyen-test", "name": "Adyen" },
{ "id": "kco-test", "name": "KlarnaCheckout" }
],
"shippingProviders": [{ "id": "ingrid-test", "name": "Ingrid" }]
}
}