Skip to Content

Create an order

Create an order and its Lightning invoice.

POST
/v1/orders

Authorization

bearer
headerAuthorizationBearer <token>

Your secret API key, cp_live_…, created in the merchant console.

Header Parameters

idempotency-key*string

16–128 letters, digits, _ or -. Use a new UUID for each order and reuse it when retrying.

Request Body

application/json
  1. body
slug*string

Pay link the order belongs to. It must be one of your pay links.

amountUsdCents*integer

Amount in US cents, from 100 ($1.00) to 1000000 ($10,000.00).

Range100 <= value <= 1000000
reference*string

Your own order number, up to 128 characters. It is returned as is and does not need to be unique.

Lengthlength <= 128
successUrl?string

HTTPS URL the checkout page sends the customer to after payment.

Match^https://
Formaturi
Lengthlength <= 2048
cancelUrl?string

HTTPS URL behind the checkout page's “Return to store” link while the order is unpaid.

Match^https://
Formaturi
Lengthlength <= 2048

Response Body

Order

application/json
  1. response
id*string

Order ID, a UUID.

slug*string

Pay link the order belongs to. It must be one of your pay links.

reference*string

The reference you sent.

amountUsdCents*integer

Amount in US cents, from 100 ($1.00) to 1000000 ($10,000.00).

Range100 <= value <= 1000000
amountSat*integer

Amount in satoshis, quoted when the order was created. The invoice is for exactly this amount.

Range1 <= value <= 9007199254740
status*string

pending until the invoice is paid or expires. paid is final. An expired order can still become paid if a late payment arrives.

Value in"pending""paid""expired"
invoice*string

BOLT11 Lightning invoice. Show it yourself or send the customer to checkoutUrl.

checkoutUrl*string

Hosted checkout page for this order.

successUrl*|

The success URL you sent, or null.

cancelUrl*|

The cancel URL you sent, or null.

createdAt*string

When the order was created. ISO 8601, UTC.

expiresAt*string

When the invoice expires, one hour after creation. ISO 8601, UTC.

paidAt*|

When the payment arrived, or null. ISO 8601, UTC.

Example Request
curl -X POST 'https://api.cashpayment.co/v1/orders' \  -H 'Authorization: Bearer cp_live_xxx' \  -H 'idempotency-key: 5f2b7c1e-9a4d-4e8b-b1c3-7d6e0a9f2c41' \  -H 'Content-Type: application/json' \  -d '{  "slug": "onne",  "amountUsdCents": 1500,  "reference": "WC-10234"}'
Example Response
{  "id": "12345678-1234-4234-8234-123456789abc",  "slug": "onne",  "reference": "WC-10234",  "amountUsdCents": 1500,  "amountSat": 15000,  "status": "pending",  "invoice": "lnbc150u1p5...",  "checkoutUrl": "https://www.cashpayment.co/invoice/12345678-1234-4234-8234-123456789abc",  "successUrl": "https://shop.example.com/thanks",  "cancelUrl": "https://shop.example.com/cart",  "createdAt": "2026-11-17T12:00:00.000Z",  "expiresAt": "2026-11-17T13:00:00.000Z",  "paidAt": null}