Panduan integrasi lengkap dengan contoh kode dan format respon JSON.
Setiap request ke API GetPlaz membutuhkan API Key. Anda bisa mendapatkan API Key di Menu Dashboard setelah mendaftar.
YOUR_API_KEY
Dapatkan daftar metode pembayaran yang aktif dan tersedia untuk projek Anda.
<?php
$apiKey = 'YOUR_API_KEY';
$url = 'https://getplaz.com/api.php?action=payment_channels&apikey=' . $apiKey;
$res = file_get_contents($url);
$data = json_decode($res, true);
if ($data['status']) {
foreach ($data['data'] as $group) {
echo "Kategori: " . $group['category'] . "\n";
foreach ($group['items'] as $item) {
echo "- [" . $item['code'] . "] " . $item['name'] . "\n";
}
}
}
?>
{
"status": true,
"message": "List Payment Channels",
"data": [
{
"category": "QRIS",
"items": [
{ "code": "QRIS", "name": "QRIS (All E-Wallet)" }
]
},
{
"category": "E-WALLET",
"items": [
{ "code": "GOPAY", "name": "GoPay" },
{ "code": "DANA", "name": "Dana" }
]
}
]
}
Endpoint untuk membuat transaksi pembayaran baru via semua metode (QRIS, VA, E-Wallet, Retail).
✅ Idempotent: Jika request dengan reff_id yang sama dikirim ulang (refresh/retry), sistem akan mengembalikan data transaksi yang sudah ada beserta status terkini. Tidak akan terjadi duplikasi.
| Parameter | Wajib | Keterangan |
|---|---|---|
| apikey | ✅ | API Key dari Dashboard |
| nominal | ✅ | Nominal (min. 1000) |
| reff_id | ✅ | ID Unik dari sistem Anda (contoh: INV-001). Akan menjadi ID transaksi. |
| metode | ❌ | Default: QRIS. Lihat daftar metode di bawah. |
| customer_name | ❌ | Nama customer (Opsional) |
| customer_email | ❌ | Email customer (Opsional) |
| customer_phone | ❌ | Nomor HP customer (Opsional, untuk WhatsApp Notif) |
| Kategori | Kode (metode) |
|---|---|
| QRIS | QRIS, QRIS_CUSTOM, QRISREALTIME |
| E-Wallet | GOPAY, DANA, SHOPEEPAY, LINKAJA, OVO |
| Virtual Account | BRIVA, BCAVA, MANDIRIVA, BNIVA, BSIVA, CIMBVA, DANAMONVA, PERMATAVA |
| Retail | ALFAMART, INDOMARET |
<?php
$apiKey = 'YOUR_API_KEY';
$nominal = 10000;
$reff_id = 'INV-' . time(); // ID unik dari sistem Anda
$metode = 'QRIS'; // QRIS, GOPAY, DANA, BRIVA, dll.
$url = 'https://getplaz.com/api.php?action=create_order&apikey=' . $apiKey . '&nominal=' . $nominal . '&reff_id=' . $reff_id . '&metode=' . $metode;
$res = file_get_contents($url);
$data = json_decode($res, true);
if ($data['status']) {
// Redirect user ke halaman pembayaran
header("Location: " . $data['data']['pay_url']);
exit;
} else {
echo "Error: " . $data['message'];
}
// CATATAN: Jika URL yang sama dipanggil lagi (refresh/retry),
// sistem akan mengembalikan data transaksi yang sama
// beserta status terkini (Unpaid/Success/Expired).
?>
{
"status": true,
"data": {
"trx_id": "INV-170000001",
"status": "Unpaid",
"nominal": 10000,
"ref_id": "INV-170000001",
"pay_url": "https://getplaz.com/index.php?page=pay&slug=INV-170000001",
"qr_link": "https://..." // (jika QRIS)
"nomor_va": "88880001" // (jika VA)
"checkout_url": "https://..." // (jika E-Wallet)
}
}
Unpaid
— Belum dibayar
SUCCESS
— Pembayaran berhasil
EXPIRED
— Waktu habis
CANCELLED
— Dibatalkan
Endpoint untuk mengecek status transaksi.
<?php $apiKey = 'YOUR_API_KEY'; $trxId = 'GP-CONTOH'; $url = 'https://getplaz.com/api.php?action=checkstatus&apikey=' . $apiKey . '&trxid=' . $trxId; $res = file_get_contents($url); $data = json_decode($res, true); print_r($data); ?>
{
"status": true,
"data": {
"status": "SUCCESS",
"trx_id": "GP-...",
"amount": 10000,
"payment_url": "...",
"qr_image": "..."
}
}
{
"status": true,
"data": {
"status": "EXPIRED",
"qris_image": "https://.../expired.png"
}
}
Notifikasi otomatis ke server Anda saat pembayaran BERHASIL atau EXPIRED.
Wajib: Verifikasi header X-GetPlaz-Signature menggunakan Secret Anda.
<?php
$secret = 'YOUR_WEBHOOK_SECRET';
$json = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_GETPLAZ_SIGNATURE'] ?? '';
// Verifikasi
if (!hash_equals(hash_hmac('sha256', $json, $secret), $signature)) {
http_response_code(403); exit;
}
$data = json_decode($json, true);
// Logic Anda...
http_response_code(200);
?>
{
"trxid": "GP-ABC...",
"amount": 10123,
"status": "SUCCESS",
"paid_at": "2026-01-01 12:05:00"
}
{
"trxid": "GP-ABC...",
"amount": 10123,
"status": "EXPIRED",
"paid_at": null
}
Endpoint untuk melihat informasi akun merchant dan saldo terkini.
<?php
$apiKey = 'YOUR_API_KEY';
$url = 'https://getplaz.com/api.php?action=check_profile&api_key=' . $apiKey;
$res = file_get_contents($url);
$data = json_decode($res, true);
if ($data['status']) {
echo "Saldo: " . $data['data']['current_balance'];
}
?>
{
"status": true,
"message": "Profile data retrieved successfully",
"data": {
"project_name": "Toko Online Saya",
"merchant_username": "user123",
"merchant_email": "admin@store.com",
"current_balance": 1500000,
"is_active": true
}
}
Endpoint untuk melakukan penarikan dana otomatis.
<?php
$url = 'https://getplaz.com/api.php?action=request_withdrawal';
$data = [
'api_key' => 'YOUR_API_KEY',
'amount' => 50000,
'bank_code' => 'BCA',
'account_number' => '1234567890',
'account_name' => 'JOHN DOE'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
?>
{
"status": true,
"message": "Withdrawal request submitted successfully",
"data": {
"amount_requested": 50000,
"admin_fee": 5000,
"amount_received": 45000,
"bank": "BCA",
"account": "1234567890",
"status": "PENDING"
}
}
Dapatkan daftar lengkap Bank dan E-Wallet yang didukung sistem.
Penting:
Nilai code dari respon ini (Misal: "BCA") WAJIB digunakan sebagai parameter bank_code saat melakukan Request Withdrawal.
<?php
$apiKey = 'YOUR_API_KEY';
$url = 'https://getplaz.com/api.php?action=get_withdrawal_methods&apikey=' . $apiKey;
// Inisialisasi cURL
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['status']) {
echo "Metode Pembayaran Tersedia:\n";
foreach ($result['data'] as $method) {
// Output: [BCA] Bank Central Asia (BANK)
echo "[" . $method['code'] . "] " . $method['name'] . " (" . $method['type'] . ")\n";
}
} else {
echo "Gagal: " . $result['message'];
}
?>
code
Kode unik bank (Misal: BCA, DANA). Gunakan ini untuk parameter request withdraw.
name
Nama lengkap bank/e-wallet (Display Name).
type
Jenis metode: BANK atau EWALLET.
{
"status": true,
"message": "Available withdrawal methods retrieved",
"total": 3,
"data": [
{
"code": "BCA",
"name": "Bank Central Asia",
"type": "BANK",
"is_active": true
},
{
"code": "DANA",
"name": "DANA Indonesia",
"type": "EWALLET",
"is_active": true
},
...
]
}
Membatalkan transaksi yang masih berstatus PENDING.
<?php
$url = 'https://getplaz.com/api.php?action=cancel_transaction';
$data = [
'api_key' => 'YOUR_API_KEY',
'trx_id' => 'GP-TRX12345' // Ganti dengan ID Transaksi Anda
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);
?>
{
"status": true,
"message": "Transaction cancelled successfully",
"data": {
"trx_id": "GP-TRX12345",
"status": "CANCELLED",
"cancelled_at": "2026-01-18 10:00:00"
}
}
Endpoint ini didesain khusus untuk integrasi cepat (Simple QRIS) seperti versi terdahulu (Qiospay/Vercel).
Note: Endpoint ini hanya mendukung QRIS. Untuk metode lain (E-Wallet/VA), gunakan endpoint Create Transaction (Advanced) di atas.
Versi sederhana untuk membuat QRIS instan tanpa parameter kompleks. Untuk integrasi penuh, gunakan endpoint Create Transaction di atas.
<?php
$apiKey = 'YOUR_API_KEY';
$amount = 10000;
// $name = 'Pelanggan 1'; // Opsional (Boleh tidak diisi)
$url = 'https://getplaz.com/api.php?action=createpayment&apikey=' . $apiKey . '&amount=' . $amount;
// &customer_name=' . urlencode($name); // Tambahkan jika ingin kirim nama
$res = file_get_contents($url);
$data = json_decode($res, true);
if ($data['status']) {
print_r($data['data']);
}
?>
{
"status": true,
"data": {
"trx_id": "GP-ABC12345",
"amount": 10123,
"payment_url": "https://domain.com/pay/...",
"qr_image": "https://domain.com/assets/...",
"expired_at": "2026-01-01 12:00:00",
"environment": "sandbox"
}
}