Skip to content

Orders

This page is the single source of truth for the customer order lifecycle in BD Voucher.

End-to-end lifecycle

  1. Customer creates an order with one or more items.
  2. Payment is initiated (inline or explicit two-step).
  3. Gateway callback is re-verified server-side.
  4. Fulfillment runs automatically — voucher codes retrieved from preloaded pool or partner API.
  5. One consolidated voucher email is sent for the entire order.

Create an order

POST /api/v1/orders
Authorization: Bearer $TOKEN
Content-Type: application/json
{
"items": [
{ "variant_id": 22402, "quantity": 2, "fulfillment_input": { "player_id": "123456789" } },
{ "variant_id": 22405, "quantity": 1 }
],
"payment_method": "paystation",
"recipient_email": "gift-recipient@example.com"
}
  • payment_method must be one of sslcommerz, bkash, paystation, dcb, nagad.
  • init_payment defaults to true, so POST /orders usually returns an initialized payment session.
  • Set "init_payment": false if you prefer explicit payment initiation later.
  • discount_code (optional) — a promo code applied to the order. Validate it first with GET /api/v1/discounts/validate to preview the deduction. See Discount Codes.

Two payment patterns

Use default init_payment = true in POST /api/v1/orders and redirect to data.payment.paymentGatewayUrl.

Pattern B: Explicit two-step

  1. Create order with "init_payment": false
  2. Initiate payment later:
POST /api/v1/payments/initiate/:orderId
Authorization: Bearer $TOKEN
Content-Type: application/json
{
"amount": 500,
"currency": "BDT",
"method": "bkash",
"description": "Order #12345"
}

See Payments for gateway-specific callback and verification details.


Retrieve order details

List my orders

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

Get one order

GET /api/v1/orders/:id
Authorization: Bearer $TOKEN

You can pass the numeric id or the 8-digit order_number.


Order response fields

FieldTypeDescription
idintegerInternal numeric order ID.
order_numberstring8-digit human-readable order number (safe to display to customers).
statusstringMachine-readable order state (see Status semantics below).
status_labelstringCompact UI label suitable for badges.
status_messagestringCustomer-facing prose safe to render in a confirmation/status screen.
total_amountnumberTotal charged amount in BDT after any discount.
currencystringAlways "BDT".
discount_codestring | nullThe promo code applied to this order. null if none was used.
discount_amountnumber | nullBDT amount deducted by the discount code. null if none was used.
voucher_codesstring[]Flat list of all codes across all items and all quantities — matches the email the customer received.
dispatched_emailstring | nullThe email address the consolidated voucher email was sent to.
email_sent_atISO 8601 | nullTimestamp of the latest successful voucher-email dispatch.
items[]arrayPer-item details including variant_id, quantity, fulfilled, voucher_codes[], voucher.
payments[]arrayAssociated payment records with status, transaction_id, and payment_method.
created_atISO 8601When the order was placed.
updated_atISO 8601Last modification timestamp.

Item-level fields

FieldTypeDescription
items[].variant_idintegerThe purchased product variant.
items[].quantityintegerNumber of units purchased.
items[].unit_pricenumberPrice per unit at time of purchase.
items[].fulfilledbooleantrue once the voucher code has been saved and the delivery email sent successfully.
items[].fulfilled_atISO 8601 | nullWhen fulfillment completed.
items[].fulfillment_statusstring | nullFine-grained fulfillment state: SUCCEEDED, DISPATCH_FAILED, PARTNER_FAILED.
items[].voucher_codesstring[]All codes for this item (one per unit purchased).
items[].voucherobject | nullPrimary voucher record with code, status, serial_number, expires_at.

Status semantics

StatusMeaning
INITIATEDOrder created, payment not yet confirmed.
PENDINGPayment succeeded, voucher fulfillment in progress.
CARRIER_AUTHORIZEDPayment authorized by carrier (DCB), final confirmation pending.
SUCCEEDEDAll items fulfilled and vouchers delivered.
NEEDS_ATTENTIONCustomer was charged but delivery failed — operator action required.
FAILEDPayment failed or was declined.
CANCELLEDCustomer or gateway cancelled before payment.

Multi-item and multi-quantity behavior

  • Orders can contain multiple products and quantities in one checkout.
  • Fulfillment produces one code per purchased unit (a quantity: 3 item yields 3 voucher codes).
  • The customer receives one consolidated email per order, with product and variant labels for each code.
  • voucher_codes at order level is the flat union of all per-item codes — the same set the customer email contains.