Kembali ke reseller

API reseller · v1

Dokumentasi API

Ambil stok akun digital otomatis dari bot atau website kamu, dibayar dari saldo deposit. Harga = harga reseller kamu, sama persis dengan di web.

Dasar

  • Base URL: https://waroengkuy.com/api/reseller/v1
  • Auth: header Authorization: Bearer wrk_… (atau X-API-Key). Buat key di halaman reseller → API.
  • Body POST: JSON (Content-Type: application/json); form-urlencoded juga diterima. Respons selalu JSON dengan ok true/false; gagal memuat error (pesan) & code (untuk program).
  • Nominal dalam Rupiah (integer). Waktu ISO-8601 UTC.
  • Batas: 120 baca/menit, 60 order/menit, 10 isi saldo/menit per key (HTTP 429 + retry-after).
  • Key hanya untuk server — jangan taruh di aplikasi/HTML publik. Pakai whitelist IP bila server kamu ber-IP tetap.

Wajib dibaca: ref_id (anti dobel)

Setiap POST /orders wajib membawa ref_id unik (nomor transaksi di sistemmu, 1–64 karakter: huruf, angka, . _ : -). Bila koneksi putus/timeout dan kamu tidak tahu order berhasil atau tidak, kirim ulang dengan ref_id yang sama: order yang sudah jadi dikembalikan apa adanya ("duplicate": true), saldo tidak terpotong dua kali. Jangan pernah membuat ref_id baru untuk percobaan ulang.

Endpoint

GET /balance

Cek saldo

curl https://waroengkuy.com/api/reseller/v1/balance -H "Authorization: Bearer wrk_KEY"

{ "ok": true, "reseller": { "id": 12, "name": "Toko Budi", "balance": 150000 } }

GET /products

Daftar harga + stok

price = harga reseller kamu per akun (yang dipotong dari saldo), normal_price = harga toko biasa. Hanya produk otomatis (stok akun); produk proses-manual tidak tersedia via API.

{ "ok": true, "items": [
  { "variant_id": "8", "product_id": "4", "product": "Meitu", "variant": "7 Hari",
    "category": "Akun Premium", "price": 8500, "normal_price": 10000, "stock": 80 }
] }

POST /orders

Beli pakai saldo

Body: variant_id (wajib), qty 1–50 (default 1), ref_id (wajib), max_price (opsional — tolak bila harga per akun naik di atas angka ini).

Atomik: saldo terpotong, stok diambil, dan data akun dikembalikan di respons yang sama — atau tidak terjadi apa pun sama sekali.

curl -X POST https://waroengkuy.com/api/reseller/v1/orders \
  -H "Authorization: Bearer wrk_KEY" -H "Content-Type: application/json" \
  -d '{"variant_id": 8, "qty": 1, "ref_id": "INV-0001", "max_price": 8500}'

{ "ok": true,
  "order": { "id": "3656", "ref": "WEBWRG755651774121", "ref_id": "INV-0001", "status": "success",
             "product": "Meitu — 7 Hari", "qty": 1, "price": 8500, "total": 8500, "paid_with": "saldo",
             "created_at": "2026-09-24T15:29:49.693Z",
             "accounts": ["Email : contoh@meitu.id\nPassword : rahasia123"],
             "note": "Catatan penggunaan dari admin (bisa kosong)" },
  "balance": 141500 }

Gagal tidak memotong saldo, mis. 402 insufficient_balance, 409 out_of_stock, 409 price_changed.

GET /orders/{id} · /orders?ref_id=…

Lihat ulang order + akunnya

Pakai id dari respons order, atau cari dengan ref_id milikmu. Bentuk order sama dengan POST /orders.

curl "https://waroengkuy.com/api/reseller/v1/orders?ref_id=INV-0001" -H "Authorization: Bearer wrk_KEY"

GET /orders

Riwayat order

Terbaru dulu, tanpa data akun. Parameter: limit (1–100, default 20), before_id (halaman berikut = next_before_id). Status: success · processing · pending · expired · cancelled. paid_with = saldo / qris (order web biasa).

{ "ok": true, "orders": [ { "id": "3656", "ref": "WEBWRG…", "ref_id": "INV-0001", "status": "success",
  "product": "Meitu — 7 Hari", "qty": 1, "price": 8500, "total": 8500, "paid_with": "saldo",
  "created_at": "…" } ], "next_before_id": null }

POST /deposits

Isi saldo (QRIS)

Body: amount Rp10.000–Rp10.000.000. Bayar persis amount (sudah termasuk kode unik yang ikut masuk saldo). Berlaku 30 menit; maks 3 QRIS aktif.

QR siap pakai dari WaroengPay: kirim gambar qr_url (PNG) langsung ke pembeli/bot, atau arahkan ke halaman bayar pay_url. Bisa juga render sendiri dari string qris.

{ "ok": true, "deposit": { "id": "3701", "status": "pending", "amount": 100397, "base_amount": 100000,
  "qris": "00020101021226…", "expires_at": "2026-09-24T16:10:00Z",
  "pay_url": "https://waroengpay.com/pay/WRG-…", "qr_url": "https://waroengpay.com/pay/WRG-…/qr.png" } }

GET /deposits/{id}

Status isi saldo

Saldo masuk otomatis ±1 menit setelah bayar; credited: true = sudah masuk. Cek tiap 5–10 detik, jangan lebih cepat.

{ "ok": true, "deposit": { "id": "3701", "status": "paid", "amount": 100137, "base_amount": 100000,
  "credited": true, "expires_at": "…", "paid_at": "…" }, "balance": 250137 }

GET /mutations

Mutasi saldo

kind: topup (isi saldo), order (pembelian), adjust (penyesuaian admin). amount bertanda (+ masuk / − keluar). Paginasi sama dengan /orders.

{ "ok": true, "mutations": [ { "id": "88", "kind": "order", "amount": -8500, "balance_after": 141500,
  "payment_id": "3656", "note": "Meitu — 7 Hari · WEBWRG…", "created_at": "…" } ], "next_before_id": null }

Kode error

HTTPcodeArti
400invalid_requestParameter salah/kurang (mis. ref_id kosong, qty di luar 1–50).
401unauthorizedAPI key salah, dicabut, atau reseller diblokir.
402insufficient_balanceSaldo kurang — respons memuat balance & total.
403ip_not_allowedIP server tidak ada di whitelist.
404not_foundProduk/order/endpoint tidak ada.
409out_of_stockStok kurang dari qty — respons memuat stock tersedia.
409price_changedHarga sekarang di atas max_price — respons memuat price terbaru.
429rate_limited / too_many_pendingTerlalu cepat, atau sudah ada 3 QRIS isi saldo aktif.
502upstream_errorGangguan sementara — ulangi dengan ref_id yang sama.

Contoh kode

Node.js (fetch)

const res = await fetch("https://waroengkuy.com/api/reseller/v1/orders", {
  method: "POST",
  headers: { Authorization: "Bearer " + process.env.WRK_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({ variant_id: 8, qty: 1, ref_id: invoiceNo }),
});
const j = await res.json();
if (j.ok) kirimKePembeli(j.order.accounts);
else if (j.code === "insufficient_balance") alertAdmin("Isi saldo dulu");

PHP (cURL)

$ch = curl_init("https://waroengkuy.com/api/reseller/v1/orders");
curl_setopt_array($ch, [
  CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("WRK_KEY"), "Content-Type: application/json"],
  CURLOPT_POSTFIELDS => json_encode(["variant_id" => 8, "qty" => 1, "ref_id" => $invoiceNo]),
]);
$j = json_decode(curl_exec($ch), true);
if ($j["ok"] ?? false) { $akun = $j["order"]["accounts"]; }