API Key
YOUR_API_KEY_HERE.
Base URL
Authentication
Semua request API harus menyertakan API Key di header:
X-API-Key: YOUR_API_KEY_HERE
Atau sebagai query parameter:
?apiKey=YOUR_API_KEY_HERE
Payment Endpoints
Membuat pembayaran baru dengan opsi produk digital, foto produk, dan redirect URL.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
amount |
number | Required | Nominal pembayaran (minimal Rp 1.000, maksimal Rp 500.000 untuk QRIS Admin) |
description |
string | Optional | Deskripsi pembayaran |
customer_name |
string | Optional | Nama pelanggan |
customer_email |
string | Optional | Email pelanggan |
customer_phone |
string | Optional | No. HP pelanggan |
callback_url |
string | Optional | URL webhook saat pembayaran sukses |
redirect_url |
string | Optional | URL redirect setelah pembayaran sukses New |
file_id |
number | Optional | ID file digital yang akan diberikan setelah bayar New |
content_id |
number | Optional | ID hidden content yang akan dibuka setelah bayar New |
product_image_id |
number | Optional | ID foto produk yang ditampilkan di halaman pembayaran New |
payment_method |
string | Optional | Metode pembayaran: qris, qris_user, gopay_qris, ovo, atau all (default: qris) |
use_qris_converter |
boolean | Optional | Aktifkan QRIS Converter untuk membuat QRIS dinamis dengan nominal tertanam (default: false) New |
qris_string |
string | Optional | String QRIS statis untuk dikonversi (jika use_qris_converter true). Jika tidak disediakan, akan menggunakan QRIS dari pengaturan akun New |
Example Request (cURL)
curl -X POST https://bayar.gg/api/create-payment.php \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-d '{
"amount": 50000,
"description": "Pembayaran Produk A",
"customer_name": "John Doe",
"customer_email": "john@example.com",
"redirect_url": "https://yoursite.com/thank-you",
"file_id": 1,
"product_image_id": 1
}'
Example Request dengan QRIS Converter (cURL)
curl -X POST https://bayar.gg/api/create-payment.php \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-d '{
"amount": 50000,
"description": "Pembayaran Produk A",
"use_qris_converter": true,
"qris_string": "00020101021126570011ID.DANA.WWW..."
}'
Example Request (PHP)
<?php
$apiKey = 'YOUR_API_KEY_HERE';
$data = [
'amount' => 50000,
'description' => 'Pembayaran Produk A',
'customer_name' => 'John Doe',
'redirect_url' => 'https://yoursite.com/thank-you',
'file_id' => 1, // Optional: attach digital file
'product_image_id' => 1, // Optional: show product image
'use_qris_converter' => true, // Optional: enable QRIS converter
'qris_string' => '00020101...' // Optional: QRIS to convert
];
$ch = curl_init('https://bayar.gg/api/create-payment');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'X-API-Key: ' . $apiKey
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$result = json_decode($response, true);
echo $result['data']['payment_url'];
// If QRIS Converter enabled, show QR image
if (isset($result['data']['qris_converter'])) {
echo $result['data']['qris_converter']['qr_image_url'];
}
?>
Example Response
{
"success": true,
"data": {
"invoice_id": "403-PAY-1234567890-ABC123",
"amount": 50000,
"unique_code": 123,
"final_amount": 50123,
"payment_url": "https://bayar.gg/pay?invoice=403-PAY-1234567890-ABC123",
"expires_at": "2024-01-15 12:30:00",
"status": "pending",
"redirect_url": "https://yoursite.com/thank-you",
"payment_method": "qris",
"has_file": true,
"file_id": 1,
"has_product_image": true,
"product_image_id": 1,
"download_token": "abc123..."
}
}
Example Response dengan QRIS Converter
{
"success": true,
"data": {
"invoice_id": "403-PAY-1234567890-ABC123",
"amount": 50000,
"unique_code": 123,
"final_amount": 50123,
"payment_url": "https://bayar.gg/pay?invoice=403-PAY-1234567890-ABC123",
"expires_at": "2024-01-15 12:30:00",
"status": "pending",
"payment_method": "qris",
"qris_converter": {
"enabled": true,
"converted_qris": "00020101021226570011...",
"qr_image_url": "https://bayar.gg/bri-qris-dinamis/api/qr.php?text=..."
}
}
}
qris- QRIS BRI Admin (default, maks. Rp 500.000)qris_user- QRIS BRI User (memerlukan verifikasi + konfigurasi BRI, tanpa limit)gopay_qris- GoPay Merchant QRIS (memerlukan verifikasi + akun GoPay Merchant terhubung, tanpa limit) Newovo- OVO (memerlukan verifikasi + akun OVO terhubung)all- Semua metode yang tersedia (maks. Rp 500.000 karena termasuk QRIS Admin)
Aktifkan use_qris_converter: true untuk membuat QRIS dinamis dengan nominal tertanam otomatis.
- Jika
qris_stringdisediakan, akan menggunakan QRIS tersebut - Jika tidak, akan menggunakan QRIS dari pengaturan akun Anda
- Response akan menyertakan
qris_converter.converted_qrisdanqris_converter.qr_image_url
Untuk metode pembayaran qris dan all, maksimal nominal adalah Rp 500.000. Untuk nominal lebih besar, gunakan metode qris_user atau gopay_qris dengan QRIS merchant Anda sendiri.
- Fitur dinonaktifkan oleh admin (maintenance)
- Akun belum terverifikasi (untuk qris_user, gopay_qris, dan ovo)
- Konfigurasi API belum lengkap
/api/get-payment-methods untuk mengecek ketersediaan.
Mengecek status pembayaran berdasarkan Invoice ID.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
invoice |
string | Required | Invoice ID pembayaran |
Example Request
curl "https://bayar.gg/api/check-payment?invoice=403-PAY-1234567890-ABC123" \
-H "X-API-Key: YOUR_API_KEY_HERE"
Example Response
{
"success": true,
"invoice_id": "403-PAY-1234567890-ABC123",
"status": "paid",
"amount": 50000,
"final_amount": 50123,
"paid_at": "2024-01-15 12:25:30",
"expires_at": "2024-01-15 12:30:00"
}
Mendapatkan daftar pembayaran dengan filter, search, dan pagination.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
search |
string | Optional | Cari berdasarkan invoice, deskripsi, nama/email/HP pelanggan New |
status |
string | Optional | Filter by status: pending, paid, expired, cancelled |
payment_method |
string | Optional | Filter by method: qris, qris_user, gopay_qris, ovo, all New |
paid_via |
string | Optional | Filter pembayaran sukses by method: qris, qris_user, gopay_qris, ovo New |
start_date |
string | Optional | Filter dari tanggal (YYYY-MM-DD) |
end_date |
string | Optional | Filter sampai tanggal (YYYY-MM-DD) |
page |
number | Optional | Halaman (default: 1) |
limit |
number | Optional | Jumlah per halaman (default: 20, max: 100) |
Example Request
curl "https://bayar.gg/api/list-payments?status=paid&limit=10" \
-H "X-API-Key: YOUR_API_KEY_HERE"
Example Response
{
"success": true,
"data": [
{
"invoice_id": "403-PAY-1234567890-ABC123",
"amount": 50000,
"unique_code": 123,
"final_amount": 50123,
"status": "paid",
"description": "Pembayaran Produk A",
"customer_name": "John Doe",
"payment_url": "https://bayar.gg/pay?invoice=403-PAY-1234567890-ABC123",
"created_at": "2024-01-15 12:00:00",
"paid_at": "2024-01-15 12:25:30",
"has_file": true,
"file_id": 1
}
],
"pagination": {
"total": 50,
"page": 1,
"limit": 10,
"total_pages": 5
}
}
Account & Status Endpoints New
Mendapatkan daftar metode pembayaran dan status ketersediaan.
Example Request
curl "https://bayar.gg/api/get-payment-methods" \
-H "X-API-Key: YOUR_API_KEY_HERE"
Example Response
{
"success": true,
"data": {
"payment_methods": [
{
"id": "qris",
"name": "QRIS",
"description": "Pembayaran via QRIS BRI (Admin)",
"enabled": true,
"available": true,
"maintenance": false,
"requirements": [],
"icon": "bi-qr-code-scan"
},
{
"id": "qris_user",
"name": "QRIS User",
"description": "Pembayaran via QRIS BRI Anda sendiri",
"enabled": true,
"available": true,
"verified_only": true
},
{
"id": "gopay_qris",
"name": "GoPay Merchant QRIS",
"description": "Pembayaran via QRIS GoPay Merchant Anda",
"enabled": true,
"available": true,
"maintenance": false,
"requirements": [],
"verified_only": true,
"has_bri_configured": true,
"has_qris_image": true
},
{
"id": "ovo",
"name": "OVO",
"enabled": true,
"available": true,
"verified_only": true,
"has_ovo_connected": true
}
],
"user_status": {
"is_verified": true,
"has_ovo_connected": true,
"has_bri_configured": true,
"has_qris_image": true
},
"feature_status": {
"qris": true,
"qris_user": true,
"gopay_qris": true,
"ovo": true
}
}
}
Mendapatkan status akun, integrasi, dan ringkasan statistik.
Example Request
curl "https://bayar.gg/api/get-account-status" \
-H "X-API-Key: YOUR_API_KEY_HERE"
Example Response
{
"success": true,
"data": {
"account": {
"username": "johndoe",
"email": "john@example.com",
"is_verified": true,
"is_active": true
},
"integrations": {
"ovo": {
"connected": true,
"phone": "+62812****5678"
},
"bri_qris_user": {
"configured": true,
"mid": "123456789",
"has_qris_image": true
},
"gopay_merchant": {
"connected": true,
"outlet_name": "Merchant Name",
"outlet_id": "outlet-id-123",
"has_qris_image": true,
"qris_image_url": "https://bayar.gg/uploads/qris/qris_johndoe_abc123.jpg"
}
},
"statistics": {
"total_payments": 150,
"paid_payments": 120,
"total_revenue": 15000000,
"revenue_qris": 10000000,
"revenue_qris_user": 3000000,
"revenue_gopay": 1500000,
"revenue_ovo": 2000000
}
}
}
Mendapatkan statistik pembayaran detail dengan breakdown per metode.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
period |
string | Optional | Periode statistik: all, today, week, month, year (default: all) |
Example Request
curl "https://bayar.gg/api/get-statistics?period=month" \
-H "X-API-Key: YOUR_API_KEY_HERE"
Example Response
{
"success": true,
"data": {
"period": "month",
"summary": {
"total_payments": 150,
"pending": 10,
"paid": 120,
"expired": 15,
"cancelled": 5,
"total_revenue": 15000000,
"total_unique_codes": 12000,
"conversion_rate": 80
},
"revenue_by_method": {
"qris": { "count": 80, "revenue": 10000000 },
"qris_user": { "count": 25, "revenue": 3000000 },
"gopay_qris": { "count": 10, "revenue": 1500000 },
"ovo": { "count": 15, "revenue": 2000000 }
},
"daily_stats": [
{ "date": "2024-01-15", "total": 20, "paid": 18, "revenue": 2000000 }
],
"recent_payments": [
{
"invoice_id": "403-PAY-1234567890-ABC123",
"amount": 50000,
"paid_via": "qris",
"paid_at": "2024-01-15 12:25:30"
}
]
}
}
Digital Products Endpoints
Mendapatkan daftar file digital yang sudah diupload.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
active_only |
boolean | Optional | Hanya file aktif (default: true) |
Example Request
curl "https://bayar.gg/api/list-files" \
-H "X-API-Key: YOUR_API_KEY_HERE"
Example Response
{
"success": true,
"data": [
{
"id": 1,
"original_name": "ebook.pdf",
"file_type": "pdf",
"file_size": 1048576,
"is_active": true,
"download_count": 10,
"created_at": "2024-01-15 10:00:00"
}
],
"total": 1
}
Mendapatkan daftar hidden content yang sudah dibuat.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
active_only |
boolean | Optional | Hanya konten aktif (default: true) |
Example Request
curl "https://bayar.gg/api/list-contents" \
-H "X-API-Key: YOUR_API_KEY_HERE"
Example Response
{
"success": true,
"data": [
{
"id": 1,
"title": "Secret Tutorial",
"content_type": "text",
"is_active": true,
"view_count": 25,
"created_at": "2024-01-15 10:00:00"
}
],
"total": 1
}
Mendapatkan daftar foto produk yang sudah diupload.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
active_only |
boolean | Optional | Hanya gambar aktif (default: true) |
Example Request
curl "https://bayar.gg/api/list-images" \
-H "X-API-Key: YOUR_API_KEY_HERE"
Example Response
{
"success": true,
"data": [
{
"id": 1,
"original_name": "product.jpg",
"image_url": "https://bayar.gg/uploads/images/product_1_xxx.jpg",
"file_size": 524288,
"mime_type": "image/jpeg",
"width": 800,
"height": 600,
"is_active": true,
"created_at": "2024-01-15 10:00:00"
}
],
"total": 1
}
QRIS Converter Endpoints New
Mengkonversi QRIS statis ke QRIS dinamis dengan nominal tertanam. Support input text QRIS atau gambar QRIS.
Request Body (JSON)
| Parameter | Type | Required | Description |
|---|---|---|---|
nominal |
number | Required | Nominal yang akan ditanam di QRIS (dalam Rupiah) |
qris |
string | Pilih salah satu | String QRIS yang akan dikonversi |
image |
string | Pilih salah satu | Base64 encoded gambar QR code |
image_url |
string | Pilih salah satu | URL gambar QR code |
File Upload (Multipart Form Data)
| Field | Type | Description |
|---|---|---|
nominal |
number | Nominal yang akan ditanam |
image |
file | File gambar QR code (JPEG, PNG, GIF, WebP) |
Example Request (String QRIS)
curl -X POST https://bayar.gg/api/qris-convert.php \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-d '{
"qris": "00020101021126570011ID.DANA.WWW...",
"nominal": 50000
}'
Example Request (Image URL)
curl -X POST https://bayar.gg/api/qris-convert.php \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-d '{
"image_url": "https://example.com/qris.png",
"nominal": 50000
}'
Example Request (File Upload)
curl -X POST https://bayar.gg/api/qris-convert.php \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-F "image=@/path/to/qris.png" \
-F "nominal=50000"
Example Response
{
"success": true,
"data": {
"original_qris": "00020101021126570011...",
"converted_qris": "00020101021226570011...540550000...",
"nominal": 50000,
"merchant_name": "TOKO ABC",
"merchant_city": "JAKARTA",
"crc": "A1B2",
"qr_image_url": "https://bayar.gg/bri-qris-dinamis/api/qr.php?text=...",
"original_info": {
"is_static": true,
"is_dynamic": false,
"original_amount": null,
"country_code": "ID"
}
}
}
qr_image_url untuk menampilkan QR code yang sudah dikonversi langsung di aplikasi Anda.
Mendapatkan informasi dari QRIS tanpa mengkonversinya. Berguna untuk validasi dan preview.
Query Parameters (GET)
| Parameter | Type | Required | Description |
|---|---|---|---|
qris |
string | Required | String QRIS untuk dianalisis |
Example Request
curl "https://bayar.gg/api/qris-info.php?qris=00020101021126570011..." \
-H "X-API-Key: YOUR_API_KEY_HERE"
Example Response
{
"success": true,
"data": {
"qris": "00020101021126570011...",
"is_valid": true,
"merchant_name": "TOKO ABC",
"merchant_city": "JAKARTA",
"is_static": true,
"is_dynamic": false,
"current_amount": null,
"country_code": "ID",
"postal_code": "12345",
"merchant_pan": "9360001234567890123",
"merchant_id": "ID1234567890123",
"merchant_criteria": "UMI"
}
}
OVO Integration New
Cara Kerja OVO Payment
Integrasi OVO memungkinkan Anda menerima pembayaran langsung ke akun OVO Anda dengan pencocokan nominal otomatis.
Langkah Setup
- Buka menu Pengaturan → Hubungkan OVO
- Masukkan nomor OVO Anda dan verifikasi dengan kode OTP
- Masukkan PIN OVO untuk menyelesaikan koneksi
- Setelah terhubung, Anda dapat membuat pembayaran dengan metode OVO
Cara Kerja Pencocokan
| Step | Proses |
|---|---|
| 1 | Customer membayar ke nomor OVO Anda dengan nominal yang tepat (termasuk kode unik) |
| 2 | Sistem mengecek mutasi OVO setiap beberapa detik |
| 3 | Jika ditemukan transaksi masuk dengan nominal yang cocok, pembayaran otomatis dikonfirmasi |
| 4 | Callback dikirim ke URL yang Anda tentukan |
Contoh Request dengan OVO
curl -X POST https://bayar.gg/api/create-payment.php \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-d '{
"amount": 50000,
"description": "Pembayaran Produk A",
"payment_method": "ovo"
}'
QRIS User Integration New
Cara Kerja QRIS User
QRIS User memungkinkan Anda menerima pembayaran langsung ke rekening BRI Anda sendiri dengan QRIS merchant Anda.
Keuntungan QRIS User
- Dana langsung ke rekening Anda - Tidak perlu proses withdrawal
- QRIS merchant Anda sendiri - Menggunakan credentials BRI API Anda
- Real-time detection - Pembayaran dideteksi otomatis via BRI API
Langkah Setup
- Pastikan akun Anda sudah terverifikasi
- Buka menu BRI QRIS Merchant di dashboard
- Masukkan kredensial BRI API Anda (Host, Username, Password, MID, TID)
- Test koneksi untuk memastikan API berfungsi
- Upload gambar QRIS merchant Anda
- Setelah terhubung, Anda dapat membuat pembayaran dengan metode
qris_user
Contoh Request dengan QRIS User
curl -X POST https://bayar.gg/api/create-payment.php \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-d '{
"amount": 50000,
"description": "Pembayaran Produk A",
"payment_method": "qris_user"
}'
GoPay Merchant QRIS Integration New
Cara Kerja GoPay Merchant QRIS
GoPay Merchant QRIS memungkinkan Anda menerima pembayaran langsung ke akun GoPay Merchant Anda sendiri menggunakan QRIS.
Keuntungan GoPay Merchant QRIS
- Dana langsung ke GoPay Anda - Tidak perlu proses withdrawal
- QRIS GoPay Merchant - Menggunakan akun GoPay Merchant Anda sendiri
- Real-time detection - Pembayaran dideteksi otomatis via GoPay Merchant API
- Tanpa limit nominal - Tidak ada batasan Rp 500.000 seperti QRIS Admin
Langkah Setup
- Pastikan akun Anda sudah terverifikasi
- Buka menu GoPay Merchant QRIS di dashboard
- Capture token dari GoPay Merchant App menggunakan HTTP Inspector
- Paste JSON token + device info di halaman koneksi
- Upload gambar QRIS GoPay Merchant Anda
- Setelah terhubung, buat pembayaran dengan metode
gopay_qris
Contoh Request dengan GoPay Merchant QRIS
curl -X POST https://bayar.gg/api/create-payment.php \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY_HERE" \
-d '{
"amount": 50000,
"description": "Pembayaran Produk A",
"payment_method": "gopay_qris"
}'
Response
{
"success": true,
"payment": {
"invoice_id": "PAY-admin-1234567890-ABC123",
"amount": 50000,
"unique_code": 347,
"final_amount": 50347,
"payment_method": "gopay_qris",
"status": "pending",
"expires_at": "2026-02-15 12:30:00"
},
"payment_url": "https://bayar.gg/pay?invoice=PAY-admin-1234567890-ABC123"
}
Webhook & Callback
Callback
Jika Anda menyertakan callback_url saat membuat pembayaran, sistem akan mengirim POST request ke URL tersebut saat pembayaran berhasil.
Callback Payload
{
"event": "payment.paid",
"invoice_id": "403-PAY-1234567890-ABC123",
"status": "paid",
"amount": 50000,
"final_amount": 50123,
"unique_code": 123,
"paid_at": "2024-01-15 12:25:30",
"paid_amount": 50123,
"paid_reff_num": "TRX123456789",
"customer_name": "John Doe",
"customer_email": "john@example.com",
"customer_phone": "08123456789",
"description": "Pembayaran Produk A",
"redirect_url": "https://yoursite.com/thank-you",
"has_file": true,
"has_content": false,
"download_token": "abc123...",
"timestamp": 1705312530,
"signature": "sha256_hmac_signature"
}
Callback Headers
| Header | Description |
|---|---|
Content-Type |
application/json |
X-Webhook-Event |
payment.paid |
X-Webhook-Signature |
HMAC SHA256 signature untuk verifikasi |
X-Webhook-Timestamp |
Unix timestamp saat callback dikirim |
X-Invoice-ID |
Invoice ID pembayaran |
Verifikasi Signature
<?php
// Verifikasi callback signature
$payload = json_decode(file_get_contents('php://input'), true);
$signature = $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? '';
$timestamp = $_SERVER['HTTP_X_WEBHOOK_TIMESTAMP'] ?? '';
// Buat signature untuk verifikasi
$signatureData = $payload['invoice_id'] . '|' . $payload['status'] . '|' . $payload['final_amount'] . '|' . $timestamp;
$expectedSignature = hash_hmac('sha256', $signatureData, 'YOUR_SECRET_KEY');
if (hash_equals($expectedSignature, $signature)) {
// Signature valid, proses callback
if ($payload['status'] === 'paid') {
// Update order status
http_response_code(200);
echo json_encode(['success' => true]);
}
} else {
// Signature tidak valid
http_response_code(401);
echo json_encode(['error' => 'Invalid signature']);
}
?>
Payment Status
| Status | Description |
|---|---|
| pending | Menunggu pembayaran |
| paid | Pembayaran berhasil |
| expired | Pembayaran expired (melebihi batas waktu) |
| cancelled | Pembayaran dibatalkan |
Error Codes
| HTTP Code | Description |
|---|---|
200 |
Success |
400 |
Bad Request - Parameter tidak valid |
401 |
Unauthorized - API Key tidak valid |
404 |
Not Found - Resource tidak ditemukan |
405 |
Method Not Allowed |
429 |
Too Many Requests - Rate limit exceeded |
500 |
Internal Server Error |