Use the Coupon Validation API to verify manually entered coupon codes before applying
discounts. Validating coupons upfront—rather than waiting until checkout—gives customers
immediate feedback on whether their code works. The API checks if the coupon exists, is active,
hasn't reached redemption limits, and if the cart is eligible for the promotion.
Required Editions
| Available in: Lightning Experience |
| Available in: Enterprise, Unlimited,
and Developer Editions with Real-Time Offer Management |
How Coupon Validation Works
Integrate the Coupon Validation API with systems such as shopping sites and point-of-sale
(POS) systems. To validate coupons, provide up to 1,000 manually entered coupon codes in the
couponsToValidate request property.
If the cart already contains coupon codes in its coupon fields, the API also discovers and
validates those codes. You don't need to copy those codes into
couponsToValidate. For coupons that pass the coupon-level checks, the API
evaluates promotion eligibility based on where each code is attached.
- For a coupon attached to the cart header, the API evaluates the entire cart.
- For a coupon attached to a cart line, the API evaluates only that line. The line must
participate in a promotion associated with the coupon.
Provide the cart and its line items in the request, using the same cart structure as the
Eligible Promotions API and the Promotion Evaluation and Execution API.
Coupon Validation Results
For each coupon code, the response provides these details.
- An aggregate status across the applicable scopes. The status is
Valid when
the coupon passes validation for at least one applicable scope. Otherwise, the status is
Invalid.
- For a valid coupon, the valid scope, the associated promotion ID, and, for a
Line scope, the applicable cart line item IDs.
- For an invalid coupon, the reason that validation failed.