Dokumentasi Resmi & Panduan Cara Pakai
KiosPage Pay adalah sistem Payment Gateway mandiri (self-hosted) yang menyediakan pembuatan tagihan QRIS Dinamis EMVCo (CRC16-CCITT), Virtual Account, E-Wallet, Gerai Retail, Payment Links tanpa coding, Double-Entry Ledger, Pencairan Dana (Payout), serta pengiriman Webhook bertanda tangan HMAC-SHA256.
https://pg.kiospage.com[email protected] / admin123checkout_url atau render qris_string -> Pembeli bayar / Webhook Mutasi masuk -> KiosPage Pay mengirim event payment.paid ke server Anda.2. Autentikasi API Key & Idempotency
Setiap merchant memiliki 2 lingkungan terpisah otomatis berdasarkan prefix Secret Key pada header Authorization: Bearer ... atau X-API-Key:
kpg_test_...: Masuk otomatis ke Mode Sandbox (saldo simulasi, tombol Simulasi Bayar Lunas aktif di checkout).kpg_live_...: Masuk ke Mode Live Production (mencatat saldo aktif asli, verifikasi via Webhook Mutasi HP/Manual).- Header opsional
Idempotency-Key: order-123menjamin request ulang akibat koneksi lambat mengembalikan invoice yang sama tanpa membuat tagihan ganda.
3. Membuat Transaksi Baru
curl -X POST "https://pg.kiospage.com/api/v1/transactions" \
-H "Authorization: Bearer kpg_test_demo_9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c" \
-H "Idempotency-Key: inv-20261206-001" \
-H "Content-Type: application/json" \
-d '{
"reference_id": "ORD-20261206-001",
"amount": 125000,
"channel_code": "QRIS_DYNAMIC",
"customer_name": "Aulia Rahma",
"customer_email": "[email protected]",
"customer_phone": "628123456789",
"fee_bearer": "customer",
"expiry_minutes": 60,
"redirect_url": "https://tokoku.kiospage.com/selesai",
"items": [
{ "name": "Paket Langganan Pro", "qty": 1, "price": 125000 }
]
}'
Contoh Respons JSON (201 Created):
{
"success": true,
"environment": "sandbox",
"data": {
"trx_id": "KPG-261206-91A2B3",
"reference_id": "ORD-20261206-001",
"status": "PENDING",
"channel_code": "QRIS_DYNAMIC",
"amount": 125000,
"fee_amount": 875,
"payable_amount": 125875,
"net_amount": 125000,
"qris_string": "00020101021226610014ID.CO.GOPAY.WWW...",
"checkout_url": "https://pg.kiospage.com/pay/KPG-261206-91A2B3",
"expires_at": "2026-12-06 14:30:00"
}
}
4. Daftar 12 Channel Pembayaran
| Kode Channel | Metode | Tarif Default | Settlement |
|---|---|---|---|
| QRIS_DYNAMIC | QRIS Dinamis EMVCo (All E-Wallet & Bank) | 0.7% | Realtime T+0 |
| QRIS_UNIQUE | QRIS Statis + 3 Digit Kode Unik Unik | Rp 0 (0%) | Realtime T+0 |
| EWALLET_GOPAY | GoPay App / GoPay Merchant | 1.5% | Realtime T+0 |
| EWALLET_DANA | DANA E-Wallet | 1.5% | Realtime T+0 |
| EWALLET_SHOPEEPAY | ShopeePay / SPayLater | 1.8% | H+1 Hari Kerja |
| EWALLET_OVO | OVO Push-to-Pay | 1.5% | H+1 Hari Kerja |
| VA_BCA | BCA Virtual Account | Rp 4.000 | Realtime T+0 |
| VA_BRI / VA_MANDIRI / VA_BNI | Virtual Account Bank Himbara | Rp 3.500 | Realtime T+0 |
| RETAIL_ALFAMART / RETAIL_INDOMARET | Kode Pembayaran Gerai Retail | Rp 5.000 | H+1 Hari Kerja |
5. Endpoint Manajemen Transaksi, Saldo & Payout
| Method & Path | Fungsi |
|---|---|
| GET /api/v1/transactions | Daftar riwayat transaksi (filter opsional ?status=PAID&limit=25) |
| GET /api/v1/transactions/{trx_id} | Cek detail & status pembayaran via trx_id atau reference_id |
| POST /api/v1/transactions/{trx_id}/cancel | Batalkan transaksi yang masih berstatus PENDING |
| POST /api/v1/transactions/{trx_id}/refund | Refund penuh/sebagian saldo transaksi PAID ({"amount":50000,"reason":"..."}) |
| GET /api/v1/channels | Ambil seluruh channel pembayaran aktif beserta tarifnya |
| POST /api/v1/fees/calculate | Kalkulasi estimasi biaya & net amount sebelum checkout |
| GET /api/v1/balance | Cek saldo aktif/sandbox merchant saat ini |
| POST /api/v1/payouts | Ajukan penarikan dana ke rekening Bank / E-Wallet |
6. Verifikasi Signature Webhook (HMAC-SHA256)
Setiap kali transaksi lunas (payment.paid) atau direfund (payment.refunded), KiosPage Pay mengirim request POST JSON ke Webhook URL Anda dengan header X-KPG-Signature: sha256=.... Wajib verifikasi signature ini agar tidak dipalsukan pihak luar.
Contoh Handler Webhook (PHP 8.x):
<?php
$rawPayload = file_get_contents('php://input');
$sentSig = $_SERVER['HTTP_X_KPG_SIGNATURE'] ?? '';
$whSecret = 'whsec_xxxxxxxxxxxxxxxxx'; // Ambil dari Console > API Keys
$expected = 'sha256=' . hash_hmac('sha256', $rawPayload, $whSecret);
if (!hash_equals($expected, $sentSig)) {
http_response_code(401);
exit('Invalid signature');
}
$event = json_decode($rawPayload, true);
if (($event['event'] ?? '') === 'payment.paid') {
$refId = $event['data']['reference_id'];
// TODO: Tandai pesanan lunas di database Anda!
}
http_response_code(200);
echo json_encode(['ok' => true]);
Contoh Handler Webhook (Node.js Express):
import crypto from 'crypto';
app.post('/webhook/kpg', express.raw({ type: 'application/json' }), (req, res) => {
const sig = req.header('X-KPG-Signature') || '';
const expected = 'sha256=' + crypto.createHmac('sha256', process.env.KPG_WEBHOOK_SECRET).update(req.body).digest('hex');
if (sig !== expected) return res.status(401).send('Invalid signature');
const evt = JSON.parse(req.body.toString());
if (evt.event === 'payment.paid') {
console.log('Lunas:', evt.data.trx_id, evt.data.reference_id);
}
res.json({ ok: true });
});
7. Cara Pakai Auto-Verifikasi Mutasi HP Android
Jika memakai QRIS pribadi/UMKM tanpa PG berbayar pihak ketiga, hubungkan aplikasi pembaca notifikasi Android (seperti MacroDroid atau forwarder notifikasi) agar mengirim teks notifikasi GoPay/BRI/DANA ke endpoint berikut:
POST https://pg.kiospage.com/api/v1/webhook/mutasi
Header: X-Mutasi-Secret: mutasi_kpg_xxxxxxxxxx
Body JSON:
{
"source_app": "GoPay Merchant",
"text": "Pembayaran QRIS diterima sebesar Rp 120.142"
}
Sistem otomatis membaca nominal 120142, mencocokkan invoice PENDING yang memiliki payable_amount = 120142, mengubah status jadi PAID, mengkredit saldo Ledger, dan memicu Outgoing Webhook!
8. Menjalankan Docker App Sendiri (Standalone / CasaOS)
# Clone / masuk ke folder project kiospage-pg cd kiospage-pg # Jalankan container PHP 8.5.13 FPM + Nginx terisolasi (port 18090) docker compose up -d --build # Cek healthcheck curl http://127.0.0.1:18090/health