Payment Gateway API Documentation
GoMerch Pro menyediakan REST API Payment Gateway untuk mengintegrasikan pembayaran QRIS GoPay secara langsung ke website toko online, aplikasi Laravel, bot Telegram, atau sistem kasir POS Anda tanpa biaya transaksi (0% fee).
Autentikasi API Key: Semua pemanggilan endpoint Gateway API V1 mewajibkan HTTP Header X-API-KEY: <api_key_anda>. API Key dapat dilihat dan di-reset pada Dashboard Utama.
Gateway API V1 Endpoints
/api/v1/charge
Membuat tagihan invoice baru dan menghasilkan QRIS dinamis presisi sesuai nominal checkout.
Header Required
X-API-KEY: gm_live_xxxxxxxxxxxxxxxxxxxxxxxx
Request Body (JSON)
{
"amount": 50000,
"order_id": "ORDER-1001",
"customer_name": "Budi Santoso",
"callback_url": "https://toko-online.com/api/callback",
"static_qr": "000201010211385800...",
"use_unique_code": true,
"expired_minutes": 15
}
Response Success (HTTP 201 Created)
{
"success": true,
"invoice_id": "INV-20260825-8A2F",
"order_id": "ORDER-1001",
"amount": 50000,
"unique_code": 14,
"total_amount": 50014,
"status": "PENDING",
"qr_string": "000201010212385800...5407500145802ID6304A1B2",
"qr_code_url": "/api/qris/create?amount=50014&static_qr=...",
"created_at": "2026-08-25T13:50:00.000Z",
"expired_at": "2026-08-25T14:05:00.000Z",
"callback_url": "https://toko-online.com/api/callback"
}
/api/v1/invoice/:id
Mengecek rincian dan status status lunas/pending dari sebuah invoice berdasarkan Invoice ID atau Order ID.
Response (JSON)
{
"success": true,
"invoice": {
"id": "INV-20260825-8A2F",
"order_id": "ORDER-1001",
"amount": 50000,
"unique_code": 14,
"total_amount": 50014,
"status": "PAID",
"paid_at": "2026-08-25T13:52:10.000Z"
}
}
/api/v1/invoice/:id/cancel
Membatalkan invoice tagihan yang masih berstatus PENDING.
Webhook Callback Notification
Ketika pembayaran berhasil diverifikasi oleh background worker, GoMerch Gateway akan mengirimkan **HTTP POST Webhook** ke callback_url toko Anda.
Header Notification
Content-Type: application/json X-GoMerch-Event: payment.settled X-GoMerch-Signature: <hmac_sha256_hex_signature>
Payload Body (JSON)
{
"event": "payment.settled",
"invoice_id": "INV-20260825-8A2F",
"order_id": "ORDER-1001",
"amount": 50000,
"unique_code": 14,
"total_amount": 50014,
"status": "PAID",
"paid_at": "2026-08-25T13:52:10.000Z",
"customer_name": "Budi Santoso",
"timestamp": "2026-08-25T13:52:11.000Z"
}
Contoh Integrasi Bahasa Pemrograman
PHP Native (cURL)
<?php
$apiKey = "gm_live_YOUR_API_KEY";
$gatewayUrl = "http://localhost:3015/api/v1/charge";
$data = [
"amount" => 75000,
"order_id" => "INV-PHP-001",
"customer_name" => "Ahmad",
"callback_url" => "https://toko-saya.com/callback.php",
"static_qr" => "000201010211385800..."
];
$ch = curl_init($gatewayUrl);
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 = json_decode(curl_exec($ch), true);
curl_close($ch);
if ($response["success"]) {
echo "Scan QRIS untuk membayar: " . $response["qr_string"];
}
?>
Laravel Framework (Http Client)
use Illuminate\Support\Facades\Http;
public function checkout(Request $request)
{
$response = Http::withHeaders([
'X-API-KEY' => env('GOMERCH_API_KEY'),
])->post('http://localhost:3015/api/v1/charge', [
'amount' => $request->total_belanja,
'order_id' => 'ORDER-' . $order->id,
'customer_name' => $request->user()->name,
'callback_url' => route('payment.callback'),
'static_qr' => env('GOPAY_STATIC_QR'),
]);
if ($response->successful()) {
$result = $response->json();
return view('payment', ['qr_url' => $result['qr_code_url'], 'total' => $result['total_amount']]);
}
}
Node.js (Axios)
const axios = require('axios');
async function createCharge() {
const res = await axios.post('http://localhost:3015/api/v1/charge', {
amount: 100000,
order_id: 'ORDER-NODE-1',
customer_name: 'Siti',
callback_url: 'https://toko.com/webhook',
static_qr: '000201010211385800...'
}, {
headers: { 'X-API-KEY': 'gm_live_YOUR_API_KEY' }
});
console.log(res.data);
}
Python (Requests)
import requests
url = "http://localhost:3015/api/v1/charge"
headers = {"X-API-KEY": "gm_live_YOUR_API_KEY", "Content-Type": "application/json"}
payload = {
"amount": 25000,
"order_id": "PY-100",
"static_qr": "000201010211385800..."
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())