Coinland PayDocs
API reference

Sessions

POST/api/pay/v1/sessions

Create server-side, then send the customer to checkout_url (or pass id to the embed script).

Price the order in ONE of two ways — send amounts or price_usd, never both and never neither (PAY_AMOUNT_INVALID, 422):

  • amounts — you name the figure in each coin you accept, and the customer picks one. Coinland converts nothing: you price, the customer pays exactly that.
  • price_usd — you name one USD figure and Coinland quotes it in every coin you accept, at the live rate, at creation time. Those quotes ARE the rate lock and the session's own expires_at is its window; there is no separate rate-lock timer. A coin with no live rate is omitted from the quotes; if nothing can be priced the request is refused with PAY_RATE_UNAVAILABLE (503).

Authorization

bearerKey
AuthorizationBearer <token>

Authorization: Bearer clpay_live_<64 hex> for the checkout routes, Authorization: Bearer clpay_payout_<64 hex> for the payout routes. The wrong class on a route is PAY_WRONG_KEY_KIND (403).

A key may additionally carry an IP allowlist set in the business console. Empty (the default) places no restriction; with entries, a call from an unlisted address is UNAUTHORIZED (401).

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/pay/v1/sessions" \  -H "Content-Type: application/json" \  -d '{    "reference_id": "string",    "title": "string",    "customer": {      "id": "string",      "name": "string",      "email": "string"    }  }'
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "reference_id": "string",  "status": "open",  "title": "string",  "description": "string",  "amounts": [    {      "currency": "string",      "amount": "string",      "usd_value": "string"    }  ],  "pricing_mode": "usd",  "price_usd": "string",  "checkout_url": "http://example.com",  "return_url": "string",  "cancel_url": "string",  "metadata": {},  "payment": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "receipt_no": "string",    "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82",    "reference_id": "string",    "status": "completed",    "currency": "string",    "amount": "string",    "charged_amount": "string",    "fee_amount": "string",    "fee_bearer": "merchant",    "net_amount": "string",    "usd_value": "string",    "payer_id": "7bded2ff-6743-4a0e-a147-77540fb16606",    "metadata": {},    "receipt": "string",    "paid_at": "2019-08-24T14:15:22Z"  },  "expires_at": "2019-08-24T14:15:22Z",  "created_at": "2019-08-24T14:15:22Z"}
GET/api/pay/v1/sessions/{id}

Authoritative state. When completed, the payment summary is embedded.

Authorization

bearerKey
AuthorizationBearer <token>

Authorization: Bearer clpay_live_<64 hex> for the checkout routes, Authorization: Bearer clpay_payout_<64 hex> for the payout routes. The wrong class on a route is PAY_WRONG_KEY_KIND (403).

A key may additionally carry an IP allowlist set in the business console. Empty (the default) places no restriction; with entries, a call from an unlisted address is UNAUTHORIZED (401).

In: header

Path Parameters

id*string

Session id (UUID) or your reference_id.

Response Body

application/json

application/json

curl -X GET "https://example.com/api/pay/v1/sessions/string"
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "reference_id": "string",  "status": "open",  "title": "string",  "description": "string",  "amounts": [    {      "currency": "string",      "amount": "string",      "usd_value": "string"    }  ],  "pricing_mode": "usd",  "price_usd": "string",  "checkout_url": "http://example.com",  "return_url": "string",  "cancel_url": "string",  "metadata": {},  "payment": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "receipt_no": "string",    "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82",    "reference_id": "string",    "status": "completed",    "currency": "string",    "amount": "string",    "charged_amount": "string",    "fee_amount": "string",    "fee_bearer": "merchant",    "net_amount": "string",    "usd_value": "string",    "payer_id": "7bded2ff-6743-4a0e-a147-77540fb16606",    "metadata": {},    "receipt": "string",    "paid_at": "2019-08-24T14:15:22Z"  },  "expires_at": "2019-08-24T14:15:22Z",  "created_at": "2019-08-24T14:15:22Z"}
POST/api/pay/v1/sessions/{id}/cancel

Idempotent — cancelling a cancelled session returns it unchanged. A completed session cannot be cancelled (PAY_SESSION_STATE, 409): money that has moved stays moved.

Authorization

bearerKey
AuthorizationBearer <token>

Authorization: Bearer clpay_live_<64 hex> for the checkout routes, Authorization: Bearer clpay_payout_<64 hex> for the payout routes. The wrong class on a route is PAY_WRONG_KEY_KIND (403).

A key may additionally carry an IP allowlist set in the business console. Empty (the default) places no restriction; with entries, a call from an unlisted address is UNAUTHORIZED (401).

In: header

Path Parameters

id*string

Session id (UUID) or your reference_id.

Response Body

application/json

application/json

curl -X POST "https://example.com/api/pay/v1/sessions/string/cancel"
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "reference_id": "string",  "status": "open",  "title": "string",  "description": "string",  "amounts": [    {      "currency": "string",      "amount": "string",      "usd_value": "string"    }  ],  "pricing_mode": "usd",  "price_usd": "string",  "checkout_url": "http://example.com",  "return_url": "string",  "cancel_url": "string",  "metadata": {},  "payment": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "receipt_no": "string",    "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82",    "reference_id": "string",    "status": "completed",    "currency": "string",    "amount": "string",    "charged_amount": "string",    "fee_amount": "string",    "fee_bearer": "merchant",    "net_amount": "string",    "usd_value": "string",    "payer_id": "7bded2ff-6743-4a0e-a147-77540fb16606",    "metadata": {},    "receipt": "string",    "paid_at": "2019-08-24T14:15:22Z"  },  "expires_at": "2019-08-24T14:15:22Z",  "created_at": "2019-08-24T14:15:22Z"}