Dokumentasi API
Panduan integrasi API pembayaran untuk aplikasi kamu
APersiapan
Langkah pertama yang harus kamu lakukan adalah mendaftar dan login ke dashboard. Setelah itu, dapatkan API Key kamu di menu Profil untuk mulai mengintegrasikan sistem pembayaran ke aplikasi kamu.
BCek Saldo (Balance)
- Method: GET
- URL: /api/balance
Parameter:
- apikey (string, wajib)
Contoh Request:
const axios = require('axios');
axios.get('BASE_URL/api/balance?apikey=YOUR_API_KEY')
.then(response => console.log(response.data));
/*
Contoh response:
{
"username": "your_username",
"email": "[email protected]",
"balance": 150000
}
*/
CMembuat Invoice
- Method: GET
- URL: /api/invoice
Parameter:
- apikey (string, wajib)
- amount (integer, wajib)
Contoh Request:
const axios = require('axios');
axios.get('BASE_URL/api/invoice?apikey=YOUR_API_KEY&amount=50000')
.then(response => console.log(response.data));
/*
Contoh response:
{
"success": true,
"invoice_id": "64c8d9e...",
"amount": 50000,
"fee": 500,
"total": 50500,
"qris_image": "https://...",
"payment_link": "https://...",
"expired_at": "2025-01-01 12:00:00"
}
*/
DCek Status Invoice
- Method: GET
- URL: /api/invoice/status
Parameter:
- apikey (string, wajib)
- invoice_id (string, wajib)
Nilai status: pending, paid, expired, cancelled.
Contoh Request:
const axios = require('axios');
axios.get('BASE_URL/api/invoice/status?apikey=YOUR_API_KEY&invoice_id=YOUR_INVOICE_ID')
.then(response => console.log(response.data));
/*
Contoh response:
{
"invoice_id": "64c8d9e...",
"amount": 50000,
"fee": 500,
"total": 50500,
"status": "paid",
"qris_image": "https://...",
"payment_link": "https://...",
"expired_at": "2025-01-01 12:00:00",
"created_at": "2025-01-01 11:30:00"
}
*/
EBatalkan Invoice
- Method: POST (GET juga didukung)
- URL: /api/invoice/cancel
Parameter:
- apikey (string, wajib)
- invoice_id (string, wajib)
Catatan:
- Hanya invoice berstatus pending yang bisa dibatalkan. Invoice paid, expired, atau yang sudah cancelled ditolak dengan HTTP 400.
- Pembatalan hanya berlaku di sistem kami dan tidak menghubungi penyedia pembayaran. Pastikan pelanggan tidak membayar QR yang sudah dibatalkan.
- Setelah dibatalkan, status invoice menjadi cancelled dan halaman payment_link menampilkan transaksi dibatalkan.
- Jika callback_url diisi, event deposit.cancelled dikirim ke URL tersebut.
- Invoice yang tidak ditemukan atau bukan milik API key tersebut mengembalikan HTTP 404.
Contoh Request:
const axios = require('axios');
axios.post('BASE_URL/api/invoice/cancel?apikey=YOUR_API_KEY&invoice_id=YOUR_INVOICE_ID')
.then(response => console.log(response.data))
.catch(error => console.log(error.response.data));
/*
Contoh response sukses:
{
"success": true,
"invoice_id": "INV1a2b3c4d5e",
"amount": 50000,
"fee": 500,
"total": 50500,
"status": "cancelled"
}
Contoh response gagal (status bukan pending):
{
"success": false,
"error": "Invoice berstatus paid tidak bisa dibatalkan",
"status": "paid"
}
*/
FLihat Metode Withdraw
- Method: GET
- URL: /api/withdraw/methods
Parameter:
- apikey (string, wajib)
Contoh Request:
const axios = require('axios');
axios.get('BASE_URL/api/withdraw/methods?apikey=YOUR_API_KEY')
.then(response => console.log(response.data));
/*
Contoh response:
{
"manual_methods": [
{
"name": "Dana",
"method": "dana",
"fee": 100,
"min": 10000,
"max": 1000000
}
],
"instant_methods": [
{
"name": "Dana",
"method": "dana",
"fee": 100,
"min": 10000,
"max": 1000000
}
]
}
*/
GLihat Payment Tersimpan
- Method: GET
- URL: /api/withdraw/payments
Tampilkan daftar payment milik akun ini sebagai list. Pakai id sebagai payment_id saat withdraw. Payment hanya bisa ditambah atau diubah lewat halaman Profil di website.
Parameter:
- apikey (string, wajib)
Contoh Request:
const axios = require('axios');
axios.get('BASE_URL/api/withdraw/payments?apikey=YOUR_API_KEY')
.then(response => console.log(response.data));
/*
Contoh response:
{
"success": true,
"total": 2,
"payments": [
{
"id": "PAYa1b2c3d4e5",
"provider": "Dana",
"account_name": "PIANTECH",
"account_number": "08123456789",
"manual": { "available": true, "fee": 1000, "min": 10000, "max": 1000000 },
"instant": { "available": true, "fee": 1000, "min": 10000, "max": 1000000 }
},
{
"id": "PAYf6e5d4c3b2",
"provider": "GoPay",
"account_name": "PIANTECH",
"account_number": "08129876543",
"manual": { "available": true, "fee": 2000, "min": 10000, "max": 1000000 },
"instant": { "available": false }
}
]
}
*/
HMelakukan Withdraw
Withdraw hanya bisa ke payment yang sudah terdaftar dan disetujui admin lewat halaman Profil. Tujuan tidak bisa diisi manual, jadi meski API key bocor dana tidak bisa ditarik ke rekening lain.
- Method: GET
- URL: /api/withdraw
Parameter:
- apikey (string, wajib)
- amount (integer, wajib)
- payment_id (string, wajib) – ID payment dari /api/withdraw/payments
- instant (boolean, opsional, default false)
Contoh Request Manual:
const axios = require('axios');
axios.get('BASE_URL/api/withdraw?apikey=YOUR_API_KEY&amount=50000&payment_id=PAYa1b2c3d4e5&instant=false')
.then(response => console.log(response.data));
/*
Contoh response sukses (manual):
{
"success": true,
"message": "Permintaan penarikan berhasil diajukan.",
"data": {
"id": "WDc4e3f2a1b2c3",
"amount": 50000,
"fee": 1000,
"payment_id": "PAYa1b2c3d4e5",
"method": "Dana",
"account_name": "PIANTECH",
"account_number": "08123456789",
"status": "pending",
"created_at": "2025-01-01T12:00:00.000Z"
}
}
*/
Contoh Request Instan:
const axios = require('axios');
axios.get('BASE_URL/api/withdraw?apikey=YOUR_API_KEY&amount=20000&payment_id=PAYf6e5d4c3b2&instant=true')
.then(response => console.log(response.data));
/*
Contoh response sukses (instant):
{
"success": true,
"message": "Permintaan withdraw instan sedang diproses.",
"data": {
"id": "WDf3a1b2c3d4e5",
"amount": 20000,
"fee": 2000,
"payment_id": "PAYf6e5d4c3b2",
"method": "GoPay",
"account_name": "PIANTECH",
"account_number": "08129876543",
"status": "pending",
"created_at": "2025-01-01T12:05:00.000Z"
}
}
*/
ICek Status Withdraw
- Method: GET
- URL: /api/withdraw/status
Parameter:
- apikey (string, wajib)
- id (string, wajib) – ID withdraw
Contoh Request:
const axios = require('axios');
axios.get('BASE_URL/api/withdraw/status?apikey=YOUR_API_KEY&id=WDc4e3f2a1b2c3')
.then(response => console.log(response.data));
/*
Contoh response:
{
"id": "WDc4e3f2a1b2c3",
"amount": 50000,
"fee": 1000,
"method": "Dana",
"account_number": "08123456789",
"instant": false,
"status": "success",
"admin_note": null,
"created_at": "2025-01-01T12:00:00.000Z",
"completed_at": "2025-01-01T12:30:00.000Z"
}
*/