Use this endpoint to redeem a voucher during checkout. This deducts the specified amount from the voucher balance.
Bearer token with marketing:write scope
Request body
Amount to deduct in minor units (must not exceed current balance)
The booking ID where the voucher was applied
The customer ID who redeemed the voucher
Description for the transaction record
Response
Returns the transaction record and updated voucher details.
curl -X POST "https://api.voyantcloud.com/v1/vouchers/voucher_abc123/redeem" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount_minor": 5000,
"booking_id": "booking_789",
"customer_id": "cust_456",
"description": "Payment for Booking #789"
}'
{
"data": {
"transaction": {
"id": "txn_xyz",
"workspaceId": "ws_xyz",
"voucherId": "voucher_abc123",
"type": "redemption",
"amountMinor": -5000,
"balanceAfterMinor": 2500,
"currency": "EUR",
"bookingId": "booking_789",
"customerId": "cust_456",
"description": "Payment for Booking #789",
"createdAt": "2024-07-20T14:30:00Z"
},
"voucher": {
"id": "voucher_abc123",
"code": "GC1A2B3C4D",
"previous_balance_minor": 7500,
"new_balance_minor": 2500,
"status": "active"
}
}
}
Errors
| Status | Error | Description |
|---|
| 400 | Voucher is | Voucher is not active |
| 400 | Insufficient balance | Requested amount exceeds current balance |
| 404 | Voucher not found | No voucher exists with the given ID |
When the voucher balance reaches zero, its status automatically changes to depleted.