Skip to content

Voucher Redemption

Once an order is fulfilled, the buyer holds one or more voucher codes they can redeem on the partner platform (e.g. an Amazon gift-card code, a Netflix PIN, a mobile top-up token).

Because orders can contain multiple products and multiple quantities, BD Voucher exposes codes at two levels:

  • Order level → one flat voucher_codes[] array containing every code across all items and quantities.
  • Item levelitems[].voucher_codes[] grouped by variant.

Both lists match exactly what the customer received in their consolidated delivery email.


Get all codes for an order

The easiest way to retrieve every code from an order — whether the basket contained one product or many, and regardless of quantity — is to check the top-level voucher_codes array on the order response:

GET /api/v1/orders/:id
Authorization: Bearer $TOKEN
{
"id": 42,
"order_number": "20260427",
"status": "SUCCEEDED",
"dispatched_email": "customer@example.com",
"email_sent_at": "2026-04-27T14:22:00.000Z",
"voucher_codes": ["ABCD-1234-EFGH-5678", "WXYZ-9876-MNOP-5432"],
"items": [
{
"variant_id": 22402,
"quantity": 2,
"fulfilled": true,
"fulfilled_at": "2026-04-27T14:21:58.000Z",
"voucher_codes": ["ABCD-1234-EFGH-5678", "WXYZ-9876-MNOP-5432"],
"voucher": {
"id": 101,
"code": "ABCD-1234-EFGH-5678",
"status": "sold",
"serial_number": null,
"expires_at": "2027-04-27T00:00:00.000Z"
}
}
]
}

Order-level voucher fields

FieldTypeDescription
voucher_codesstring[]Flat deduplicated list of every code across every item and every quantity unit — identical to the list the customer received by email.
dispatched_emailstring | nullThe email address the consolidated voucher email was sent to. null until the email is successfully dispatched.
email_sent_atISO 8601 | nullTimestamp of the last successful voucher-email dispatch. null until sent.

Item-level voucher fields

FieldTypeDescription
items[].voucher_codesstring[]Codes belonging to this specific item / variant. For a quantity: 2 item, this holds both codes.
items[].voucher.codestringPrimary voucher code (the first code for multi-quantity items).
items[].voucher.statusstringVoucher status: available, reserved, sold, or used.
items[].voucher.serial_numberstring | nullOptional serial / activation number returned by the partner.
items[].voucher.expires_atISO 8601 | nullExpiry date set by the partner, if provided.

List vouchers

Returns all vouchers linked to the authenticated user’s fulfilled orders, with optional filtering.

GET /api/v1/vouchers
Authorization: Bearer $TOKEN

Query parameters

ParameterTypeDescription
pageintegerPage number (1-based). Default: 1.
limitintegerItems per page. Default: 20.
searchstringFull-text search across voucher code and product name.
categoryIdintegerFilter by product category ID.
brandIdintegerFilter by brand ID.
partnerIdintegerFilter by fulfillment partner ID.
paymentChannelIdintegerFilter by the payment channel used for the order.
sortstringSort order: price_asc, price_desc, or newest (default).

Example

GET /api/v1/vouchers?page=1&limit=10&sort=newest
Authorization: Bearer $TOKEN

Notes on multi-quantity orders

When a customer buys quantity: 3 of a single variant, three separate voucher rows are created — one per unit. They all appear in items[].voucher_codes[] and again in the top-level voucher_codes[] for easy access without traversing the items list.

The consolidated delivery email groups all codes together with product and variant labels so customers never lose track of which code belongs to which purchase.