API keys & modes
How to send your API key, what decides test or live, and how keys belong to apps.
Send the key
Every call to the API carries your key as a Bearer token:
curl https://pay.piti.id/v1/methods \
-H "Authorization: Bearer lbp_test_xxxxxxxx"There is one base URL, https://pay.piti.id, for test and live. The API takes calls from your server only: it does not answer browser (CORS) calls, so never put a key in a web page or a mobile app.
The key decides the mode
| Prefix | Mode | Money |
|---|---|---|
lbp_test_ | test | none: you mark payments paid yourself (Testing) |
lbp_live_ | live | real |
Test and live are kept apart. A test key sees only test payments, refunds, events and its test webhook URL; a live key only live ones. Asking for a payment of the other mode gives 404 not_found. Every payment, refund and event has a mode field.
Keys belong to an app
An app is one integration (a website, a point of sale). Each app has its own keys and its own webhook URL, for test and for live.
- A payment made with a key belongs to that key's app (
app_idon the payment). - A key sees only its app's payments, refunds, events and webhook. Another app's payment is
404 not_found, the same as a payment that does not exist. - Events go to the webhook URL of the payment's app.
- The dashboard sees all apps.
Use separate apps when separate systems take payments, so each gets only its own events.
Manage keys
On the Developer page of the dashboard:
- Create a key (Buat kunci). The full key is shown once; we keep only a hash, so we cannot show it again. An app can have up to 10 active keys per mode.
- Replace a key. Making a new key does not stop the old one. Deploy the new key, then revoke the old one (Cabut kunci lama). The table shows when each key was last used.
- Revoke a key. It stops at once: calls with it get
401 unauthorized. - Archive an app. Its keys are revoked and its webhooks stop. This cannot be undone; to pause an app instead, turn it off (below).
The owner, admins and developers of your team can manage keys. Viewers cannot.
Live mode
Live keys work once your business verification is approved. The account owner fills it in in the dashboard (Verifikasi bisnis: business details, documents and the payout account) and can submit it once the account's email is confirmed; until then the Live switch is locked and live keys cannot be created. A live key that is used while live payments are not on for your business gets 403 live_not_enabled.
When a key is refused
| Status | Code | Why |
|---|---|---|
| 401 | unauthorized | No Authorization header, not Bearer lbp_test_... or Bearer lbp_live_..., or a wrong or revoked key. |
| 403 | live_not_enabled | A live key, but live payments are not on for your business yet. |
| 403 | app_disabled | The key's app is turned off in the dashboard. |
| 403 | account_suspended | Your business is suspended. Contact us. |
| 429 | rate_limited | More than 120 requests a minute with this key. |
Turning an app off
You can turn an app off and on again on the Developer page (Nonaktifkan / Aktifkan). While it is off:
- its keys, test and live, get
403 app_disabled; - payments already made can still be paid;
- its webhook events wait, and are sent in order once the app is on again.
Rate limit
Each key can make 120 requests a minute. Above that you get 429 rate_limited with a Retry-After header (seconds). Wait that long, then retry. Instead of asking for a payment's status in a loop, use webhooks.
See Errors for every code.