Nomor Ajaib (Test Rules)
Konsep
Section titled “Konsep”Nomor Ajaib memungkinkan kamu mensimulasikan berbagai skenario tanpa setup manual:
- ✅ Success — transaksi berhasil
- ⏳ Pending — menunggu konfirmasi (memicu webhook tertunda)
- ❌ Failed — transaksi ditolak
- ⏰ Expired — tagihan/VA kadaluarsa
Cukup pakai nomor di bawah sebagai accountNo, customerNo, atau
virtualAccountNo. Tidak perlu membuat rule dulu — semuanya sudah aktif secara
global di sandbox.
Dua field yang berbeda
Section titled “Dua field yang berbeda”Setiap rule mengontrol dua field pada response, dan keduanya sering tertukar:
| Field | Panjang | Contoh | Arti |
|---|---|---|---|
responseCode | 7 digit | 4031714 | Hasil pemanggilan API |
latestTransactionStatus | 2 digit | 06 | Status transaksinya |
responseCode SNAP tersusun dari tiga bagian:
403 17 14│ │ └─ case code — kasusnya (14 = Insufficient Funds)│ └────────────── service code — endpoint yang dipanggil (17 = Transfer Intrabank)└─────────────────────── HTTP status — status HTTP response-nya juga 403Karena bagian tengahnya berbeda per endpoint, satu rule yang berlaku di banyak
endpoint menyimpan ** di posisi itu. snapdev mengganti ** dengan service
code endpoint yang sedang dipanggil saat response dibuat. Jadi rule yang
tersimpan sebagai 403**14 menjadi 4031714 di Transfer Intrabank dan
4035414 di Direct Debit Payment.
responseMessage mengikuti responseCode secara otomatis, memakai teks baku
dari tabel “Daftar Response Code” di spesifikasi SNAP. Status HTTP response juga
diambil dari tiga digit pertama — jadi rule 403**14 benar-benar membalas HTTP
403, bukan 200.
Rule bawaan
Section titled “Rule bawaan”| Nomor | Scope | Match type | responseCode | latestTransactionStatus | Webhook |
|---|---|---|---|---|---|
9999999999 | any | accountNo, customerNo | 200**00 — Successful | 00 Success | — |
8888888888 | any | accountNo, customerNo | 202**00 — Request In Progress | 03 Pending | success setelah 5 detik |
7777777777 | any | accountNo, customerNo | 403**05 — Do Not Honor | 06 Failed | failed langsung |
6666666666 | va | virtualAccountNo | 404**19 — Invalid Bill/Virtual Account | 05 Canceled | expired langsung |
5555555555 | transfer | accountNo | 403**14 — Insufficient Funds | 06 Failed | — |
Contoh: POST /bca/v1.0/transfer-intrabank dengan
sourceAccountNo: "7777777777" membalas HTTP 403 dengan
responseCode: "4031705" dan responseMessage: "Do Not Honor", lalu mengirim
webhook failed ke URL yang kamu daftarkan.
Tiga nomor pertama punya dua baris rule: satu accountNo untuk alur perbankan
dan satu customerNo untuk top up e-money. Keduanya perlu ada karena setiap
endpoint mencocokkan field yang berbeda — accountNo tidak akan pernah cocok
dengan request top up.
Custom Rules
Section titled “Custom Rules”Di admin panel kamu bisa membuat rule sendiri:
- Scope —
transfer,topup,va,qr,otc,bulk, atauany - Match Type —
accountNo,customerNo,virtualAccountNo, atauamount - Match Value — nilai yang dicocokkan
- Response Code — 7 digit, boleh memakai
**di posisi service code - Latest Status — status 2 digit yang dilaporkan endpoint status
- Webhook Event —
success,failed,expired, ataunone - Delay — jeda sebelum webhook dikirim, dalam detik
Rule milikmu sendiri selalu dievaluasi sebelum rule global, jadi kamu bisa menimpa nomor bawaan di atas untuk project-mu.
Contoh: VA yang baru terbayar setelah 30 detik
Section titled “Contoh: VA yang baru terbayar setelah 30 detik”- Buat rule: scope
va, match typevirtualAccountNo, match value12345678901234 - Set
responseCode202**00, latest status03, webhooksuccess, delay30 - Saat developer inquiry VA → HTTP 202,
responseCode2022400, status03 - Setelah 30 detik → webhook
successdikirim ke URL developer