DEVELOPER API PORTAL

WARUNGERIK Payment Gateway

Spesifikasi API Integrasi & Referensi Kode untuk Website Merchant

🔒 Keamanan & Autentikasi API Secret Key

Setiap request checkout memerlukan autentikasi API Secret Key dari file .env server kamu. Kirimkan secret key ini di HTTP Header sebagai X-API-KEY.

X-API-KEY: YOUR_API_SECRET_KEY
POST /api/checkout

Membuat transaksi baru dengan kode unik otomatis. Menerima custom orderId dari sistem web kamu.

HTTP Request Headers

Content-Type: application/json
X-API-KEY: YOUR_API_SECRET_KEY

Request Body (JSON)

{
  "orderId": "INV-2026-1092",
  "amount": 50000,
  "customerName": "Budi Santoso",
  "note": "Pembelian Produk #1092"
}

Response (200 OK)

{
  "success": true,
  "data": {
    "orderId": "INV-2026-1092",
    "baseAmount": 50000,
    "uniqueCode": 123,
    "totalAmount": 50123,
    "status": "PENDING",
    "paymentUrl": "https://pg.warungerik.com/pay/INV-2026-1092",
    "qrCodeDataUrl": "data:image/png;base64,..."
  }
}
GET /api/status/:orderId

Mengecek status pembayaran real-time langsung ke GoBiz Journal API.

Response (200 OK)

{
  "success": true,
  "data": {
    "orderId": "INV-2026-1092",
    "status": "PAID",
    "totalAmount": 50123,
    "paidAt": "2026-08-06T17:45:10.000Z"
  }
}
💻 Contoh Integrasi PHP dengan Custom orderId
<?php
$gatewayUrl = 'https://pg.warungerik.com/api/checkout';
$secretKey  = 'YOUR_API_SECRET_KEY';

// Kirim Order ID Asli dari Sistem Website / Toko Kamu
$payload = [
    'orderId'      => 'INV-' . time(),
    'amount'       => 50000,
    'customerName' => 'Budi Santoso',
    'note'         => 'Pembelian Produk Online'
];

$ch = curl_init($gatewayUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'X-API-KEY: ' . $secretKey
]);

$res = json_decode(curl_exec($ch), true);
curl_close($ch);

if (!empty($res['success'])) {
    // Redirect Pembeli ke Halaman QRIS Gateway
    header("Location: " . $res['data']['paymentUrl']);
    exit();
}
?>