Partner API

Top up ROS LD diamonds to any Player ID from your own server. Diamonds arrive in the player's in-game Mail at once (the player taps Claim). Every top-up is added to what you owe; pay it from the dashboard with ABA KHQR whenever you like, and before you reach your credit limit.

ភាសាខ្មែរ៖ API នេះសម្រាប់ម៉ាស៊ីនមេរបស់អ្នក។ ផ្ញើ Player ID កញ្ចប់ និង ref (លេខបញ្ជាទិញរបស់អ្នក) ហើយពេជ្រនឹងចូលប្រអប់សំបុត្ររបស់អ្នកលេងភ្លាមៗ។

Authentication

Create an API key in the dashboard (API keys → Create key). It is shown once; we only keep a fingerprint. Send it in every request:

Authorization: Bearer rldp_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Money and credit

Idempotency: ref

Every top-up carries ref: your own order id, 1–64 characters A-Z a-z 0-9 . _ : -, unique within your account. It makes retries safe:

Endpoints

GET/api/v1/packs

The diamond packs and what each costs you.

{"packs": [
  {"id": "d10000",   "diamonds": 10000,   "price_cents": 100,  "cost_cents": 80},
  {"id": "d100000",  "diamonds": 100000,  "price_cents": 900,  "cost_cents": 720},
  {"id": "d1000000", "diamonds": 1000000, "price_cents": 8000, "cost_cents": 6400}
]}

GET/api/v1/players/{player_id}

Check a Player ID and get the in-game name, to show your customer before they pay you. Always do this first: a wrong ID is the most common mistake.

GET /api/v1/players/100003
→ 200 {"id": 100003, "nickname": "Carol"}
→ 404 {"error": "player_not_found", "message": "No player has this ID."}

POST/api/v1/topups

Send a pack to a player. The diamonds are mailed at once.

FieldTypeMeaning
player_idnumberThe player's Player ID (in game: profile).
packstringA pack id from GET /packs, e.g. d10000.
refstringYour own order id, unique per top-up (see ref).
POST /api/v1/topups
{"player_id": 100003, "pack": "d10000", "ref": "order-1001"}

→ 201 Created
{"order_id": 512, "ref": "order-1001", "player_id": 100003, "nickname": "Carol",
 "pack": "d10000", "diamonds": 10000, "price_cents": 100, "cost_cents": 80,
 "status": "sent", "duplicate": false, "created": 1764651000}

GET/api/v1/topups/{ref}

One top-up by your ref (same fields as above). 404 not_found = no top-up was sent with this ref.

GET/api/v1/topups?limit=50&before={order_id}

Your top-ups, newest first. limit 1–200 (default 50). For the next page pass before = the next_before of the answer.

{"topups": [ {...}, {...} ], "next_before": 498}

GET/api/v1/balance

{"owed_cents": 2400, "credit_limit_cents": 10000, "available_cents": 7600, "share": 20}

share is your discount in percent. owed_cents below zero means you have credit.

Errors

Every error is JSON: {"error": "code", "message": "words for people"}. Act on error; show message.

HTTPerrorWhat to do
400bad_request, bad_ref, bad_pack, bad_player_idFix the request.
401unauthorizedKey missing, wrong or revoked.
402credit_limitOver your credit limit (owed_cents, limit_cents in the answer). Pay with KHQR, then retry.
403partner_suspended, not_approved, ip_not_allowedContact us / check your IP allow-list.
404player_not_found, not_foundWrong Player ID / no such top-up.
409ref_usedThis ref belongs to another top-up: use a new ref.
429slow_downToo many calls; wait (Retry-After header).
502game_unavailable, game_errorCheck GET /topups/{ref}, then retry with the same ref.

Rate limits

Full examples

KEY="rldp_…"   # from the dashboard, keep it secret
BASE=https://platform.banteaystudio.com/api/v1

# 1. check the player
curl -s -H "Authorization: Bearer $KEY" $BASE/players/100003

# 2. top up (same ref = safe to retry)
curl -s -X POST $BASE/topups \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"player_id":100003,"pack":"d10000","ref":"order-1001"}'

# 3. after a timeout: was it sent?
curl -s -H "Authorization: Bearer $KEY" $BASE/topups/order-1001

Go-live checklist

  1. Look up the Player ID and show the nickname to your customer before taking their money.
  2. Use a unique ref per order (your own order number) and keep it.
  3. On timeouts / 502, check GET /topups/{ref} before retrying; retry with the same ref.
  4. Watch GET /balance and pay with KHQR before you reach your limit.
  5. Set the IP allow-list to your server's address.
  6. Questions: Telegram.