Skip to Content
Paycose Docs
Setup

Core concepts

The resource model, identifiers, livemode, pagination, idempotency, the API version, expand, and multi-tenancy basics every integrator should know.

A few conventions hold across the whole API. Learn them once and every endpoint behaves predictably.

Resources and objects

Every resource is a JSON object with a stable id and an object field naming its type (charge, customer, invoice, …). Related resources are referenced by flat *_id fields (e.g. customer_id, invoice_id) which you can hydrate on demand — see expand.

Live vs test (livemode)

Test and live data are stored separately. Your secret key decides which one a request reaches — sk_test_ keys test data, sk_live_ keys live data — and every object reports it in the livemode boolean. See Authentication → Test and live mode.

Pagination

List endpoints return a page of objects at a time, newest first. You page with cursors (limit, starting_after, ending_before). Lists also take filters, a sort order and a search term. See Pagination.

Pass ?expand[]=customer&expand[]=invoice on a retrieve or list call to receive related objects in full instead of only their ids. Objects are expanded only when you ask. See the dedicated expand guide.

Idempotency

Send an Idempotency-Key header with a POST and you can retry it safely: for 24 hours a retry with the same key and the same request gets the first result back instead of running again. Reusing a key for a different request is refused with 409 (E1401). See Idempotency.

API versions

The API is versioned by date, and each secret key and webhook endpoint is pinned to a version. Today there is one, 2026-11-01: every request made with a secret key is answered in it, and every webhook endpoint receives its events in it. You may send Paycose-Version: 2026-11-01, but you don't have to. See API versions.

Asynchronous actions (next_action)

Some payments cannot complete in a single request — a QR code must be scanned, or the buyer must be redirected to authorize. These responses include a next_action array describing what the client should do next (display a QR, open a redirect URL, confirm inline). The final state arrives later via webhooks. Poll or listen for the webhook rather than blocking on the original request.

Multi-tenancy: applications & countries

PaymentGateway is multi-tenant. An account can belong to several applications, and an application can operate in multiple countries. A secret key belongs to one application, and every request names the country it acts in with the X-Country header (a two-letter code such as TH). See Authentication.

What's next

On this page