Xendit compatibility mode
Move from Xendit's Invoice API by changing only the base URL and the secret key.
If your system already uses Xendit's Invoice API, you don't need to rewrite your integration. Turn on Xendit mode for an app, change the base URL and the secret key, and your code keeps working. The customer pays on our payment page and picks QRIS or a virtual account.
Turning it on
Open the Kompatibilitas tab
In the dashboard, pick test or live mode. Open Developer, pick the app, then the Kompatibilitas tab. Live mode opens once your business verification is approved.
Enter the callback URL
In the Mode Xendit panel, enter the URL callback: the address in your system that receives Xendit's invoice callbacks today. It must be https (http only in test mode) and point to a public address. Click Aktifkan mode Xendit.
Save the credentials
The dashboard shows two values, once:
| Secret key | Replaces your Xendit key. xnd_development_... in test mode, xnd_production_... in live mode. We store only its fingerprint. |
| Callback token | Sent in the x-callback-token header of every callback. Owners and admins can show it again on the Webhook tab (Tampilkan secret). |
Change the base URL and key
# Before
XENDIT_BASE_URL=https://api.xendit.co
XENDIT_SECRET_KEY=xnd_development_xxxxxxxx # key from Xendit
# Now
XENDIT_BASE_URL=https://pay.piti.id
XENDIT_SECRET_KEY=xnd_development_xxxxxxxx # key from usIf your system checks the callback token, swap in our callback token too.
The secret key shows in the app's key list and can be revoked there. While the app is switched off, this key stops working too (403).
Changing the URL or the key
Change the URL callback and click Simpan & buat kunci baru. You get a new secret key and callback token. The old ones stop working at once.
Turning it off
Click Matikan mode Xendit. The key is revoked and callbacks stop. Payments already made stay recorded. The normal webhook doesn't come back by itself: save the webhook URL again on the Webhook tab.
Authentication
As with Xendit: Basic auth with the secret key as the user name and an empty password.
curl https://pay.piti.id/v2/invoices \
-u "xnd_development_xxxxxxxx:" \
-H "Content-Type: application/json" \
-d '{
"external_id": "INV-1042",
"amount": 150000,
"description": "Order 1042",
"payer_email": "budi@example.com",
"invoice_duration": 86400,
"success_redirect_url": "https://your-shop.id/orders/1042"
}'A Xendit key works only on the Xendit endpoints, and an lbp_ key only on /v1. The key's prefix decides the mode (test or live).
Supported endpoints
| Endpoint | What it does |
|---|---|
POST /v2/invoices (also /v2/invoices/) | Create an invoice. Answers 200 with the invoice. |
GET /v2/invoices/{id} | Get one invoice. |
GET /v2/invoices?external_id=... | Find invoices. Answers an array, newest first. |
POST /invoices/{id}/expire! (also /v2/... and without the !) | Close a PENDING invoice now. Answers the invoice with status EXPIRED. |
POST /v2/invoices fields
| Field | Rules |
|---|---|
external_id | Required, up to 64 characters. Not unique: each POST makes a new invoice. |
amount | Required. Whole rupiah. 150000.0 is accepted, 1000.5 is refused. |
currency | IDR only. |
invoice_duration | Seconds. Default 86,400 (24 hours), at most 2,592,000 (30 days). |
description | Up to 255 characters. |
payer_email | Optional. |
customer | given_names, surname, email, mobile_number. |
success_redirect_url | The "back" link after the customer pays. |
metadata | Any object. |
Accepted and ignored: items, fees, payment_methods, failure_redirect_url, should_send_email, reminders, notification preferences, locale, channel_properties, mid_label.
GET /v2/invoices
| Parameter | |
|---|---|
external_id | Invoices with this external_id. |
statuses | PENDING, PAID or EXPIRED. Repeated, comma-separated, or a JSON array. |
limit | 1 to 100, default 10. |
The invoice object
{
"id": "pay_xxxxxxxx",
"external_id": "INV-1042",
"user_id": "mch_xxxxxxxx",
"status": "PENDING",
"merchant_name": "Your Shop",
"merchant_profile_picture_url": "",
"amount": 150000,
"payer_email": "budi@example.com",
"description": "Order 1042",
"expiry_date": "2026-12-01T03:05:58.000Z",
"invoice_url": "https://pay.piti.id/pay/pay_xxxxxxxx",
"available_banks": [
{ "bank_code": "MANDIRI", "collection_type": "POOL", "transfer_amount": 150000,
"bank_branch": "Virtual Account", "account_holder_name": "Your Shop", "identity_amount": 0 }
],
"available_retail_outlets": [],
"available_ewallets": [],
"available_qr_codes": [{ "qr_code_type": "QRIS" }],
"available_direct_debits": [],
"available_paylaters": [],
"should_exclude_credit_card": true,
"should_send_email": false,
"created": "2026-11-30T03:05:58.000Z",
"updated": "2026-11-30T03:05:58.000Z",
"currency": "IDR",
"success_redirect_url": "https://your-shop.id/orders/1042"
}idis our payment id (pay_...).invoice_urlis our payment page. Send the customer there.available_bankshas one row per VA bank switched on for your app (MANDIRI,BRI,BNI,BSI,CIMB,PERMATA). Maybank and Danamon have no code in Xendit's Invoice API, so they are left out of this list. Once the customer picks a method, only that one shows (Maybank asMAYBANK, Danamon asDANAMON).- Times are UTC with milliseconds, as Xendit's.
- Once paid, the invoice adds
paid_amount,paid_at,payment_method(BANK_TRANSFERorQR_CODE),payment_channel(the bank orQRIS),bank_codeandpayment_destination(the VA number).
Statuses
| Status | Meaning |
|---|---|
PENDING | Waiting for payment. |
PAID | Paid. Stays PAID after a refund. |
EXPIRED | Expired, failed, or past expiry_date. |
SETTLED is never used.
An invoice closed with expire can still become PAID if a payment arrives afterwards, for example a transfer to a VA the customer was already given.
Callbacks
We send a JSON POST to your callback URL when an invoice is paid (PAID) and when it expires (EXPIRED), with the x-callback-token header. There is no LayerbeatPay-Signature header.
{
"id": "pay_xxxxxxxx",
"external_id": "INV-1042",
"user_id": "mch_xxxxxxxx",
"is_high": false,
"status": "PAID",
"merchant_name": "Your Shop",
"amount": 150000,
"payer_email": "budi@example.com",
"description": "Order 1042",
"created": "2026-11-30T03:05:58.000Z",
"updated": "2026-11-30T03:12:10.000Z",
"currency": "IDR",
"success_redirect_url": "https://your-shop.id/orders/1042",
"paid_amount": 150000,
"paid_at": "2026-11-30T03:12:10.000Z",
"payment_method": "BANK_TRANSFER",
"payment_channel": "MANDIRI",
"bank_code": "MANDIRI",
"payment_destination": "8xxxxxxxxxxxxxxx",
"payment_id": "pay_xxxxxxxx"
}- Check
x-callback-tokenagainst your callback token with a constant-time comparison. amountis the invoice amount.paid_amountis what the customer paid, including the VA fee when that fee is charged to the customer.- Answer 2xx. Delivery uses the same machinery as webhooks: in order, retried on failure (1 minute up to 24 hours), never to private addresses, and listed in the dashboard's Webhook log with a resend button.
- Delivery is at least once. The same callback can arrive more than once. Skip duplicates by
idandstatus. EXPIREDcan be followed byPAIDwhen the customer pays late.- Only Xendit invoices get callbacks. Payments this app makes through
/v1while Xendit mode is on get neither a callback nor a webhook.
Errors
The same shape as Xendit's: {"error_code": "...", "message": "..."}.
| Status | error_code | When |
|---|---|---|
| 400 | API_VALIDATION_ERROR | Invalid fields, or expire on an invoice that isn't PENDING. |
| 400 | NO_COLLECTION_METHODS_ERROR | No switched-on method takes this amount. |
| 401 | INVALID_API_KEY | No key, a wrong or revoked key, or not a Xendit key. |
| 403 | REQUEST_FORBIDDEN_ERROR | The app is switched off, the business is suspended, or live is not enabled. |
| 404 | INVOICE_NOT_FOUND_ERROR | No such invoice for this key. |
| 429 | RATE_LIMIT_EXCEEDED | Over 120 requests a minute. See Retry-After. |
| 500 | SERVER_ERROR | Our error. |
Not supported
- Other Xendit APIs: Fixed VA, QR Code, direct e-wallets, cards, payouts.
- The
SETTLEDstatus: a paid invoice is alwaysPAID. - An
external_idlonger than 64 characters. - The ignored fields above, for example
payment_methods(the customer picks from the app's switched-on methods) andshould_send_email(we don't send emails). - Test events. Use test mode and pay the invoice on its payment page. See Testing.
A Xendit-mode invoice is an ordinary payment with source: "xendit". It shows in Pembayaran (Payments) in the dashboard, and can be read through /v1 with an lbp_ key of the same app.