LetsPay
Skip to content

API reference

Authentication, invoice requests, responses, service credit and errors.

Address and authentication

Send requests from your server to https://api.letspay.today/v1. Existing integrations can keep using https://go.letspay.today/v1. Both addresses share credentials, invoice IDs and order history. Always redirect buyers to the checkout_url returned by the API.

Use the project API key in the Authorization: Bearer header. Send invoice and top-up requests as application/json. In the examples, LETSPAY_API_KEY and LETSPAY_TEST_KEY are server environment variables.

Create an invoice

POST /v1/invoices accepts three fields. order_id is your stable reference, 1–100 characters from A–Z, a–z, 0–9, dot, underscore and hyphen. currency is the project’s EUR, USD or RUB billing currency. amount_minor is an integer from 1 to 10,000,000,000 in cents or kopecks. For €24.50 send 2450 and EUR.

A successful request returns HTTP 201. Retrying the same order_id, amount and currency for the same project returns the original invoice, including after a timeout or expiry. Use a new order reference only when you intend to issue a new invoice.

cURL
curl --request POST https://api.letspay.today/v1/invoices \
  --header "Authorization: Bearer $LETSPAY_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{"order_id":"order-1042","currency":"EUR","amount_minor":2450}'
HTTP 201 · JSON
{
  "id": "DEMO_0123456789abcdefghijklmnopq",
  "order_id": "order-1042",
  "currency": "EUR",
  "amount_minor": 2450,
  "status": "open",
  "checkout_url": "https://go.letspay.today/pay/DEMO_0123456789abcdefghijklmnopq",
  "expires": 1800007200,
  "observation": {"state":"open","transactions":[],"network_stale":false}
}

Read an invoice

GET /v1/invoices/{id} returns the invoice for the authenticated project. expires is a Unix timestamp in seconds. status covers open, partial, expired, review and paid. observation.state can also be confirming while the network finalizes a transfer.

observation.transactions contains hashes and explorer URLs when available. confirmations and required can be null. network_stale flags delayed observation data. For settled customer invoices, delivered indicates whether the store has acknowledged the webhook.

cURL
curl "https://api.letspay.today/v1/invoices/$INVOICE_ID" \
  --header "Authorization: Bearer $LETSPAY_API_KEY"

Service credit endpoints

These endpoints apply to prepaid projects. Amounts use the project’s minor currency units. fee_bps is the agreed rate in basis points (100 = 1%). A sale can return fee_minor and fee_bps when its fee is reserved.

GET /v1/billing
Read balance_minor, reserved_minor, available_minor, fee_bps and accepting.
GET /v1/billing/entries
Newest entries first. limit is 1–100 (default 50). Pass next_before as before for the next page.
POST /v1/billing/topups
Create a credit top-up with order_id, currency and amount_minor. The reference is independent of sales.
GET /v1/billing/topups/{id}
Read the top-up invoice using its LetsPay ID.

Errors and retries

Read the HTTP status first. Some errors also include a JSON error code. On a timeout or temporary outage, retry with the same order and a delay between attempts.

402
insufficient_advance — top up the project and retry.
404
Check the ID, project credentials and whether the billing plan applies.
409
invoice_conflict — that order reference already has different terms. Inspect the original order.
400 / 415
Check the field types, project currency and JSON content type.
401 / 403
Check the bearer key and whether the project is accepting payments (store_paused).
429 / 503
Wait before retrying. The service can limit test events or pending top-ups, or temporarily pause issuance. The API allows 8 requests per second per IP, with bursts of up to 30 additional requests shared across both API hostnames. For HTTP 429, wait for Retry-After when present, then retry with the original order_id.