Dokumentasi API

Integrasi pembayaran ke aplikasi Anda

1.Persiapan

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.

Simpan API Key Anda di tempat yang aman. Jangan bagikan ke siapa pun. Jika bocor, segera generate ulang di menu Profil.

2.Cek Saldo & Profil
Method: GET
URL: /api/profile
Parameter
Nama Tipe
apikey string
Contoh Request
Node.js
const baseUrl = 'BASE_URL';
const apiKey  = 'YOUR_API_KEY';

const res  = await fetch(`${baseUrl}/api/profile?apikey=${apiKey}`);
const data = await res.json();

console.log(data);

// Contoh Response (200 OK):
// {
//   "username": "your_username",
//   "email": "[email protected]",
//   "balance": 150000,
//   "pending_balance": 100000
// }
3.Membuat Invoice
Method: GET
URL: /api/createinvoice
Parameter
Nama Tipe
apikey string
amount integer
Contoh Request
Node.js
const baseUrl = 'BASE_URL';
const apiKey  = 'YOUR_API_KEY';

const res = await fetch(
  `${baseUrl}/api/createinvoice?apikey=${apiKey}&amount=50000`
);
const data = await res.json();

console.log(data);

// Contoh Response (200 OK):
// {
//   "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"
// }

Gunakan nilai payment_link atau qris_image untuk menampilkan halaman pembayaran kepada customer.

4.Cek Status Invoice
Method: GET
URL: /api/checkinvoice
Parameter
Nama Tipe
apikey string
id string
Contoh Request
Node.js
const baseUrl   = 'BASE_URL';
const apiKey    = 'YOUR_API_KEY';
const invoiceId = 'YOUR_INVOICE_ID';

const res = await fetch(
  `${baseUrl}/api/checkinvoice?apikey=${apiKey}&id=${invoiceId}`
);
const data = await res.json();

console.log(data);

// Contoh Response (200 OK):
// {
//   "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",
//   "balance_after": 500000,
//   "completed_at": "2025-01-01 11:35:00"
// }

Parameter id juga bisa dikirim dengan nama invoice_id untuk kompatibilitas.

5.Webhook

Webhook memungkinkan sistem Anda menerima notifikasi real-time ketika ada transaksi deposit yang berhasil dibayar (status paid) — tanpa perlu melakukan polling ke API kami.

Format Request yang Kami Kirim
HTTP Request
POST <URL webhook Anda>
Content-Type: application/json
X-Webhook-Event: deposit.paid
X-Webhook-Id: <log_id>
X-Webhook-Attempt: 1
User-Agent: PixPayz-Webhook/1.0
Body (JSON Payload)
application/json
{
  "event": "deposit.paid",
  "created_at": "2025-01-01T12:00:00.000Z",
  "data": {
    "id": "TRX...",
    "reference": "TRX...",
    "type": "deposit",
    "amount": 10000,
    "fee": 123,
    "total": 10123,
    "status": "paid",
    "qris_image": "https://...",
    "created_at": "2025-01-01T11:55:00.000Z",
    "completed_at": "2025-01-01T12:00:00.000Z",
    "balance_after": 10123
  }
}
Response yang Kami Harapkan

HTTP 2xx → dianggap sukses, selesai

Selain 2xx atau timeout (15 detik) → otomatis retry

Kebijakan Retry Otomatis

Total 5 percobaan dengan jeda bertingkat: 1 menit → 5 menit → 15 menit → 1 jam → 6 jam. Anda juga bisa melakukan retry manual dari halaman Riwayat Webhook.

Pastikan endpoint Anda selalu membalas HTTP 2xx secepat mungkin (idealnya < 5 detik). Jika butuh proses lama, simpan payload dulu lalu proses di background (queue) agar tidak timeout.

Pixpayz Support