Promotions
Add Promo Codes
Applies promotional codes to the cart for discounts
POST
Add Promo Codes
Overview
This endpoint applies promotional codes to the cart for discounts. It accepts multiple promo codes and validates them against the merchant’s active promotions.The endpoint supports both POST and PUT methods for adding promo codes.
Request
The merchant domain (e.g., “staging.luma.gift”)
Array of promotional codes to apply
- Minimum: 1 code
- Maximum: 10 codes
- Each code must be a valid string
Response
Returns a complete shopping cart (same structure as Get Cart) with:couponsarray containing the applied promo codescart_discountfield with the total discount amount (if applicable)- Recalculated totals reflecting the discounts
Promo Code Behavior
Multiple Codes
- Multiple promo codes can be applied simultaneously
- Codes are validated in the order they are provided
- Each code’s eligibility is checked against cart contents
Validation Rules
- Codes must be active and not expired
- Codes must be applicable to current cart items
- Merchant-specific rules may apply (minimum purchase, product restrictions)
Impact on Pricing
- Discounts are reflected in the
cart_discountfield - Line items may include
discountandline_discountamounts - The
discountsarray on line items contains discount details (if supported by merchant) - Taxes are recalculated based on discounted prices
Errors
ErrorInvalidPromoCode
Status Code: 422Description: One or more promo codes are invalid or expired
ErrorPromoNotAvailable
Status Code: 422Description: Promo code is not available for current cart contents
MissingAuthHeader
Status Code: 401Description: x-firmly-authorization header is missing or invalid
InvalidToken
Status Code: 401Description: JWT token is invalid
ErrorInvalidInputBody
Status Code: 400Description: Request body validation failed
Examples
Response Example
Key Points
- Field Names: The applied codes appear in the
couponsarray, notpromo_codes - Discount Tracking: Total discount appears in
cart_discountfield - Line Item Discounts: Individual items may show
discountandline_discountfields - Multiple Code Support: Apply up to 10 codes simultaneously
Add Promo Codes