This endpoint validates a voucher and calculates how much it can cover of a given order amount.
Bearer token with marketing:read scope
Request body
The voucher code to validate
The order amount in minor units (cents)
3-letter ISO currency code (for currency matching)
Customer ID (for non-transferable voucher ownership check)
Response
Whether the voucher is valid for this transaction
Human-readable error message if invalid
Calculation breakdown showing coverage
Error codes
| Error | Description |
|---|
voucher_not_found | No voucher with this code exists |
voucher_inactive | Voucher is not active |
voucher_expired | Voucher has expired |
voucher_depleted | Voucher has no remaining balance |
voucher_not_transferable | Voucher belongs to another customer |
currency_mismatch | Voucher currency doesn’t match order |
curl -X POST "https://api.voyantcloud.com/v1/vouchers/validate" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"code": "GC1A2B3C4D",
"amount_minor": 10000,
"currency": "EUR",
"customer_id": "cust_456"
}'
Response (Valid - Partial Coverage)
{
"valid": true,
"voucher": {
"id": "voucher_abc123",
"code": "GC1A2B3C4D",
"type": "gift_card",
"current_balance_minor": 7500,
"currency": "EUR"
},
"calculation": {
"requested_amount_minor": 10000,
"applicable_amount_minor": 7500,
"remaining_voucher_balance_minor": 0,
"remaining_order_amount_minor": 2500,
"covers_full_amount": false
}
}
Response (Valid - Full Coverage)
{
"valid": true,
"voucher": {
"id": "voucher_abc123",
"code": "GC1A2B3C4D",
"type": "gift_card",
"current_balance_minor": 15000,
"currency": "EUR"
},
"calculation": {
"requested_amount_minor": 10000,
"applicable_amount_minor": 10000,
"remaining_voucher_balance_minor": 5000,
"remaining_order_amount_minor": 0,
"covers_full_amount": true
}
}
{
"valid": false,
"error": "currency_mismatch",
"message": "Voucher is in EUR, but transaction is in USD"
}