Customer picks the method
Create a payment with method any and let the customer pick QRIS or a virtual account on the payment page.
With method: "any", you don't pick the method. The customer opens checkout_url, picks QRIS or one of the VA banks, and pays.
Create the payment
curl https://pay.piti.id/v1/payments \
-H "Authorization: Bearer lbp_test_xxxxxxxx" \
-H "Idempotency-Key: order-1044" \
-H "Content-Type: application/json" \
-d '{
"amount": 350000,
"reference": "INV-1044",
"method": "any",
"expires_in": 259200,
"customer": { "name": "Budi Santoso" }
}'- Amount: whole rupiah from Rp1,000 to Rp50,000,000.
expires_in: 60 to 2592000 seconds (30 days), default 86400 (24 hours). Longer than a plain QRIS or VA payment, which suits invoices.- Don't send
va_bank; withmethod: "any"it is400 invalid_request. - If no method switched on for this app takes the amount, you get
409 method_disabled.
Which methods are offered
The payment page lists the methods that are switched on for your key's app (dashboard, Metode bayar) and take this amount:
- QRIS, for amounts up to Rp10,000,000.
- Each available VA bank, when its
totalis between Rp10,000 and Rp50,000,000.
Each option shows what the customer pays. For a VA bank where the customer pays the fee, the total includes the service fee. You can see the same list with GET /v1/methods?amount=: the methods with available: true.
The list is made when the customer opens the page, from the app's settings at that time. If every matching method has been switched off, the page tells the customer that no payment method is available. Switch the methods on again under Metode bayar.
Before the customer picks
The payment is pending, but has no QR or VA number yet:
{
"id": "pay_3G5g...",
"method": "any",
"status": "pending",
"amount": 350000,
"fee": 0,
"total": 350000,
"net": 350000,
"fee_payer": "merchant",
"qris": null,
"va": null,
"provider_ref": null,
"checkout_url": "https://pay.piti.id/pay/pay_3G5g..."
}fee, total, net and fee_payer are not final yet. Don't book these numbers.
When the customer picks
- The pick is final. The payment page tells the customer that the method cannot be changed once they continue.
methodbecomesqrisorva, andqrisorvais filled in as for any other payment.fee,total,netandfee_payerare set then, from the app's settings when the customer picks, not when the payment was created.- If the QR or VA cannot be made at that moment, the customer can pick again. Nothing was charged.
There is no webhook for the pick. Read the payment with GET /v1/payments/{id} when you need it. The payment.paid webhook data already has the final method and fee.
After a QRIS pick, the QR is renewed as usual while the payment is open (see QRIS). After a VA pick, the VA number is valid until the payment's expires_at (see Virtual account).
Expired without a pick
If the customer does not pick before expires_at, the status becomes expired with method still any, and we send payment.expired.
Related errors
| Error | When |
|---|---|
409 method_disabled | On create: no switched-on method takes this amount. |
409 not_qris | POST /v1/payments/{id}/qris before the customer picked QRIS. |
409 method_not_chosen | Simulating before the customer picked, where the method cannot be picked for you. |
In test mode, POST /v1/payments/{id}/simulate on an any payment that has no pick yet usually picks QRIS for you and pays it. See Testing.
Invoices
Invoices from the dashboard and recurring billing work the same way: by default the customer picks the method.