Dokumentasi API
Sertakan API key lewat header x-api-key. Semua respons berformat JSON.
Base URL: https://fanzotp.id/api/v1
Cara pakai
- Autentikasi: kirim header
x-api-key: API_KEY_ANDA. Parameter?apikey=di URL masih diterima demi kompatibilitas, tetapi tidak disarankan karena URL bisa tersimpan di log. - Metode:
GETuntuk mengambil data,POST(body JSON) untuk membeli, deposit, membatalkan, menyelesaikan, dan kirim ulang OTP. Endpoint POST masih menerima GET demi kompatibilitas. - Idempotency: di
/orderdan/depositkirim headerIdempotency-Key(8–100 karakter). Request ulang dengan kunci sama dalam 24 jam mengembalikan hasil yang sama dan tidak membuat transaksi kedua (respons ulang memuat headerIdempotent-Replayed: true). - Alur order: /countries → /services?country=… → /order → cek /status tiap 5 detik sampai
otpterisi. Hentikan begitu status bukanpending. - Ikon: logo aplikasi (
icon) dan bendera negara (flag_url) sudah berupa URL gambar yang bisa langsung dipakai di<img>. Tidak perlu menyimpan ikon sendiri. - Batas: 120 request per menit per API key.
Akun & Deposit
Cek saldo dan isi saldo lewat QRIS.
/profile— Info akun & saldo
curl -H "x-api-key: API_KEY_ANDA" \ "https://fanzotp.id/api/v1/profile"
{
"email": "user@email.com",
"name": "Budi",
"balance": 150000
}/deposit— Buat deposit QRIS baru. amount = saldo yang kamu terima. Tampilkan pay_amount ke pembayar (sudah termasuk biaya dan kode unik). QR berlaku 30 menit. Limit: maksimal 5 deposit berstatus pending sekaligus
curl -X POST -H "x-api-key: API_KEY_ANDA" -H "content-type: application/json" \
-d '{"amount":10000}' \
"https://fanzotp.id/api/v1/deposit"{
"id": "DEP000123",
"status": "pending",
"amount": 10000,
"pay_amount": 10367,
"fee": 367,
"qr_string": "00020101021226610014COM.GO-JEK.WWW...",
"qr_image_url": "https://fanzotp.id/api/qr?id=DEP000123&t=...",
"created_at": "2026-11-14T10:00:00+00:00",
"expires_at": "2026-11-14T10:30:00+00:00",
"paid_at": null
}/deposit/status— Cek status deposit. status: pending → paid (saldo otomatis bertambah sebesar amount) / cancelled / expired / failed
curl -H "x-api-key: API_KEY_ANDA" \ "https://fanzotp.id/api/v1/deposit/status?id=DEPOSIT_ID"
{
"id": "DEP000123",
"status": "paid",
"amount": 10000,
"pay_amount": 10367,
"fee": 367,
"paid_at": "2026-11-14T10:05:00+00:00",
...
}/deposit/cancel— Batalkan deposit pending. Deposit yang sudah dibayar tidak bisa dibatalkan
curl -X POST -H "x-api-key: API_KEY_ANDA" -H "content-type: application/json" \
-d '{"id":"DEPOSIT_ID"}' \
"https://fanzotp.id/api/v1/deposit/cancel"{
"id": "DEP000123",
"status": "cancelled",
...
}/deposits— Riwayat deposit terakhir (maks 100)
curl -H "x-api-key: API_KEY_ANDA" \ "https://fanzotp.id/api/v1/deposits?limit=20"
[
{
"id": "DEP000123",
"status": "paid",
"amount": 10000,
"pay_amount": 10367,
...
}
]Order Nomor OTP
Beli nomor virtual, terima kode SMS / WhatsApp, resend & batal.
/countries— Daftar negara. id = kode negara 2 huruf (id, us, ph, …); pakai nilai ini untuk parameter country. flag_url = gambar bendera siap tampil
curl -H "x-api-key: API_KEY_ANDA" \ "https://fanzotp.id/api/v1/countries"
[
{
"id": "id",
"name": "Indonesia",
"dial": "62",
"flag": "🇮🇩",
"flag_url": "https://flagcdn.com/w160/id.png"
}
]/services— Daftar layanan, harga & stok untuk satu negara (berbeda tiap negara). search opsional. Tanpa search hanya aplikasi populer. country = id negara (sama dengan yang kamu kirim), id = id layanan (pakai sebagai parameter service saat order). icon = logo aplikasi siap tampil
curl -H "x-api-key: API_KEY_ANDA" \ "https://fanzotp.id/api/v1/services?country=id&search=whatsapp"
[
{
"country": "id",
"id": "dz:2:wa:1234",
"service": "WhatsApp",
"icon": "https://fanzotp.id/app-icons/wa.webp",
"price": 2380,
"stock": 171
}
]/order— Beli nomor. Saldo dipotong sesuai harga. quantity 1–5 (opsional). quantity > 1 → respons {success, failed, orders[]}. Kirim header Idempotency-Key supaya request yang diulang tidak membuat order ganda
curl -X POST -H "x-api-key: API_KEY_ANDA" -H "content-type: application/json" \
-d '{"country":"id","service":"dz:2:wa:1234","quantity":1}' \
"https://fanzotp.id/api/v1/order"{
"id": "ORD000123",
"number": "6283180946481",
"otp": null,
"status": "pending",
"service": "WhatsApp",
"country": "Indonesia",
"price": 2897,
"created_at": "2026-11-14T10:00:00+00:00",
"expires_at": "2026-11-14T10:20:00+00:00"
}/status— Cek status & OTP order. status: pending → received (OTP masuk) → completed / cancelled / expired. otp bernilai null selama belum masuk
curl -H "x-api-key: API_KEY_ANDA" \ "https://fanzotp.id/api/v1/status?id=ORDER_ID"
{
"id": "ORD000123",
"number": "6283180946481",
"otp": "482915",
"status": "received",
"service": "WhatsApp",
"country": "Indonesia",
"price": 2897,
...
}/resend— Kirim ulang OTP ke nomor yang sama. Hanya untuk order yang masih aktif
curl -X POST -H "x-api-key: API_KEY_ANDA" -H "content-type: application/json" \
-d '{"id":"ORDER_ID"}' \
"https://fanzotp.id/api/v1/resend"{
"id": "ORD000123",
"otp": "482915",
"status": "received",
"resend": true,
...
}/cancel— Batalkan order (refund saldo). Ada waktu tunggu minimum setelah order. Order yang sudah dapat OTP tidak bisa dibatalkan
curl -X POST -H "x-api-key: API_KEY_ANDA" -H "content-type: application/json" \
-d '{"id":"ORDER_ID"}' \
"https://fanzotp.id/api/v1/cancel"{
"id": "ORD000123",
"status": "cancelled",
"price": 2897,
...
}/finish— Tandai order selesai. Hanya untuk order yang masih aktif
curl -X POST -H "x-api-key: API_KEY_ANDA" -H "content-type: application/json" \
-d '{"id":"ORDER_ID"}' \
"https://fanzotp.id/api/v1/finish"{
"id": "ORD000123",
"status": "completed",
...
}/history— Riwayat order terakhir (maks 100)
curl -H "x-api-key: API_KEY_ANDA" \ "https://fanzotp.id/api/v1/history?limit=20"
[
{
"id": "ORD000123",
"service": "WhatsApp",
"number": "6283180946481",
"otp": "482915",
"status": "completed",
"price": 2897,
"created_at": "2026-11-14T10:00:00+00:00"
}
]Kode Status & Respons Gagal
Jika gagal, API mengembalikan HTTP status selain 200 dan field error (kode untuk program) serta detail (teks untuk dibaca manusia). Cek HTTP status dulu, lalu tampilkan detail ke pengguna Anda.
Periksa header x-api-key.
{
"success": false,
"error": "UNAUTHORIZED",
"detail": "API key tidak valid"
}Hubungi admin.
{
"success": false,
"error": "ACCOUNT_SUSPENDED",
"detail": "Akun disuspend"
}Saldo kurang dari harga layanan. Lakukan deposit lalu ulangi order.
{
"success": false,
"error": "INSUFFICIENT_BALANCE",
"detail": "Saldo tidak cukup, silakan deposit dulu"
}Ambil ulang /services lalu pilih layanan lain.
{
"success": false,
"error": "OUT_OF_STOCK",
"detail": "Layanan tidak tersedia / stok habis, ambil ulang /services"
}Cek parameter wajib endpoint yang dipanggil.
{
"success": false,
"error": "MISSING_PARAMETER",
"detail": "Parameter country dan service wajib diisi"
}Di bawah minimum atau di atas maksimum (Rp10.000.000).
{
"success": false,
"error": "INVALID_AMOUNT",
"detail": "Minimal deposit Rp 2.000"
}Misalnya membatalkan order yang sudah selesai atau sudah dapat OTP.
{
"success": false,
"error": "INVALID_STATE",
"detail": "Order sudah tidak bisa dibatalkan"
}Tunggu sesuai waktu minimum lalu coba lagi.
{
"success": false,
"error": "CANCEL_TOO_EARLY",
"detail": "Order baru bisa dibatalkan 45 detik lagi"
}Id salah, atau bukan milik akunmu.
{
"success": false,
"error": "NOT_FOUND",
"detail": "Order tidak ditemukan"
}Ambil ulang /countries dan /services.
{
"success": false,
"error": "SERVER_CHANGED",
"detail": "Server sedang diganti, ambil ulang /countries dan /services"
}Batas 120 request per menit per API key. Kalau terlalu banyak deposit pending, errornya TOO_MANY_PENDING.
{
"success": false,
"error": "RATE_LIMITED",
"detail": "Terlalu banyak request, coba lagi sebentar"
}Layanan sementara dimatikan. Coba lagi nanti.
{
"success": false,
"error": "MAINTENANCE",
"detail": "Sedang maintenance, deposit sementara dinonaktifkan. Coba lagi nanti."
}Contoh Kode Program
Contoh lengkap: order 1 nomor, lalu cek OTP otomatis tiap 5 detik sampai OTP masuk atau waktu order habis. Simpan API key di environment server, jangan di kode front-end.
<?php
$base = 'https://fanzotp.id/api/v1';
$key = getenv('FANZOTP_KEY');
function api($path, $body = null) {
global $base, $key;
$ch = curl_init($base . $path);
$headers = ["x-api-key: $key", 'content-type: application/json'];
if ($body !== null) {
$headers[] = 'Idempotency-Key: ' . bin2hex(random_bytes(16));
curl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode($body)]);
}
curl_setopt_array($ch, [CURLOPT_HTTPHEADER => $headers, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
if (isset($res['error'])) {
throw new Exception($res['error'] . ': ' . $res['detail']);
}
return $res;
}
try {
// 1. Order nomor (tambahkan 'quantity' => 5 untuk 5 nomor sekaligus)
$order = api('/order', ['country' => 'id', 'service' => 'dz:2:wa:1234']);
echo "Nomor: {$order['number']} (ID: {$order['id']})\n";
// 2. Cek OTP tiap 5 detik sampai masuk atau waktu habis
while (true) {
sleep(5);
$st = api('/status?id=' . $order['id']);
if (!empty($st['otp'])) { echo "OTP: {$st['otp']}\n"; break; }
if ($st['status'] !== 'pending' || time() > strtotime($st['expires_at'])) {
echo "OTP tidak masuk, status: {$st['status']}\n"; break;
}
echo "Menunggu OTP...\n";
}
} catch (Exception $e) {
echo 'Gagal: ' . $e->getMessage() . "\n";
}Keamanan Transaksi
- Kamu hanya bisa melihat dan mengubah order dan deposit milik akunmu sendiri; id milik orang lain dijawab
NOT_FOUND. - Saldo deposit ditambahkan satu kali per pembayaran, walau status dicek berkali-kali.
- Order yang sudah selesai, dibatalkan, atau kedaluwarsa tidak bisa dibatalkan atau diselesaikan lagi.
- Saldo dikembalikan otomatis kalau order dibatalkan atau tidak mendapat OTP.