Skip to content

Creating Payments

POST /v1/payments

Create a new payment request. Requires Basic KYC and an API key.

Request

POST https://api.tokencashflow.com/v1/payments
X-API-Key: tcf_live_...
Content-Type: application/json

Request body

FieldTypeRequiredDescription
amount_usddecimalYesPayment amount in USD. Minimum: 1.00. No maximum.
descriptionstringNoShown to the payer on the payment page. Max 500 characters.
redirect_urlstringNoHTTPS URL to redirect the payer to after the payment reaches COMPLETED.
allowed_token_idsarray of UUIDsNoRestrict the payer to a subset of your enabled tokens. Defaults to your full enabled set. Token UUIDs are available from GET /v1/payments/tokens.

Example request:

bash
curl -X POST https://api.tokencashflow.com/v1/payments \
  -H "X-API-Key: tcf_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "amount_usd": 150.00,
    "description": "Invoice #INV-2026-042",
    "redirect_url": "https://yourstore.com/order/complete?ref=INV-2026-042"
  }'

Response (201 Created)

FieldTypeDescription
payment_idUUIDUnique payment identifier
pay_urlstringThe payment page URL to share with your customer
statusstringAlways AWAITING_SELECTION on creation
amount_usddecimalPayment amount
selection_expires_atISO 8601 or nullNull on creation; set when payer confirms a token
created_atISO 8601Creation timestamp (UTC)

Payment status reference

StatusDescription
AWAITING_SELECTIONPayer has not selected a crypto yet — no countdown
AWAITING_PAYMENTPayer confirmed crypto and rate; selection_expires_at countdown running
PARTIALLY_PAIDSome funds received; payer can top up before selection window expires
EXPIRED_SELECTIONChain selection window expired; payer can return and reselect at current market rate
CONFIRMINGFull amount received; waiting for required block confirmations
CONFIRMEDConfirmations reached; sweep in progress
COMPLETEDSweep done and merchant account credited
BLACKLISTEDSender wallet address is on the platform blacklist
SWEEP_FAILEDAutomated sweep from payment wallet failed; admin intervention required
FAILEDSystem error; requires investigation

Payments never expire globally. Only the chain selection window (selection_expires_at) expires. EXPIRED_SELECTION is fully recoverable — the payer can always return to the payment link and reselect.

Customising the allowed crypto list

By default, every payment offers all cryptos you have enabled in Dashboard → Payment Settings → Enabled Tokens.

To restrict a specific payment to certain tokens, pass allowed_token_ids:

json
{
  "amount_usd": 100.00,
  "allowed_token_ids": [
    "a1b2c3d4-...",  // ETH on Ethereum
    "e5f6a7b8-..."   // USDT on Ethereum
  ]
}

Retrieve available token UUIDs from:

GET /v1/payments/tokens
X-API-Key: tcf_live_...

Listing and filtering payments

GET /v1/payments
X-API-Key: tcf_live_...

Query parameters:

ParameterTypeDescription
statusstringFilter by status (e.g. completed, expired)
date_fromISO 8601Only payments created on or after this date
date_toISO 8601Only payments created on or before this date
pageintegerPage number (default: 1)
per_pageintegerItems per page (default: 20, max: 100)

Response:

json
{
  "success": true,
  "data": {
    "payments": [ ... ],
    "pagination": {
      "page": 1,
      "per_page": 20,
      "total": 453,
      "total_pages": 23
    }
  }
}

Fetching a single payment

GET /v1/payments/{payment_id}
X-API-Key: tcf_live_...

Returns full payment detail including:

  • All state transition timestamps
  • Locked rate and required crypto amount (after payer confirms)
  • Received amounts
  • Fee breakdown
  • Linked sweep and transaction records

Unauthenticated status polling

The payer's payment page polls this endpoint every 5 seconds. No authentication required:

GET /v1/pay/{payment_id}/status

Returns only safe public fields: status, expires_at, selection_expires_at, total_received_crypto, required_crypto_amount.

selection_expires_at is null until the payer confirms a token selection; once set, this controls the countdown timer on the payment page.

TokenCashFlow Documentation