Skip to main content

Validate Promo Code

Check if a promo code is valid and calculate the discount amount.

Endpointโ€‹

POST /v1/promo-codes/validate

Request Bodyโ€‹

FieldTypeRequiredDescription
codestringYesPromo code to validate
customer_idintegerNoCustomer ID (for per-customer limits)
productsarrayNoProducts in the booking
products[].idintegerYes*Product ID
products[].category_idintegerNoProduct category ID
products[].pricenumberYes*Product price
products[].namestringNoProduct name
experiencesarrayNoExperiences in the booking
experiences[].idintegerYes*Experience ID
experiences[].category_idintegerNoExperience category ID
experiences[].pricenumberYes*Experience price
experiences[].namestringNoExperience name
subtotalnumberNoTotal booking subtotal

Example Requestโ€‹

curl -X POST "https://app.equipdash.com/api/v1/promo-codes/validate" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"code": "SUMMER10",
"customer_id": 456,
"products": [
{
"id": 1,
"category_id": 5,
"price": 100.00,
"name": "Mountain Bike"
},
{
"id": 2,
"price": 50.00,
"name": "Helmet"
}
],
"subtotal": 150.00
}'

Success Responseโ€‹

{
"data": {
"valid": true,
"promo_code": {
"id": 1,
"code": "SUMMER10",
"name": "Summer Sale 10% Off",
"discount_type": "percentage",
"discount_value": 10.00
},
"discount_amount": 15.00,
"eligible_items": ["Mountain Bike", "Helmet"]
},
"meta": {
"request_id": "req_abc123",
"timestamp": "2026-02-01T10:00:00+00:00"
}
}

Error Responseโ€‹

{
"error": {
"code": "validation_error",
"message": "The given data was invalid.",
"details": [
{
"field": "code",
"message": "This promo code has expired."
}
]
}
}

Possible Validation Errorsโ€‹

ErrorDescription
Invalid promo codeCode doesn't exist
This promo code is no longer activeStatus is not active
This promo code is not yet validvalid_from is in the future
This promo code has expiredvalid_until is in the past
This promo code has reached its usage limitmax_uses exceeded
You have already used this promo code the maximum number of timesmax_uses_per_customer exceeded
This promo code doesn't apply to any items in your bookingNo eligible items
Minimum booking amount of X not metmin_booking_amount not reached

Notesโ€‹

  • Validation is read-only - it doesn't consume the promo code
  • Provide products/experiences for accurate discount calculation
  • The eligible_items array shows which items qualify for the discount