Skip to Content

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 keyReplaces your Xendit key. xnd_development_... in test mode, xnd_production_... in live mode. We store only its fingerprint.
Callback tokenSent 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

.env
# 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 us

If 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).

Replaces the app's webhook

While Xendit mode is on for an app and mode, that app's normal webhooks are not sent. Events still waiting for the old webhook URL are marked failed. An app can use only one compatibility mode: turning Xendit on turns Duitku mode off, and the other way round.

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.

Create an invoice
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

EndpointWhat 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

FieldRules
external_idRequired, up to 64 characters. Not unique: each POST makes a new invoice.
amountRequired. Whole rupiah. 150000.0 is accepted, 1000.5 is refused.
currencyIDR only.
invoice_durationSeconds. Default 86,400 (24 hours), at most 2,592,000 (30 days).
descriptionUp to 255 characters.
payer_emailOptional.
customergiven_names, surname, email, mobile_number.
success_redirect_urlThe "back" link after the customer pays.
metadataAny 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_idInvoices with this external_id.
statusesPENDING, PAID or EXPIRED. Repeated, comma-separated, or a JSON array.
limit1 to 100, default 10.

The invoice object

Invoice (PENDING)
{
  "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"
}
  • id is our payment id (pay_...). invoice_url is our payment page. Send the customer there.
  • available_banks has 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 as MAYBANK, Danamon as DANAMON).
  • Times are UTC with milliseconds, as Xendit's.
  • Once paid, the invoice adds paid_amount, paid_at, payment_method (BANK_TRANSFER or QR_CODE), payment_channel (the bank or QRIS), bank_code and payment_destination (the VA number).

Statuses

StatusMeaning
PENDINGWaiting for payment.
PAIDPaid. Stays PAID after a refund.
EXPIREDExpired, 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.

PAID callback
{
  "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-token against your callback token with a constant-time comparison.
  • amount is the invoice amount. paid_amount is 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 id and status.
  • EXPIRED can be followed by PAID when the customer pays late.
  • Only Xendit invoices get callbacks. Payments this app makes through /v1 while Xendit mode is on get neither a callback nor a webhook.

Errors

The same shape as Xendit's: {"error_code": "...", "message": "..."}.

Statuserror_codeWhen
400API_VALIDATION_ERRORInvalid fields, or expire on an invoice that isn't PENDING.
400NO_COLLECTION_METHODS_ERRORNo switched-on method takes this amount.
401INVALID_API_KEYNo key, a wrong or revoked key, or not a Xendit key.
403REQUEST_FORBIDDEN_ERRORThe app is switched off, the business is suspended, or live is not enabled.
404INVOICE_NOT_FOUND_ERRORNo such invoice for this key.
429RATE_LIMIT_EXCEEDEDOver 120 requests a minute. See Retry-After.
500SERVER_ERROROur error.

Not supported

  • Other Xendit APIs: Fixed VA, QR Code, direct e-wallets, cards, payouts.
  • The SETTLED status: a paid invoice is always PAID.
  • An external_id longer than 64 characters.
  • The ignored fields above, for example payment_methods (the customer picks from the app's switched-on methods) and should_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.