Merchant orders

Review a merchant's orders in the Dashboard — list and filter them, open one for its full detail, and issue a refund.

An order is the record of something bought: its line items, its customer, and the transactions that paid for it. These endpoints back the Dashboard's orders screen.

Orders are created by every purchase path — a direct API charge, a completed checkout session, or a subscription renewal — so this is the one place that shows commerce across all of them. Refunding here reverses captured funds through the same provider that took the payment.

These endpoints power the Tokeflow Dashboard UI. They are session-authenticated (JWT bearer) — the token comes from signing in to the Dashboard, not from an sk_/pk_ API key. Requests also carry the x-merchant-id header identifying the merchant in context, and the signed-in user must be a member with access to it.


Endpoints

GET/api/v1/merchant/orders

Merchant

Auth: Dashboard session (JWT bearer). Merchant membership required.

List orders for merchant.

Query parameters

FieldTypeRequiredDescription
pagenumberNoPage number (1-indexed). Default 1, min 1.
limitnumberNoNumber of items per page. Default 20, min 1, max 100.
statusarrayNoComma-separated list of order statuses
order_typestringNoFilter by order type
recurrencestringNoFilter by recurrence
currencystringNoFilter by currency (ISO 4217)
searchstringNoSearch by order ID, customer name, email, or external order ID
start_datestringNoStart date (ISO 8601)
end_datestringNoEnd date (ISO 8601)
subscription_idstringNoFilter by subscription ID

Example request

curl -G https://api.tokeflow.com/api/v1/merchant/orders \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
  -H "x-merchant-id: mrc_8a3f12d9" \
  --data-urlencode "page=1" \
  --data-urlencode "limit=20" \
  --data-urlencode "status=['active']" \
  --data-urlencode "order_type=api"

GET/api/v1/merchant/orders/:id

Merchant

Auth: Dashboard session (JWT bearer). Merchant membership required.

Get order by ID.

Path parameters

FieldTypeRequiredDescription
idstringYes

Example request

curl https://api.tokeflow.com/api/v1/merchant/orders/obj_1a2b3c4d \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
  -H "x-merchant-id: mrc_8a3f12d9"

GET/api/v1/merchant/orders/:id/attempts/:attemptId/raw-response

Merchant

Auth: Dashboard session (JWT bearer). Merchant membership required.

Get raw PSP response for an attempt.

Path parameters

FieldTypeRequiredDescription
idstringYes
attemptIdstringYes

Example request

curl https://api.tokeflow.com/api/v1/merchant/orders/obj_1a2b3c4d/attempts/123/raw-response \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
  -H "x-merchant-id: mrc_8a3f12d9"

POST/api/v1/merchant/orders/:id/refund

Merchant

Auth: Dashboard session (JWT bearer). Merchant membership required.

Refund an order.

Path parameters

FieldTypeRequiredDescription
idstringYes

Request fields

FieldTypeRequiredDescription
amountnumberNoAmount to refund in minor units (partial refund). Omit for full refund.
reasonstringNoReason for refund. One of duplicate, fraudulent, requested_by_customer.

Example request

curl -X POST https://api.tokeflow.com/api/v1/merchant/orders/obj_1a2b3c4d/refund \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
  -H "x-merchant-id: mrc_8a3f12d9" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 15000,
    "reason": "requested_by_customer"
  }'

GET/api/v1/merchant/orders/:id/refunds

Merchant

Auth: Dashboard session (JWT bearer). Merchant membership required.

List refunds for an order.

Path parameters

FieldTypeRequiredDescription
idstringYes

Query parameters

FieldTypeRequiredDescription
pagenumberNoPage number (1-indexed). Default 1, min 1.
limitnumberNoNumber of items per page. Default 20, min 1, max 100.

Example request

curl -G https://api.tokeflow.com/api/v1/merchant/orders/obj_1a2b3c4d/refunds \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…" \
  -H "x-merchant-id: mrc_8a3f12d9" \
  --data-urlencode "page=1" \
  --data-urlencode "limit=20"

Errors

Errors use the standard envelope. The most common cases here:

HTTPMeaning
400Invalid parameters or a state that does not allow this operation.
401Missing, expired, or invalid Dashboard session token.
403Authenticated, but the signed-in user lacks access to this entity.
404The record does not exist or is not visible to this entity.

On this page