BAYAR GG Docs

API Documentation

Dokumentasi lengkap REST API untuk integrasi Payment Gateway — QRIS, GoPay Merchant, OVO, dan multi e-wallet.

API Key

Info: Login untuk melihat API Key Anda. Contoh di bawah menggunakan placeholder YOUR_API_KEY_HERE.
YOUR_API_KEY_HERE
Penting: Jangan bagikan API Key Anda kepada siapapun. API Key digunakan untuk mengautentikasi request ke API.

Base URL

Semua request API menggunakan base URL berikut:

https://www.bayar.gg/api

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

MethodEndpointDescription
POST/api/create-payment.phpMembuat pembayaran baru
GET/api/check-payment.phpCek status pembayaran
GET/api/list-payments.phpDaftar pembayaran dengan filter & pagination
POST /api/create-payment.php

Membuat pembayaran baru dengan opsi produk digital, foto produk, dan redirect URL.

Request Body

ParameterTypeRequiredDescription
amountnumberRequiredNominal pembayaran (minimal Rp 1.000, maksimal Rp 500.000 untuk QRIS Admin)
descriptionstringOptionalDeskripsi pembayaran
customer_namestringOptionalNama pelanggan
customer_emailstringOptionalEmail pelanggan
customer_phonestringOptionalNo. HP pelanggan
callback_urlstringOptionalURL webhook saat pembayaran sukses
redirect_urlstringOptionalURL redirect setelah pembayaran sukses New
file_idnumberOptionalID file digital yang akan diberikan setelah bayar New
content_idnumberOptionalID hidden content yang akan dibuka setelah bayar New
product_image_idnumberOptionalID foto produk yang ditampilkan di halaman pembayaran New
payment_methodstringOptionalMetode pembayaran: qris, qris_user, gopay_qris, atau ovo (default: qris)
use_qris_converterbooleanOptionalAktifkan QRIS Converter untuk membuat QRIS dinamis dengan nominal tertanam (default: false). QRIS string otomatis diambil dari akun yang terhubung (GoPay Merchant / BRI QRIS) sesuai metode pembayaran.
Payment Method:
  • qris — QRIS (default, maks. Rp 500.000)
  • qris_user — BRI QRIS (memerlukan langganan aktif + konfigurasi BRI, tanpa limit)
  • gopay_qris — GoPay QRIS (memerlukan langganan aktif + akun GoPay Merchant terhubung via OTP, tanpa limit) Recommended
  • ovo — OVO (memerlukan langganan aktif + akun OVO terhubung)
QRIS Converter:

Aktifkan use_qris_converter: true untuk membuat QRIS dinamis dengan nominal tertanam otomatis.

  • QRIS string otomatis diambil dari akun yang terhubung sesuai payment_method
  • gopay_qris → dari GoPay QRIS
  • qris_user → dari BRI QRIS
  • qris → dari QRIS
  • Tidak perlu kirim qris_string secara manual
  • Konversi nominal dilakukan otomatis di halaman pembayaran
  • Response: qris_converter: true
Batasan Nominal QRIS Admin:

Untuk metode pembayaran qris maksimal nominal adalah Rp 500.000. Untuk nominal lebih besar, gunakan metode qris_user atau gopay_qris (GoPay Merchant QRIS — hubungkan via OTP, tanpa limit).

Catatan: Gunakan endpoint /api/get-payment-methods untuk mengecek ketersediaan dan user_status.has_active_subscription.

Code Examples

curl -X POST https://www.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 = file_get_contents('https://www.bayar.gg/api/create-payment.php', false,
    stream_context_create([
        'http' => [
            'method' => 'POST',
            'header' => "Content-Type: application/json\r\nX-API-Key: YOUR_API_KEY_HERE",
            'content' => json_encode([
                'amount' => 50000,
                'description' => 'Pembayaran Produk A',
                'payment_method' => 'gopay_qris'
            ])
        ]
    ])
);
$data = json_decode($response, true);
const res = await fetch('https://www.bayar.gg/api/create-payment.php', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'X-API-Key': 'YOUR_API_KEY_HERE'
    },
    body: JSON.stringify({
        amount: 50000,
        description: 'Pembayaran Produk A',
        payment_method: 'gopay_qris'
    })
});
const data = await res.json();
import requests

response = requests.post(
    'https://www.bayar.gg/api/create-payment.php',
    headers={'X-API-Key': 'YOUR_API_KEY_HERE'},
    json={
        'amount': 50000,
        'description': 'Pembayaran Produk A',
        'payment_method': 'gopay_qris'
    }
)
data = response.json()
Example 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-04-16 12:30:00"
  },
  "payment_url": "https://www.bayar.gg/pay?invoice=PAY-admin-1234567890-ABC123"
}
GET /api/check-payment.php

Mengecek status pembayaran berdasarkan Invoice ID.

Query Parameters

ParameterTypeRequiredDescription
invoicestringRequiredInvoice ID pembayaran

Code Examples

curl -X GET "https://www.bayar.gg/api/check-payment.php?invoice=PAY-admin-1234567890-ABC123" \
  -H "X-API-Key: YOUR_API_KEY_HERE"
$invoice = 'PAY-admin-1234567890-ABC123';
$response = file_get_contents(
    'https://www.bayar.gg/api/check-payment.php?invoice=' . urlencode($invoice),
    false,
    stream_context_create([
        'http' => ['header' => "X-API-Key: YOUR_API_KEY_HERE"]
    ])
);
$data = json_decode($response, true);
const invoice = 'PAY-admin-1234567890-ABC123';
const res = await fetch(
    `https://www.bayar.gg/api/check-payment.php?invoice=${invoice}`,
    { headers: { 'X-API-Key': 'YOUR_API_KEY_HERE' } }
);
const data = await res.json();
import requests

response = requests.get(
    'https://www.bayar.gg/api/check-payment.php',
    headers={'X-API-Key': 'YOUR_API_KEY_HERE'},
    params={'invoice': 'PAY-admin-1234567890-ABC123'}
)
data = response.json()
Example Response
{
  "success": true,
  "invoice_id": "PAY-admin-1234567890-ABC123",
  "status": "paid",
  "amount": 50000,
  "final_amount": 50347,
  "payment_method": "gopay_qris",
  "paid_at": "2026-04-16 12:25:30",
  "paid_reff_num": "TRX123456789",
  "expires_at": "2026-04-16 12:30:00"
}
GET /api/list-payments.php

Mendapatkan daftar pembayaran dengan filter, search, dan pagination.

Query Parameters

ParameterTypeRequiredDescription
searchstringOptionalCari berdasarkan invoice, deskripsi, nama/email/HP pelanggan New
statusstringOptionalFilter by status: pending, paid, expired, cancelled
payment_methodstringOptionalFilter by method: qris, qris_user, gopay_qris, ovo New
paid_viastringOptionalFilter pembayaran sukses by method: qris, qris_user, gopay_qris, ovo New
start_datestringOptionalFilter dari tanggal (YYYY-MM-DD)
end_datestringOptionalFilter sampai tanggal (YYYY-MM-DD)
pagenumberOptionalHalaman (default: 1)
limitnumberOptionalJumlah per halaman (default: 20, max: 100)

Code Examples

curl -X GET "https://www.bayar.gg/api/list-payments.php?status=paid&page=1&limit=10" \
  -H "X-API-Key: YOUR_API_KEY_HERE"
$response = file_get_contents(
    'https://www.bayar.gg/api/list-payments.php?status=paid&page=1&limit=10',
    false,
    stream_context_create([
        'http' => ['header' => "X-API-Key: YOUR_API_KEY_HERE"]
    ])
);
$data = json_decode($response, true);
const res = await fetch(
    'https://www.bayar.gg/api/list-payments.php?status=paid&page=1&limit=10',
    { headers: { 'X-API-Key': 'YOUR_API_KEY_HERE' } }
);
const data = await res.json();
import requests

response = requests.get(
    'https://www.bayar.gg/api/list-payments.php',
    headers={'X-API-Key': 'YOUR_API_KEY_HERE'},
    params={'status': 'paid', 'page': 1, 'limit': 10}
)
data = response.json()
Example Response
{
  "success": true,
  "data": [
    {
      "invoice_id": "PAY-admin-1234567890-ABC123",
      "amount": 50000,
      "final_amount": 50347,
      "status": "paid",
      "payment_method": "gopay_qris",
      "paid_at": "2026-04-16 12:25:30",
      "created_at": "2026-04-16 12:20:00"
    }
  ],
  "pagination": { "page": 1, "limit": 10, "total": 42, "total_pages": 5 }
}

Account Endpoints

MethodEndpointDescription
GET/api/get-payment-methods.phpDaftar metode pembayaran & ketersediaan
GET/api/get-account-status.phpStatus akun & integrasi
GET/api/get-statistics.phpStatistik pembayaran
GET /api/get-payment-methods.php

Mendapatkan daftar metode pembayaran dan status ketersediaan. Response menyertakan user_status.has_active_subscription (langganan aktif diperlukan untuk create payment dan metode qris_user, gopay_qris, ovo).

Code Examples

curl -X GET "https://www.bayar.gg/api/get-payment-methods.php" \
  -H "X-API-Key: YOUR_API_KEY_HERE"
$response = file_get_contents(
    'https://www.bayar.gg/api/get-payment-methods.php',
    false,
    stream_context_create([
        'http' => ['header' => "X-API-Key: YOUR_API_KEY_HERE"]
    ])
);
$data = json_decode($response, true);
const res = await fetch(
    'https://www.bayar.gg/api/get-payment-methods.php',
    { headers: { 'X-API-Key': 'YOUR_API_KEY_HERE' } }
);
const data = await res.json();
import requests

response = requests.get(
    'https://www.bayar.gg/api/get-payment-methods.php',
    headers={'X-API-Key': 'YOUR_API_KEY_HERE'}
)
data = response.json()
Example Response
{
  "success": true,
  "methods": [
    {"id": "qris", "name": "QRIS", "available": true},
    {"id": "gopay_qris", "name": "GoPay QRIS", "available": true}
  ],
  "user_status": {"has_active_subscription": true}
}
GET /api/get-account-status.php

Mendapatkan status akun, integrasi, dan ringkasan statistik.

Code Examples

curl -X GET "https://www.bayar.gg/api/get-account-status.php" \
  -H "X-API-Key: YOUR_API_KEY_HERE"
$response = file_get_contents(
    'https://www.bayar.gg/api/get-account-status.php',
    false,
    stream_context_create([
        'http' => ['header' => "X-API-Key: YOUR_API_KEY_HERE"]
    ])
);
$data = json_decode($response, true);
const res = await fetch(
    'https://www.bayar.gg/api/get-account-status.php',
    { headers: { 'X-API-Key': 'YOUR_API_KEY_HERE' } }
);
const data = await res.json();
import requests

response = requests.get(
    'https://www.bayar.gg/api/get-account-status.php',
    headers={'X-API-Key': 'YOUR_API_KEY_HERE'}
)
data = response.json()
Example Response
{
  "success": true,
  "account": {
    "username": "admin",
    "email": "admin@bayar.gg",
    "is_verified": true
  },
  "integrations": {"gopay": true, "bri": false, "ovo": false}
}
GET /api/get-statistics.php

Mendapatkan statistik pembayaran detail dengan breakdown per metode.

Query Parameters

ParameterTypeRequiredDescription
periodstringOptionalPeriode statistik: all, today, week, month, year (default: all)

Code Examples

curl -X GET "https://www.bayar.gg/api/get-statistics.php?period=month" \
  -H "X-API-Key: YOUR_API_KEY_HERE"
$response = file_get_contents(
    'https://www.bayar.gg/api/get-statistics.php?period=month',
    false,
    stream_context_create([
        'http' => ['header' => "X-API-Key: YOUR_API_KEY_HERE"]
    ])
);
$data = json_decode($response, true);
const res = await fetch(
    'https://www.bayar.gg/api/get-statistics.php?period=month',
    { headers: { 'X-API-Key': 'YOUR_API_KEY_HERE' } }
);
const data = await res.json();
import requests

response = requests.get(
    'https://www.bayar.gg/api/get-statistics.php',
    headers={'X-API-Key': 'YOUR_API_KEY_HERE'},
    params={'period': 'month'}
)
data = response.json()
Example Response
{
  "success": true,
  "period": "month",
  "total_transactions": 150,
  "total_amount": 7500000,
  "total_paid": 120,
  "breakdown": {"qris": 80, "gopay_qris": 30, "ovo": 10}
}

Digital Products Endpoints

MethodEndpointDescription
GET/api/list-files.phpDaftar file digital
GET/api/list-contents.phpDaftar hidden content
GET/api/list-images.phpDaftar foto produk
GET /api/list-files.php

Mendapatkan daftar file digital yang sudah diupload.

Query Parameters

ParameterTypeRequiredDescription
active_onlybooleanOptionalHanya file aktif (default: true)

Code Examples

curl -X GET "https://www.bayar.gg/api/list-files.php?active_only=true" \
  -H "X-API-Key: YOUR_API_KEY_HERE"
$response = file_get_contents(
    'https://www.bayar.gg/api/list-files.php?active_only=true',
    false,
    stream_context_create([
        'http' => ['header' => "X-API-Key: YOUR_API_KEY_HERE"]
    ])
);
$data = json_decode($response, true);
const res = await fetch(
    'https://www.bayar.gg/api/list-files.php?active_only=true',
    { headers: { 'X-API-Key': 'YOUR_API_KEY_HERE' } }
);
const data = await res.json();
import requests

response = requests.get(
    'https://www.bayar.gg/api/list-files.php',
    headers={'X-API-Key': 'YOUR_API_KEY_HERE'},
    params={'active_only': 'true'}
)
data = response.json()
Example Response
{
  "success": true,
  "data": [
    {"id": 1, "filename": "ebook.pdf", "size": 2048576, "active": true}
  ]
}
GET /api/list-contents.php

Mendapatkan daftar hidden content yang sudah dibuat.

Query Parameters

ParameterTypeRequiredDescription
active_onlybooleanOptionalHanya konten aktif (default: true)

Code Examples

curl -X GET "https://www.bayar.gg/api/list-contents.php?active_only=true" \
  -H "X-API-Key: YOUR_API_KEY_HERE"
$response = file_get_contents(
    'https://www.bayar.gg/api/list-contents.php?active_only=true',
    false,
    stream_context_create([
        'http' => ['header' => "X-API-Key: YOUR_API_KEY_HERE"]
    ])
);
$data = json_decode($response, true);
const res = await fetch(
    'https://www.bayar.gg/api/list-contents.php?active_only=true',
    { headers: { 'X-API-Key': 'YOUR_API_KEY_HERE' } }
);
const data = await res.json();
import requests

response = requests.get(
    'https://www.bayar.gg/api/list-contents.php',
    headers={'X-API-Key': 'YOUR_API_KEY_HERE'},
    params={'active_only': 'true'}
)
data = response.json()
Example Response
{
  "success": true,
  "data": [
    {"id": 1, "title": "License Key", "type": "text", "active": true}
  ]
}
GET /api/list-images.php

Mendapatkan daftar foto produk yang sudah diupload.

Query Parameters

ParameterTypeRequiredDescription
active_onlybooleanOptionalHanya gambar aktif (default: true)

Code Examples

curl -X GET "https://www.bayar.gg/api/list-images.php?active_only=true" \
  -H "X-API-Key: YOUR_API_KEY_HERE"
$response = file_get_contents(
    'https://www.bayar.gg/api/list-images.php?active_only=true',
    false,
    stream_context_create([
        'http' => ['header' => "X-API-Key: YOUR_API_KEY_HERE"]
    ])
);
$data = json_decode($response, true);
const res = await fetch(
    'https://www.bayar.gg/api/list-images.php?active_only=true',
    { headers: { 'X-API-Key': 'YOUR_API_KEY_HERE' } }
);
const data = await res.json();
import requests

response = requests.get(
    'https://www.bayar.gg/api/list-images.php',
    headers={'X-API-Key': 'YOUR_API_KEY_HERE'},
    params={'active_only': 'true'}
)
data = response.json()
Example Response
{
  "success": true,
  "data": [
    {"id": 1, "filename": "product.jpg", "url": "https://...", "active": true}
  ]
}

QRIS Converter Endpoints

MethodEndpointDescription
POST/api/qris-convert.phpKonversi QRIS statis → dinamis dengan nominal
GET POST/api/qris-info.phpInfo & validasi QRIS
POST /api/qris-convert.php

Mengkonversi QRIS statis ke QRIS dinamis dengan nominal tertanam. Support input text QRIS atau gambar QRIS.

Request Body (JSON)

ParameterTypeRequiredDescription
nominalnumberRequiredNominal yang akan ditanam di QRIS (dalam Rupiah)
qrisstringPilih salah satuString QRIS yang akan dikonversi
imagestringPilih salah satuBase64 encoded gambar QR code
image_urlstringPilih salah satuURL gambar QR code

File Upload (Multipart Form Data)

FieldTypeDescription
nominalnumberNominal yang akan ditanam
imagefileFile gambar QR code (JPEG, PNG, GIF, WebP)
Tips: Gunakan qr_image_url untuk menampilkan QR code yang sudah dikonversi langsung di aplikasi Anda.

Code Examples

curl -X POST https://www.bayar.gg/api/qris-convert.php \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY_HERE" \
  -d '{
    "qris": "00020101021126...",
    "nominal": 50000
  }'
$response = file_get_contents('https://www.bayar.gg/api/qris-convert.php', false,
    stream_context_create([
        'http' => [
            'method' => 'POST',
            'header' => "Content-Type: application/json\r\nX-API-Key: YOUR_API_KEY_HERE",
            'content' => json_encode([
                'qris' => '00020101021126...',
                'nominal' => 50000
            ])
        ]
    ])
);
$data = json_decode($response, true);
const res = await fetch('https://www.bayar.gg/api/qris-convert.php', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'X-API-Key': 'YOUR_API_KEY_HERE'
    },
    body: JSON.stringify({
        qris: '00020101021126...',
        nominal: 50000
    })
});
const data = await res.json();
import requests

response = requests.post(
    'https://www.bayar.gg/api/qris-convert.php',
    headers={'X-API-Key': 'YOUR_API_KEY_HERE'},
    json={
        'qris': '00020101021126...',
        'nominal': 50000
    }
)
data = response.json()
Example Response
{
  "success": true,
  "qris": "00020101021226...",
  "qr_image_url": "https://www.bayar.gg/qris-info/api/qr.php?data=...",
  "merchant_name": "GOPAY MERCHANT",
  "amount": 50000
}
GET POST /api/qris-info.php

Mendapatkan informasi dari QRIS tanpa mengkonversinya. Berguna untuk validasi dan preview.

Query Parameters (GET)

ParameterTypeRequiredDescription
qrisstringRequiredString QRIS untuk dianalisis
Use Case: Gunakan endpoint ini untuk validasi QRIS sebelum proses konversi, atau untuk menampilkan preview merchant info ke user.

Code Examples

curl -X GET "https://www.bayar.gg/api/qris-info.php?qris=00020101021126..." \
  -H "X-API-Key: YOUR_API_KEY_HERE"
$response = file_get_contents(
    'https://www.bayar.gg/api/qris-info.php?qris=00020101021126...',
    false,
    stream_context_create([
        'http' => ['header' => "X-API-Key: YOUR_API_KEY_HERE"]
    ])
);
$data = json_decode($response, true);
const res = await fetch(
    'https://www.bayar.gg/api/qris-info.php?qris=00020101021126...',
    { headers: { 'X-API-Key': 'YOUR_API_KEY_HERE' } }
);
const data = await res.json();
import requests

response = requests.get(
    'https://www.bayar.gg/api/qris-info.php',
    headers={'X-API-Key': 'YOUR_API_KEY_HERE'},
    params={'qris': '00020101021126...'}
)
data = response.json()
Example Response
{
  "success": true,
  "merchant_name": "GOPAY MERCHANT",
  "merchant_city": "JAKARTA",
  "amount": 0,
  "is_dynamic": false
}

WhatsApp Store API

MethodEndpointDescription
GET/api/wa-store-orders.phpDaftar pesanan WA Store
POST/api/wa-store-complete.phpUpdate status pesanan
GET /api/wa-store-orders.php

Ambil daftar pesanan WhatsApp Store atau detail pesanan tertentu. Mendukung pencarian berdasarkan nomor order, nama customer, atau nomor telepon.

Query Parameters

ParameterTipeRequiredKeterangan
order_numberstringOptionalAmbil detail satu pesanan (e.g. WA260329-A1B2)
statusstringOptionalFilter: pending, waiting_payment, paid, processing, completed, cancelled
searchstringOptionalCari berdasarkan nomor order, nama customer, nomor telepon, atau invoice ID
limitintegerOptionalMax 100, default 50
offsetintegerOptionalPagination offset

Code Examples

curl -X GET "https://www.bayar.gg/api/wa-store-orders.php?status=paid&limit=10" \
  -H "X-API-Key: YOUR_API_KEY_HERE"
$response = file_get_contents(
    'https://www.bayar.gg/api/wa-store-orders.php?status=paid&limit=10',
    false,
    stream_context_create([
        'http' => ['header' => "X-API-Key: YOUR_API_KEY_HERE"]
    ])
);
$data = json_decode($response, true);
const res = await fetch(
    'https://www.bayar.gg/api/wa-store-orders.php?status=paid&limit=10',
    { headers: { 'X-API-Key': 'YOUR_API_KEY_HERE' } }
);
const data = await res.json();
import requests

response = requests.get(
    'https://www.bayar.gg/api/wa-store-orders.php',
    headers={'X-API-Key': 'YOUR_API_KEY_HERE'},
    params={'status': 'paid', 'limit': 10}
)
data = response.json()
Example Response
{
  "success": true,
  "data": [
    {
      "order_number": "WA260329-A1B2",
      "customer_name": "Rahim",
      "status": "paid",
      "total": 75000
    }
  ],
  "total": 5
}
POST /api/wa-store-complete.php

Update status pesanan WA Store (completed, cancelled). Pesanan hanya bisa diselesaikan (completed) jika sudah dibayar (status: paid/processing). Pesanan yang sudah selesai tidak bisa dibatalkan. Notifikasi WhatsApp otomatis dikirim ke customer.

Body Parameters

ParameterTipeRequiredKeterangan
order_numberstringRequiredNomor order WA Store
statusstringOptionalcompleted, cancelled (default: completed)
notifybooleanOptionalKirim notifikasi WhatsApp ke customer (default: true)
Validasi: Status completed hanya bisa diset jika pesanan sudah berstatus paid atau processing. Pesanan completed tidak bisa di-cancel.

Code Examples

curl -X POST https://www.bayar.gg/api/wa-store-complete.php \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY_HERE" \
  -d '{
    "order_number": "WA260329-A1B2",
    "status": "completed",
    "notify": true
  }'
$response = file_get_contents('https://www.bayar.gg/api/wa-store-complete.php', false,
    stream_context_create([
        'http' => [
            'method' => 'POST',
            'header' => "Content-Type: application/json\r\nX-API-Key: YOUR_API_KEY_HERE",
            'content' => json_encode([
                'order_number' => 'WA260329-A1B2',
                'status' => 'completed',
                'notify' => true
            ])
        ]
    ])
);
$data = json_decode($response, true);
const res = await fetch('https://www.bayar.gg/api/wa-store-complete.php', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'X-API-Key': 'YOUR_API_KEY_HERE'
    },
    body: JSON.stringify({
        order_number: 'WA260329-A1B2',
        status: 'completed',
        notify: true
    })
});
const data = await res.json();
import requests

response = requests.post(
    'https://www.bayar.gg/api/wa-store-complete.php',
    headers={'X-API-Key': 'YOUR_API_KEY_HERE'},
    json={
        'order_number': 'WA260329-A1B2',
        'status': 'completed',
        'notify': True
    }
)
data = response.json()
Example Response
{
  "success": true,
  "message": "Order completed successfully",
  "order": {
    "order_number": "WA260329-A1B2",
    "status": "completed"
  }
}

OVO Integration

Integrasi OVO memungkinkan Anda menerima pembayaran langsung ke akun OVO Anda dengan pencocokan nominal otomatis.

Langkah Setup

  1. Buka menu PengaturanHubungkan OVO
  2. Masukkan nomor OVO Anda dan verifikasi dengan kode OTP
  3. Masukkan PIN OVO untuk menyelesaikan koneksi
  4. Setelah terhubung, Anda dapat membuat pembayaran dengan metode OVO

Cara Kerja Pencocokan

StepProses
1Customer membayar ke nomor OVO Anda dengan nominal yang tepat (termasuk kode unik)
2Sistem mengecek mutasi OVO setiap beberapa detik
3Jika ditemukan transaksi masuk dengan nominal yang cocok, pembayaran otomatis dikonfirmasi
4Callback dikirim ke URL yang Anda tentukan

Contoh Request dengan OVO

curl -X POST https://www.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"
  }'
Penting: Pastikan customer mentransfer dengan nominal yang tepat termasuk kode unik agar pembayaran terdeteksi otomatis.

BRI Merchant QRIS Integration

BRI Merchant QRIS memungkinkan Anda menerima pembayaran langsung ke rekening BRI Anda sendiri dengan QRIS merchant Anda.

Keuntungan BRI Merchant QRIS

Langkah Setup

  1. Pastikan langganan Anda aktif (trial atau berbayar)
  2. Buka menu BRI QRIS Merchant di dashboard
  3. Masukkan kredensial BRI API Anda (Host, Username, Password, MID, TID)
  4. Test koneksi untuk memastikan API berfungsi
  5. Upload gambar QRIS merchant Anda
  6. Setelah terhubung, Anda dapat membuat pembayaran dengan metode qris_user

Contoh Request dengan BRI Merchant QRIS

curl -X POST https://www.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"
  }'
Info: Pembayaran via BRI Merchant QRIS tidak menambah saldo yang bisa di-withdraw karena dana langsung masuk ke rekening Anda.
Penting: Pastikan kredensial BRI API valid dan gambar QRIS sudah diupload sebelum menggunakan metode ini.

GoPay Merchant QRIS Integration

GoPay Merchant QRIS memungkinkan Anda menerima pembayaran langsung ke akun GoPay Merchant Anda sendiri menggunakan QRIS.

Keuntungan GoPay Merchant QRIS

Langkah Setup

  1. Pastikan langganan Anda aktif (trial atau berbayar)
  2. Buka menu GoPay Merchant QRIS di dashboard
  3. Capture token dari GoPay Merchant App menggunakan HTTP Inspector
  4. Paste JSON token + device info di halaman koneksi
  5. Upload gambar QRIS GoPay Merchant Anda
  6. Setelah terhubung, buat pembayaran dengan metode gopay_qris

Contoh Request dengan GoPay Merchant QRIS

curl -X POST https://www.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://www.bayar.gg/pay?invoice=PAY-admin-1234567890-ABC123"
}
Info: Pembayaran via GoPay Merchant QRIS tidak menambah saldo yang bisa di-withdraw karena dana langsung masuk ke akun GoPay Merchant Anda.
Penting: Token GoPay Merchant memiliki masa berlaku terbatas. Pastikan token masih valid dan gambar QRIS sudah diupload sebelum menggunakan metode ini. Perbarui token secara berkala.

Webhook 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": "PAY-admin-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,
  "timestamp": 1705312530,
  "signature": "sha256_hmac_signature"
}

Callback Headers

HeaderDescription
Content-Typeapplication/json
X-Webhook-Eventpayment.paid
X-Webhook-SignatureHMAC SHA256 signature untuk verifikasi
X-Webhook-TimestampUnix timestamp saat callback dikirim
X-Invoice-IDInvoice 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_WEBHOOK_SECRET'); // Pengaturan → Webhook

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']);
}
?>

Webhook Settings

Konfigurasi webhook tersedia di Pengaturan → Webhook:

SettingKeterangan
Default Callback URLURL default yang otomatis digunakan jika callback_url tidak disertakan saat create payment.
Webhook Secret KeySecret key unik per user (whsec_xxx) untuk memverifikasi signature callback. Bisa di-regenerate kapan saja.
Callback LogsRiwayat 20 callback terakhir beserta status HTTP response.
Penting: Signature menggunakan Webhook Secret Key Anda (bukan API Key). Dapatkan di Pengaturan → Webhook.

Payment Status

StatusDescription
pendingMenunggu pembayaran
paidPembayaran berhasil
expiredPembayaran expired (melebihi batas waktu)
cancelledPembayaran dibatalkan

Error Codes

HTTP CodeDescription
200Success
400Bad Request — Parameter tidak valid
401Unauthorized — API Key tidak valid
404Not Found — Resource tidak ditemukan
405Method Not Allowed
429Too Many Requests — Rate limit exceeded
500Internal Server Error
Browser Cache