Skip to content

Xendit Setup & Integration Guide

The xendit provider integrates Xendit Invoices (Virtual Accounts, E-Wallets, QRIS, Credit Cards, Retail Outlets) and Refunds across Southeast Asian markets (IDR, PHP, THB, VND, MYR, USD).


Kirak communicates with Xendit directly via async REST API calls with httpx. No external Xendit SDK or additional pip package is required.

Terminal window
pip install "kirak"

In the Xendit Dashboard:

  1. Navigate to Settings $\rightarrow$ API Keys.
  2. Create a secret key with write access to Money-in:
    • xnd_development_... (Test mode)
    • xnd_production_... (Live mode)

In Settings $\rightarrow$ Webhooks:

  1. Set the Invoices URL (Invoice Paid, Invoice Expired) and Refund URL (Refund Succeeded) to: https://your-domain.com/payments/webhook/xendit
  2. Copy the Verification Token (Xendit delivers this in the x-callback-token header).
{
"payments": {
"default_provider": "xendit",
"providers": {
"xendit": {
"type": "xendit",
"environment": "test",
"success_url": "https://your-domain.com/payment/success"
}
}
}
}

[!NOTE] The environment setting ("test" or "live") must match your key’s prefix (xnd_development_ or xnd_production_). A mismatch raises a CONFIGURATION_ERROR at startup.

Terminal window
KIRAK_PAYMENT_XENDIT_SECRET_KEY=xnd_development_...
KIRAK_PAYMENT_XENDIT_CALLBACK_TOKEN=your_verification_token_from_step2

Amounts are passed in minor units (e.g. for IDR, whole rupiah is sent to the gateway; pass minor-unit equivalents):

result = await kirak.payments.initiate_payment({
"provider": "xendit",
"user_id": "usr_900",
"amount": 150000, # Rp 150,000 IDR
"currency": "IDR",
"name": "E-Commerce Purchase",
"type": "one_time",
"payment_email": "buyer@example.co.id",
})
invoice_url = result["data"]["url"]
# Verify payment upon customer return:
await kirak.payments.verify_payment({
"provider": "xendit",
"payment_id": result["data"]["reference"],
})
# Issue refund (Admin / System only):
await kirak.payments.refund_payment({
"provider": "xendit",
"payment_id": "inv_xxxxxxxxxxxx",
"amount": 50000,
"currency": "IDR",
"idempotency_key": "refund-xnd-900-1",
})

Feature Support Status Notes
One-Time Invoices Supported Supports QRIS, OVO, Dana, Virtual Accounts, Cards
Refunds Supported Dispatched via /refunds endpoint
Subscriptions Not Supported Returns 501 NOT_SUPPORTED; Xendit Recurring API requires customer pre-linking
Disputes Not Supported Xendit does not offer a public programmatic disputes API
Saved Payment Methods Not Supported Returns 501 NOT_SUPPORTED

Normalized event Gateway Events Description
payment_completed invoice.paid Invoice paid via VA, QRIS, card, or e-wallet
payment_failed invoice.expired Invoice expired unpaid
refund_completed refund.succeeded Refund processed