Get Active Coupons
Retrieve all currently active coupons. This is a public endpoint used for displaying available promotions.Authentication
Not required. This is a public endpoint.Response
Array of active coupon objects
Coupon identifier
Coupon code to use at checkout
Type of discount: “percentage” or “fixed”
Discount value (1-100 for percentage, Colombian pesos for fixed)
ISO 8601 expiration date (null if no expiration)
Always true for this endpoint
Example Request
Example Response
Active coupons are those that are:
- Marked as
isActive: true - Not expired (or have no expiration date)
Validate Coupon
Validate a coupon code and calculate the discount for a given cart total.Authentication
Required. User must be authenticated via Clerk.Request Body
The coupon code to validate (case-insensitive)
The current cart total in Colombian pesos (COP)
Response
Whether the coupon is valid for use
The discount amount in COP (only present if valid)
The final total after applying the discount (only present if valid)
The coupon object (only present if valid)
Coupon identifier
Coupon code
“percentage” or “fixed”
Discount value
Error message (only present if invalid)
Example Request
Example Response (Valid)
Example Response (Invalid)
Validation Rules
The coupon validation checks for:- Coupon exists - The code must match an existing coupon
- Active status - Coupon must be marked as
isActive: true - Not expired - Current date must be before
expiresAt(if set) - One-time use - User must not have already used this coupon (checked via
usedByarray)
Common Validation Errors
Common Validation Errors
"Coupon code not found or expired"- Code doesn’t exist, is inactive, or has expired"You have already used this coupon"- User has already redeemed this coupon previously"Coupon is not active"- Coupon is disabled by admin
Applying Coupons
Coupons can be applied during the checkout process when creating a payment intent:- Validate the coupon
- Calculate the discount
- Apply it to the total
- Mark the coupon as used by adding the user to the
usedByarray
Error Responses
Error message describing what went wrong
Common Error Codes
400- Bad Request (missing code or cartTotal)401- Unauthorized (authentication required for validate endpoint)404- Not Found (coupon doesn’t exist)500- Internal Server Error