API ReferenceTopups

Orders

List top-up orders, fetch one with live status, attach a notification email

GET /api/v1/topups/orders

Returns a paginated list of your client's top-up orders, sorted by most recent first.

Request

curl "https://api.octopuscards.io/api/v1/topups/orders?status=PENDING&page=1&per_page=50" \
  -H "Authorization: Bearer <token>"

Query Parameters

KeyTypeRequiredDescription
pageintegerNoPage number (1-based). Default: 1.
per_pageintegerNoItems per page (1–500). Default: 50.
statusstringNoFilter by status. One of PENDING, DELIVERED, FAILED, CANCELLED, RECHARGED.
product_idintegerNoFilter to a single product. Must be > 0 when supplied.
countrystringNoFilter by country code (ISO 3166-1 alpha-3, uppercase, e.g. IND).
client_referencestringNoExact-match lookup against the client_reference you supplied on create. Recommended path for fetching an order by your own key — at most one result.

Response

[
  {
    "id": 9123456,
    "client_reference": "CAMPAIGN_DEC_24",
    "product_id": 4218,
    "product_name": "PUBG Mobile UC",
    "variant_name": "325 UC",
    "country_code": "GLO",
    "amount": 4.7405,
    "currency": "USD",
    "status": "PENDING",
    "status_text": "Order submitted for fulfilment",
    "created_at": "2026-05-19T14:30:00Z"
  },
  {
    "id": 9123440,
    "product_id": 4218,
    "product_name": "PUBG Mobile UC",
    "variant_name": "325 UC",
    "country_code": "GLO",
    "amount": 4.7405,
    "currency": "USD",
    "status": "DELIVERED",
    "status_text": "Top-up delivered",
    "transaction_id": 7401120,
    "created_at": "2026-05-19T13:55:00Z",
    "completed_at": "2026-05-19T13:55:08Z"
  }
]

Response Headers

HeaderDescription
X-PageCurrent page number
X-Per-PageItems per page
X-Total-CountTotal matching orders
X-Total-PagesTotal pages
X-Page-SizeItems in current page
X-Has-Moretrue if more pages exist

Enumerations

See the Create Order page for the status enum.

Response Fields

KeyTypeDescription
idintegerServer-issued order ID.
client_referencestringEcho of the value you supplied on create (omitted if you didn't supply one).
product_idintegerThe product the order was placed against.
product_namestringDisplay name of the product (e.g. "PUBG Mobile UC", "Airtel India").
variant_namestringDisplay name of the variant Octopus Cards matched (e.g. "325 UC"). The variant_id itself is internal and not surfaced.
country_codestringISO 3166-1 alpha-3 country code of the product (e.g. IND, GLO).
amountnumberAmount debited from the wallet.
currencystringWallet/product currency.
statusstringCurrent status.
status_textstringLatest human-readable detail.
transaction_idintegerWallet transaction ID (after debit).
created_atstringRFC 3339.
completed_atstringRFC 3339. Present only when terminal.

Errors

401 Unauthorized — missing JWT.

{
  "error": {
    "name": "UnauthorizedError",
    "code": "UNAUTHORIZED",
    "message": "Authentication required"
  }
}

GET /api/v1/topups/orders/:id

Returns a single order. For orders still in PENDING state, this endpoint refreshes the status from fulfilment before responding — so it returns the freshest known state, not a snapshot from your last write.

Request

curl "https://api.octopuscards.io/api/v1/topups/orders/9123456" \
  -H "Authorization: Bearer <token>"

Request Parameters

KeyTypeRequiredDescription
idintegerYesOrder ID (path parameter). Returned as id from order creation.

Response

{
  "id": 9123456,
  "client_reference": "CAMPAIGN_DEC_24",
  "product_id": 4218,
  "product_name": "PUBG Mobile UC",
  "variant_name": "325 UC",
  "country_code": "GLO",
  "amount": 4.7405,
  "currency": "USD",
  "status": "DELIVERED",
  "status_text": "Top-up delivered",
  "transaction_id": 7401123,
  "input_data": {
    "player_id": "5123456789",
    "server": "asia"
  },
  "created_at": "2026-05-19T14:30:00Z",
  "completed_at": "2026-05-19T14:31:12Z"
}

Response Fields

See the Create Order response table. The list and detail responses share the same shape.

Polling cadence. A reasonable poll interval is 5–10 seconds for the first minute, then back off to 30–60 seconds. Top-ups typically resolve within seconds. An order that stays PENDING longer is Octopus Cards automatically retrying transient fulfilment issues — it isn't stuck. Stop foreground polling after a few minutes; rely on the notification email (or future webhook events) for the terminal transition. The server-side status check inside this endpoint has its own 15-second timeout, so polling faster than 5 seconds gives no benefit.

Errors

400 Bad Requestid is not a valid integer.

{
  "error": {
    "name": "ValidationException",
    "code": "VALIDATION_FAILURE",
    "message": "Invalid order ID"
  }
}

PATCH /api/v1/topups/orders/:id/notification-email

Attaches (or updates) the email address that will be notified when the order reaches a terminal status. Only accepted while the order is still in flight — once DELIVERED, FAILED, or CANCELLED, the email is locked.

Use this when your customer enters their email after placing the order (e.g. in a "where should we send the receipt?" follow-up screen).

Request

curl -X PATCH "https://api.octopuscards.io/api/v1/topups/orders/9123456/notification-email" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "customer@example.com"
  }'

Request Parameters

KeyTypeRequiredDescription
idintegerYesOrder ID (path parameter).
emailstringYesEmail address. Max 254 characters.

Response

{
  "success": true,
  "message": "Notification email updated successfully"
}

Response Fields

KeyTypeDescription
successbooleanAlways true on success.
messagestringConfirmation string.

Errors

400 Bad Requestemail missing, empty, or too long.

{
  "error": {
    "name": "ValidationException",
    "code": "VALIDATION_FAILURE",
    "message": "email is required"
  }
}

Other messages: "email is too long (max 254 characters)", "Invalid order ID", "Invalid request body".

On this page