Validate Code
Check if a discount code is valid and get its details.
Updated
On this page
Overview
Validate a discount code before applying it to see if it's valid and what the discount will be.
REST API
POST /storefront/discount/validate
X-API-Key: pk_live_your_key
Content-Type: application/json
{
"code": "SAVE20",
"subtotal": "99.99"
}
Response
{
"valid": true,
"code": "SAVE20",
"is_percentage": true,
"rate": "20",
"discount_amount": "20.00"
}
Invalid Code Response
{
"valid": false,
"message": "This code has expired"
}
Common Validation Failures
- Code not found — The code doesn't exist
- Code expired — The code's expiration date has passed
- Maximum uses reached — The code has been used too many times
- Minimum order not met — The subtotal is below the minimum order amount
Next Steps
- Apply Discount Code — Apply the validated code
- Discount Codes — Overview of discount types