Multi-Client Hub
Hubungkan tak terbatas website klien (SaaS, e-Commerce, LMS, Sekolah) menggunakan satu akun merchant DOKU.QRIS & Virtual Account
Mendukung QRIS nasional, BCA, Mandiri, BRI, BNI, D-Bank, serta e-Wallet lengkap via DOKU Checkout.HMAC SHA-256 Webhook
Validasi signature ketat & otomatis meneruskan callback pembayaran ke URL website klien masing-masing.Alur Transaksi Multi-Website
- Website Klien: Mengirim request
POST /api/v1/payment/createdengan signature HMAC-SHA256. - KlikBayar Hub: Memvalidasi kredensial klien, mencatat transaksi ke Cloudflare D1, dan mengontak API DOKU.
- DOKU Gateway: Menghasilkan invoice pembayaran resmi (Payment URL).
- Customer: Membuka
payment_urldan membayar lewat QRIS / Virtual Account. - Notifikasi DOKU: DOKU memanggil webhook
POST /doku/notificationdi KlikBayar. - Callback Terusan: KlikBayar memverifikasi keaslian DOKU lalu meneruskan status
PAIDke webhook website klien asal.
Simulasi Request Pembayaran Klien
Uji coba pembuatan order pembayaran seolah-olah dipanggil dari website aplikasi lain.
Panduan Integrasi Website Klien
Gunakan skrip PHP / Node.js berikut di website Anda untuk membuat pembayaran ke KlikBayar Hub.
1. Script Request Pembayaran (PHP)
<?php
$hubUrl = 'https://klikbayar.pages.dev/api/v1/payment/create';
$clientCode = 'nama_client_anda';
$apiKey = 'API_KEY_ANDA';
$apiSecret = 'API_SECRET_ANDA';
$payload = [
'client_order_id' => 'INV-' . time(),
'service_code' => 'PREMIUM-PLAN',
'amount' => 50000,
'customer_name' => 'Budi Yono',
'customer_email' => 'user@email.com',
'customer_phone' => '085729091981',
'custom_data' => ['plan' => 'Pro 1 Bulan']
];
$body = json_encode($payload);
$timestamp = date('c');
$signature = hash_hmac('sha256', $timestamp . '.' . $body, $apiSecret);
$ch = curl_init($hubUrl);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $body,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-CLIENT-CODE: ' . $clientCode,
'X-API-KEY: ' . $apiKey,
'X-TIMESTAMP: ' . $timestamp,
'X-SIGNATURE: ' . $signature
],
CURLOPT_RETURNTRANSFER => true
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!empty($res['ok']) && !empty($res['payment_url'])) {
header('Location: ' . $res['payment_url']);
exit;
}
?>
2. Script Menerima Callback / Webhook di Klien
<?php
$rawBody = file_get_contents('php://input');
$timestamp = $_SERVER['HTTP_X_TIMESTAMP'] ?? '';
$signature = $_SERVER['HTTP_X_SIGNATURE'] ?? '';
$expected = hash_hmac('sha256', $timestamp . '.' . $rawBody, $apiSecret);
if (!hash_equals($expected, $signature)) {
http_response_code(403);
exit('Invalid signature');
}
$data = json_decode($rawBody, true);
if ($data['status'] === 'PAID') {
// Berikan akses atau aktifkan langganan user
$orderId = $data['client_order_id'];
}
echo json_encode(['status' => 'OK']);
?>
Daftar Website Klien Terdaftar
Website yang memiliki otorisasi bertransaksi via KlikBayar| Client Code | Nama Aplikasi / Website | Webhook Callback URL | Status |
|---|---|---|---|
| ceofounder | CEO Founder Apps | https://ceo-founder.pages.dev/api/webhook |
Aktif |
| freelancourse | Freelancourse LMS | https://freelancourse.pages.dev/api/webhook |
Aktif |
| smpn1ringinrejo | SMPN 1 Ringinrejo Website | https://smpn1ringinrejo.sch.id/api/payment-callback |
Aktif |