Please make sure you read the Conventions before continuing with this guide.
Requirements.
You will need:
- An X-API-KEY.
- An Authorization code.
- A cart containing an item to apply the promo to.
- A valid promo for this item.
Checking the promo is valid
To check the promo is valid please find the promo using the promo code. If no promo is returned, check the promo code belongs to the account.
If the response is OK check if the promo is not disabled and verify at least one rule satisfies all the following conditions:
- productId matches the cart item
- the channel you are buying is allowed
- the trip type in the item matches
- if it is restricted to a specific route make sure it matches the item
- if it is restricted to a specific schedule make sure it matches the item
- the day of the week is available
- from and to stations are allowed
- the fare selected in the item is allowed
- you are within the purchase period
- the travel date gap matches your item
- the rule is unlimited or you have quantity available
Applying a promo.
You will interact with the /sales/cart/promos endpoint of the Sales Bucket
to apply one promo to your cart.
The promo will try to match any rule to all the items in the cart. It will return the same given cart with the promo applied to all the item matching. If there is no match or any error occurs, the cart will be returned containing an error property with a string describing the error.
Parameter | Type | Example |
---|---|---|
promoCode | String | promo-code-000 |
channel | String | [websales,backoffice,agency-websales,agency-backoffice] |