Skip to content

Identifiers

The prefixes of Baiyar identifiers, and how to work with them.


Every object has an id that starts with a prefix for its type, then _, then 26 characters (lowercase letters and digits). For example pay_01k7q3m8x2v5t9n4b6c1d0e7fa.

Prefix Object
mer_ Merchant
prj_ Project
apk_ API key
pay_ Payment
lnk_ Payment link
att_ Payment attempt
inv_ Invoice
whk_ Webhook endpoint
wev_ Webhook event
wdl_ Webhook delivery

Treat an id as an opaque string: store and compare the full value. Do not parse its length or the characters after the prefix. The prefix identifies the object type, and an ID is accepted only where that type is expected.

You do not choose ids: they are in the answer of the request that makes the object, in data. Keep the id of a payment with your order.

{ "data": { "id": "pay_01k7q3m8x2v5t9n4b6c1d0e7fa", "status": "pending", "merchant_reference": "order-1001" }, "meta": { "request_id": "req_…" } }

Put the id in the path: GET /v1/payments/pay_01k7q3m8x2v5t9n4b6c1d0e7fa. To find a payment by your own reference instead, list with the filter merchant_reference.

An object names the objects it belongs to by their ids: a payment has project_id, and payment_link_id when it was made through a link, and an event can be found by payment_id or payment_link_id.

GET /v1/events?payment_id=pay_01k7q3m8x2v5t9n4b6c1d0e7fa

An id is also its place in time: ids sort in the order the objects were made. Lists come newest first, and you page with the id of the last item you have (see Pagination).

Ids have the same form in the sandbox and in live, but an object belongs to one environment only: a sandbox payment id is not found with a live key.