๐Ÿ“˜ Panduan Integrasi โ€” QRIS Gateway

Pilih skenario kamu lalu salin kode. API Secret ada di dashboard โ†’ tab Developer (atau .env).

Paling aman: proxy di backend (PHP)

API_SECRET tetap di server, tidak bocor ke browser. Salin contoh di folder examples/.

// 1) Frontend panggil proxy kamu const r = await fetch("/qris-proxy.php", { method:"POST", headers:{"Content-Type":"application/json"}, body: JSON.stringify({ amount:75000, title:"Produk X", redirect:"https://toko.com/sukses" }), }); const d = await r.json(); // d.payment_url -> redirect/iframe pembeli ke checkout QR
// 2) qris-proxy.php (di server kamu) memanggil gateway dengan secret require 'qris-sdk.php'; $gw = new QrisGateway('https://gateway-kamu.com', 'SB_xxxx'); $res = $gw->createInvoice((int)($_POST['amount']??75000), ['title'=>'Produk X']); // $res['json']['data']['payment_url']
Setelah LUNAS, gateway memanggil webhook_url kamu. Verifikasi: QrisGateway::verifyWebhook($rawBody, $secret, $headers['X-Signature']).

Proxy Express (Node)

API_SECRET disimpan di server. Contoh di folder examples/node-proxy.js.

const r = await fetch("http://localhost:4000/api/qris-create", { method:"POST", headers:{"Content-Type":"application/json"}, body: JSON.stringify({ amount:75000, title:"Produk X" }), }); const d = await r.json(); // { payment_url, id, total } // redirect pembeli ke d.payment_url, lalu cek status via GET /api/qris-status/:id

Drop-in widget (tanpa backend)

Cukup satu script. Gunakan di halaman yang kamu kendalikan.

<script src="https://gateway-kamu.com/widget.js"></script> <script> QWIS.button({ el:"pay", key:"SB_xxxx", amount:75000, title:"Produk X" }); </script> <div id="pay"></div>
// Tampilkan QR + status real-time di halaman sendiri (tanpa pindah halaman) QWIS.embed({ el:"qris", key:"SB_xxxx", amount:75000, onPaid:(data)=>{ /* kirim produk */ } });
Widget menaruh key di halaman. Untuk halaman publik, sebaiknya pakai proxy (Website PHP/Node) supaya secret aman.

Jualan lewat Bot Telegram

Tidak perlu API/Webhook โ€” sudah otomatis.

1) Dashboard โ†’ Checkout โ†’ QR Menu: isi produk Nama|Harga|Isi Digital Ebook|25000|https://x.com/ebook.pdf 2) Chat bot โ†’ /mulai โ†’ Menu Produk โ†’ pilih โ†’ bayar. 3) LUNAS โ†’ produk digital otomatis terkirim ke pembeli + notif kamu.

Sumber daya

Base URL: (halaman ini di-serve dari gateway)
Endpoint: POST /api/v1/invoice ยท GET /api/v1/invoice/:id ยท POST /api/v1/invoice/:id/cancel
Link instan: /pay?amount=75000&title=Produk%20X&redirect=https://.../sukses
Contoh file: folder examples/ (qris-sdk.php, php-proxy.php, node-proxy.js)