Skip to main content

Validate Coupon

Introduction

This endpoint validates a coupon code for a specific event and ticket, ensuring that it’s applicable, available, and authorized for the current user.


Endpoint

POST https://api.paydexp.com/v1/coupon/validate

Authorization

Users need to include basic authentication credentials in the request headers.

Below are code examples in different programming languages demonstrating how to validate a ticket sales.

curl --location --request POST 'https://api.paydexp.com/v1/coupon/validate' \
--header 'Authorization: Basic {base64_encoded_username_password}' \
--header 'Content-Type: application/json' \
--data '{
"event_id": 123,
"ticket_id": 1759,
"slots": 2,
"coupon_code": "DISCOUNT20"
}'

Example Success Response

{
"success": true,
"data": {
"id": 1,
"code": "DISCOUNT20",
"discount_type": "percentage",
"discount_value": 20,
"valid_for_ticket": true,
"is_available": true,
"available_until": "2025-12-14",
"original_amount": 300,
"discounted_amount": 240,
"discount_amount": 60,
"discount_percentage": 20,
"sale_period": "Nov 1, 2025 - Dec 14, 2025"
},
"message": "Coupon is valid and applicable."
}

Error Response

{
"success": false,
"message": "Coupon not found"
}

NB

This endpoint includes additional validations to ensure that:

  • The event belongs to the authenticated API user
  • The ticket belongs to the specified event
  • The coupon code is valid and available
  • The coupon can be applied to the specified ticket

Conclusion

The endpoint provides a secure and efficient way to verify whether a coupon is valid and applicable to a specific event and ticket.