Integrasikan infrastruktur pembayaran NEX-PAYMENT langsung ke website atau aplikasi bisnis Anda. Gunakan Secret Key API dari halaman Profil Merchant sebagai otentikasi Bearer Token.
BASE URL SERVER API:
https://api.nex-payment.biz.id/api
POST /charge/qris
Gunakan endpoint ini untuk membuat tagihan QRIS baru. Nomor pesanan (Invoice) akan otomatis dibuat oleh sistem. Mengembalikan UUID transaksi provider, NEX ID, string QRIS mentah, serta tautan checkout.
HEADER REQUEST:
Authorization: Bearer
Content-Type: application/json
REQUEST BODY (JSON):
{
"amount": 10000
}
RESPONSE SUKSES (200 OK):
{
"success": true,
"message": "QRIS Charge Created",
"data": {
"transaction_id": "53bc6ed2-441d-4bd0-bc39-11fdfff5fedb",
"nexpay_transaction_id": "NEX-1789922066639",
"merchant_order_id": "INV-1789922066639",
"amount": 10000,
"fee": 70,
"status": "pending",
"qr_string": "00020101021226610014COM.GO-JEK.WWW...",
"qr_image": "https://nex-payment.biz.id/payment.html?inv=INV-1789922066639",
"expires_at": "2026-09-20 23:49:26"
}
}
POST /charge/status
Gunakan endpoint ini untuk mengecek status pembayaran tagihan QRIS secara real-time menggunakan `nexpay_transaction_id`. Sistem backend akan otomatis mengecek ke gateway menggunakan UUID AutoGopay di balik layar.
REQUEST BODY (JSON):
{
"nexpay_transaction_id": "NEX-1789922066639"
}
RESPONSE SUKSES (200 OK):
{
"success": true,
"data": {
"transaction_id": "53bc6ed2-441d-4bd0-bc39-11fdfff5fedb",
"nexpay_transaction_id": "NEX-1789922066639",
"merchant_order_id": "INV-1789922066639",
"amount": 10000,
"fee": 70,
"status": "settlement"
}
}
POST /charge/cancel
Gunakan endpoint ini untuk membatalkan transaksi QRIS yang masih berstatus pending.
REQUEST BODY (JSON):
{
"nexpay_transaction_id": "NEX-1789922066639"
}
RESPONSE SUKSES (200 OK):
{
"success": true,
"message": "Transaction cancelled successfully",
"data": {
"nexpay_transaction_id": "NEX-1789922066639",
"status": "cancel"
}
}
const API_URL = 'https://api.nex-payment.biz.id/api';
const SECRET_KEY = 'nex_secret_59c7xp422nj'; // Ganti dengan Secret Key milikmu
// 1. Buat Tagihan QRIS Baru
async function createQrisCharge(amount) {
const response = await fetch(`${API_URL}/charge/qris`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${SECRET_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ amount: amount })
});
const result = await response.json();
if (result.success) {
console.log('UUID Gateway:', result.data.transaction_id);
console.log('NEX ID:', result.data.nexpay_transaction_id);
console.log('URL Checkout:', result.data.qr_image);
}
}
// 2. Cek Status Transaksi
async function checkStatus(nexpayTrxId) {
const response = await fetch(`${API_URL}/charge/status`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${SECRET_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ nexpay_transaction_id: nexpayTrxId })
});
const result = await response.json();
console.log('Status Transaksi:', result.data.status);
}
// 3. Batalkan Transaksi Pending
async function cancelTransaction(nexpayTrxId) {
const response = await fetch(`${API_URL}/charge/cancel`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${SECRET_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ nexpay_transaction_id: nexpayTrxId })
});
const result = await response.json();
console.log(result.message);
}