Octopus Cards

Orders

Create voucher orders, track delivery, and retrieve voucher codes

Orders are how you purchase digital gift cards and top-ups through the Octopus Cards API. You submit an order with a product, denomination, and quantity — the platform handles fulfillment and delivers voucher codes, PINs, or claim URLs back to you.

Order Lifecycle

1. Calculate charges    POST /api/v1/products/:id/charges
2. Create order         POST /api/v1/orders
3. Poll for delivery    GET  /api/v1/orders/:id
4. Retrieve vouchers    (included in order response)

Sync vs Async Delivery

Orders are fulfilled in one of two modes depending on quantity:

ModeConditionBehaviour
SynchronousQuantity ≤ 5Vouchers are returned directly in the create order response
AsynchronousQuantity > 5Order is created with status PENDING. A background job processes the order and delivers vouchers. Poll the order endpoint to check status.

For async orders, the response returns immediately with status: PENDING and an empty vouchers array. Use GET /api/v1/orders/:id to check when delivery is complete.

Order Statuses

StatusDescription
PENDINGOrder placed, vouchers are being processed
DELIVEREDAll vouchers have been successfully delivered
PARTIALLY_DELIVEREDSome vouchers delivered, others still pending or failed
FAILEDOrder could not be fulfilled
CANCELLEDOrder was cancelled

Status Transitions

Orders follow a predictable lifecycle. The diagram below shows all valid transitions:

                    ┌──────────┐
                    │ PENDING  │
                    └────┬─────┘

              ┌──────────┼──────────┐
              ▼          ▼          ▼
      ┌───────────┐ ┌────────┐ ┌──────────┐
      │ DELIVERED │ │ FAILED │ │CANCELLED │
      └───────────┘ └────────┘ └──────────┘


   ┌──────────┴──────────┐
   │ PARTIALLY_DELIVERED  │
   └──────────────────────┘
FromToWhen
PENDINGDELIVEREDAll vouchers fulfilled successfully
PENDINGPARTIALLY_DELIVEREDSome vouchers delivered, others still in progress
PENDINGFAILEDFulfillment failed entirely
PENDINGCANCELLEDOrder cancelled before fulfillment
PARTIALLY_DELIVEREDDELIVEREDRemaining vouchers fulfilled
PARTIALLY_DELIVEREDFAILEDRemaining vouchers could not be fulfilled

DELIVERED, FAILED, and CANCELLED are terminal statuses — once an order reaches one of these, it will not change again. PARTIALLY_DELIVERED is the only non-terminal status besides PENDING.

Voucher Delivery

When an order is DELIVERED or PARTIALLY_DELIVERED, the vouchers are included in the order response. Each voucher may contain:

FieldDescription
card_numberThe voucher code (e.g. gift card number)
pin_codePIN associated with the voucher (if applicable)
claim_urlA URL to redeem the voucher (for URL-based delivery)
expires_atExpiry date of the voucher (RFC 3339)
voucher_reference_numberReference code for the voucher

Not all fields are present on every voucher — it depends on the product's delivery mode:

Delivery ModeFields Present
Code with PINcard_number, pin_code, expires_at, voucher_reference_number
URLclaim_url, pin_code (optional), expires_at

Voucher codes and PINs are encrypted at rest and decrypted on-the-fly when you retrieve the order. Store them securely on your side — they represent real monetary value.

Balance & Wallet Checks

Before an order is created, the platform verifies:

  1. Wallet exists — you must have a wallet in the product's currency (or specify a wallet_id for cross-currency orders with FX conversion)
  2. Sufficient balance — your wallet balance must be ≥ the total payable amount (from the charges endpoint)
  3. Atomic deduction — the wallet is debited in the same database transaction as the order creation, ensuring consistency

If the balance is insufficient, the order is rejected with a 400 error and no funds are moved.

Quantity Limits

LimitDescription
Bulk limitYour client account has a configurable maximum quantity per order. Check max_quantity from the charges endpoint.
Absolute maxCode-based orders are capped at 5,000 vouchers per request

Reference Codes

Every order has a ref (reference code):

  • If you provide one, it must be unique across all your orders. Duplicate references are rejected.
  • If you omit it, the platform generates a UUID automatically.
  • Use the client_reference field for your own internal tracking (not required to be unique).

Endpoints

MethodPathDescription
POST/api/v1/ordersCreate a new voucher order
GET/api/v1/ordersList all orders with pagination
GET/api/v1/orders/:idGet order details with vouchers

On this page