Group Cart Promotion Flow
How to apply a group cart promotion
Use these services to apply group cart promotions. This flow allows you to do:
- Get the promotions availables to apply in the cart.
- Add an available promotion to the cart.
- Use a promotional code to apply cart promotion.
- Release an selected promotion from cart.
Let's get started with the example
Step-by-step examples
This guide shows how to get the details of the content of an active shopping cart using a valid cart token.
You will need a valid OAuth access_token to be able to make each call! Please refer to our Authentication Guide to obtain one.
Get applicable promotions
This call returns a list with the available promotions for that cart.
To see how to get available promotions and discounts visit our guide
Note: The group cart promotions that can be applicable in the cart will have the following structure:
{
"@token": "813ef0815441ea62c8609450b61b6384",
"@currency": "EUR",
"@timeLeft": "520",
"shopping-cart-sales": {
"availableCartPromotions": {
"groupCartPromotion": [
{
"@id": "116",
"name": "10% promotional code",
"type": "PERCENTAGE",
"value": "10.0",
"group": {
"@id": "1236",
"name": "BSM user cart",
"validationType": "INTERNAL",
"validationMethod": "USER"
},
"promotionComElements": {
"name": "10% sale",
"description": "10% sale description"
}
}
]
}
}
}
Use promotional code
With this endpoint is possible to send a promotional code to apply group cart promotion.
- cart-token: The identifier of the cart.
- promotional-code: The promotional code that will make this promotion available.
curl --location --request POST 'https://api.oneboxtds.net/onebox-rest2/rest/shoppingCart/cartPromotionalCodeGroup' \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer {{access_token}}'
--data-urlencode 'promotionalCode={{promotional-code}}' \
--data-urlencode 'token={{cart-token}}'
Add promotion to the cart
This method uses the promotion id to apply that promotion to the cart.
- cart-token: The identifier of the cart.
- promotionId: The identifier of the promotion that will be applied.
curl --location --request POST 'https://api.oneboxtds.net/onebox-rest2/rest/shoppingCart/addCartPromotion' \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer {{access_token}}' \
--data-urlencode 'promotionId={{promotionId}}' \
--data-urlencode 'token={{cart-token}}'
Note: To add a group cart promotion you must first use the promotional code.
Release cart promotion
This method allows to delete cart promotion from a cart passing its id.
- cart-token: The identifier of the cart.
- promotionId: The identifier of the promotion that will be applied.
curl --location --request DELETE 'https://api.oneboxtds.net/onebox-rest2/rest/shoppingCart/releaseCartPromotion' \
--header 'Accept: application/json' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer {{access_token}}' \
--data-urlencode 'promotionId={{promotionId}}' \
--data-urlencode 'token={{cart_token}}'