Duitku compatibility mode
Move from Duitku API v2 by changing only the base URL, merchantCode and apiKey.
If your system already uses Duitku API v2, including Duitku's plugins, you don't need to rewrite your integration. Turn on Duitku mode for an app, change the base URL, merchantCode and apiKey, and your code keeps working. The paths stay the same, and callbacks still go to the callbackUrl of each transaction.
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.
Turn on Duitku mode
In the Mode Duitku panel, click Aktifkan mode Duitku. No URL is needed: Duitku sends callbackUrl with each transaction.
Save the credentials
merchantCode | D followed by 7 characters, for example DXXXXXXX. Stays visible on the Kompatibilitas tab. |
apiKey | 32 hex characters. Shown once. |
Each mode has its own merchantCode. The merchantCode decides whether a transaction is in test or live mode.
Change the base URL and credentials
# Before
DUITKU_BASE_URL=https://sandbox.duitku.com # or https://passport.duitku.com
DUITKU_MERCHANT_CODE=Dxxxxxxx
DUITKU_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Now
DUITKU_BASE_URL=https://pay.piti.id
DUITKU_MERCHANT_CODE=DXXXXXXX # from us
DUITKU_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # from usMaking a new apiKey
Click Buat apiKey baru. We make a new apiKey and the old one stops working at once. Your merchantCode, transactions and callbacks stay the same; later callbacks are signed with the new apiKey.
Turning Duitku mode off and on again gives a new merchantCode.
Turning it off
Click Matikan mode Duitku. The credentials are 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.
Signatures
We accept two signature schemes on every request:
- MD5: older integrations, such as Duitku's PHP SDK. MD5 of the joined fields followed by the
apiKey. - HMAC-SHA256: current integrations, such as Duitku's WooCommerce plugin since October 2026. Keyed with the
apiKey, over the joined fields.
All signatures are hex. A callback is signed the same way as that transaction's inquiry.
| Request | MD5 | HMAC-SHA256 (key: apiKey) |
|---|---|---|
v2/inquiry | md5(merchantCode + merchantOrderId + paymentAmount + apiKey) | merchantCode + merchantOrderId + paymentAmount |
transactionStatus | md5(merchantCode + merchantOrderId + apiKey) | merchantCode + merchantOrderId |
getpaymentmethod | sha256(merchantcode + amount + datetime + apiKey) | merchantcode + amount + datetime |
| Callback | md5(merchantCode + amount + merchantOrderId + apiKey) | merchantCode + amount + merchantOrderId |
For getpaymentmethod, the older scheme is plain SHA-256, not MD5, as in Duitku.
Supported endpoints
All are POST with a JSON body, on https://pay.piti.id.
| Endpoint | What it does |
|---|---|
/webapi/api/merchant/v2/inquiry | Create a transaction. The VA or QRIS is made at once. |
/webapi/api/merchant/transactionStatus | Check a transaction's status. |
/webapi/api/merchant/paymentmethod/getpaymentmethod | List the switched-on methods for an amount. |
Inquiry
{
"merchantCode": "DXXXXXXX",
"paymentAmount": 150000,
"paymentMethod": "M2",
"merchantOrderId": "ORD-1042",
"productDetails": "Order 1042",
"customerVaName": "Budi Santoso",
"email": "budi@example.com",
"phoneNumber": "0812xxxxxxx",
"callbackUrl": "https://your-shop.id/duitku/callback",
"returnUrl": "https://your-shop.id/orders/1042",
"expiryPeriod": 60,
"signature": "..."
}| Field | Rules |
|---|---|
paymentAmount | Whole rupiah, a number or a numeric string. The method's amount limits apply (a VA from Rp10,000, QRIS up to Rp10,000,000). |
paymentMethod | See payment codes. |
merchantOrderId | Required, up to 64 characters, unique per merchantCode. |
callbackUrl | Required. https and a public address (http allowed in test mode). |
expiryPeriod | Minutes, 1 to 1,440 (24 hours). Default 24 hours. |
productDetails, additionalParam, merchantUserInfo, customerVaName, email, phoneNumber, returnUrl | Optional. |
itemDetails, customerDetail and accountLink are ignored.
{
"merchantCode": "DXXXXXXX",
"reference": "pay_xxxxxxxx",
"paymentUrl": "https://pay.piti.id/pay/pay_xxxxxxxx",
"vaNumber": "8xxxxxxxxxxxxxxx",
"qrString": "",
"amount": "150000",
"statusCode": "00",
"statusMessage": "SUCCESS"
}referenceis our payment id.paymentUrlis our payment page.- For a VA,
vaNumberis set. For QRIS,qrStringis set. - The QRIS code in
qrStringworks for only a few minutes. ThepaymentUrlpage renews it by itself. If you showqrStringyourself, send the customer topaymentUrlonce the code expires. amountis always yourpaymentAmount. When the VA fee is charged to the customer, the customer transfers the total (amount plus fee) shown on the payment page and the VA, butamountin the answer, the status and the callback stayspaymentAmount.
transactionStatus
{ "merchantCode": "DXXXXXXX", "merchantOrderId": "ORD-1042", "signature": "..." }{
"merchantOrderId": "ORD-1042",
"reference": "pay_xxxxxxxx",
"amount": "150000",
"fee": "...",
"statusCode": "01",
"statusMessage": "PROCESS"
}statusCode | statusMessage | Meaning |
|---|---|---|
00 | SUCCESS | Paid. Stays 00 after a refund. |
01 | PROCESS | Waiting for payment. |
02 | EXPIRED | Expired or failed. |
getpaymentmethod
{ "merchantcode": "DXXXXXXX", "amount": 150000, "datetime": "2026-11-30 10:00:00", "signature": "..." }Answers {"paymentFee": [...], "responseCode": "00", "responseMessage": "SUCCESS"}. Each row has paymentMethod, paymentName, paymentImage and totalFee. Only the methods switched on for your app that take the amount are listed. QRIS is listed as SP.
Payment codes
| Code | Result |
|---|---|
M2 | Mandiri VA |
BR | BRI VA |
BV | BSI VA |
B1 | CIMB Niaga VA |
BT | Permata VA |
I1 | BNI VA |
VA | Maybank VA |
DM | Danamon VA |
SP NQ DQ GQ SQ LQ OV SA DA LA LF SL OL | QRIS. Payable from any bank or e-wallet app. |
Any other code is refused with 400 "Payment channel XX is not available.", never switched to another method. That includes VA banks we don't support yet (BC, NC, A1, AG, S1), retail (FT, IR, A2), cards (VC, MG), paylater (DN, AT), BK, JP and T1 to T3.
A method switched off in Metode bayar for that app is refused too.
Callbacks
When a transaction is paid, we send a POST to that transaction's callbackUrl, with Content-Type: application/x-www-form-urlencoded.
| Field | |
|---|---|
merchantCode | Your merchantCode. |
amount | The transaction's paymentAmount. |
merchantOrderId | Your order id. |
productDetail | From productDetails. |
additionalParam | From the inquiry. |
paymentCode | The method code from the inquiry, for example M2. |
resultCode | 00. |
merchantUserId | From merchantUserInfo. |
reference, publisherOrderId | Our payment id. |
spUserHash | Empty. |
signature | See Signatures. |
<?php
$apiKey = getenv('DUITKU_API_KEY');
$merchantCode = $_POST['merchantCode'] ?? '';
$amount = $_POST['amount'] ?? '';
$merchantOrderId = $_POST['merchantOrderId'] ?? '';
$signature = $_POST['signature'] ?? '';
// Older integrations (MD5):
$expected = md5($merchantCode . $amount . $merchantOrderId . $apiKey);
// Current integrations (HMAC-SHA256):
// $expected = hash_hmac('sha256', $merchantCode . $amount . $merchantOrderId, $apiKey);
if (!hash_equals($expected, $signature)) {
http_response_code(400);
exit('bad signature');
}
if (($_POST['resultCode'] ?? '') === '00') {
// Mark order $merchantOrderId paid (skip if it already is).
}
http_response_code(200);- 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, so handle an order that is already paid safely.
- There is no callback for an expired or failed transaction. Check with
transactionStatus.
Errors
The shape is {"Message": "...", "statusMessage": "..."}.
| Status | When |
|---|---|
| 400 | Invalid fields, a refused method code, a merchantOrderId already used, or an amount outside the method's limits. |
| 401 | Unknown merchantCode or a wrong signature. |
| 403 | The app is switched off, the business is suspended, or live is not enabled. |
| 404 | merchantOrderId not found. |
| 429 | Too many requests. See Retry-After. |
| 500 | Our error. |
Not supported
- Duitku endpoints other than the three above.
- Method codes other than those in the table.
- Callbacks for expired or failed transactions.
- A
merchantOrderIdover 64 characters, and anexpiryPeriodover 1,440 minutes. itemDetails,customerDetailandaccountLink(ignored).- Test events. Use test mode and pay the transaction at its
paymentUrl. See Testing.
A Duitku-mode transaction is an ordinary payment with source: "duitku". It shows in Pembayaran (Payments) in the dashboard, and can be read through /v1 with an lbp_ key of the same app.