Introduction
The KitaPay API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
You can use the KitaPay API in test mode, which does not affect your live data or interact with the banking networks. The API key you use to authenticate the request determines whether the request is live mode or test mode.
Authentication
The KitaPay API uses API keys to authenticate requests. You can view and manage your API keys in the KitaPay Dashboard.
Authentication to the API is performed via HTTP Bearer Auth. Provide your API key as the bearer token value.
Errors
KitaPay uses conventional HTTP response codes to indicate the success or failure of an API request.
| 2xx | Indicates success. |
| 400 | Bad Request. The request was unacceptable, often due to missing a required parameter. |
| 401 | Unauthorized. No valid API key provided. |
| 404 | Not Found. The requested resource doesn't exist. |
| 5xx | Server errors. Something went wrong on KitaPay's end. |
Create Payment
POSTCreates a new payment transaction. This endpoint generates a QRIS string or payment link depending on your configuration.
Body Parameters
merchantIdrequiredThe unique identifier of your merchant account, available in your dashboard.
amountrequiredThe amount intended to be collected by this payment. Must be a positive integer in IDR.
externalIdrequiredA unique string referencing this payment in your own system. Prevents duplicate payments.
targetWebhookUrlThe URL where KitaPay will send a POST request when the payment status changes (e.g. successfully paid).
Snap UI Integration
Once a payment is created via the backend API, you can display the KitaPay Snap UI to your customers. It's a ready-to-use checkout interface that securely handles the QRIS display and status polling.
Opening the Snap Popup
In your frontend (React, Vue, or Vanilla JS), simply open a popup window pointing to the Snap URL using the transaction.id you received from the Create Payment API.
Listening for Success Events
The Snap window will communicate back to your main window via the browser's postMessage API when a payment succeeds.
Webhooks
Webhooks allow you to build or set up integrations which subscribe to certain events on KitaPay. When one of those events is triggered, we'll send a HTTP POST payload to the webhook's configured URL.
You must always rely on Webhooks to update the order status in your database, as frontend callbacks (like Snap UI postMessage) can be manipulated or interrupted if the user closes their browser early.
