Home / Developer docs / Payouts and refunds
Payouts and refunds
Payouts to players and on-chain payouts only use the merchant's own balance; a refund is a request that runs only after the merchant owner approves it with the payment PIN. This page covers payouts, collect merchant refunds and escrow checkouts.
- API host
https://open.e8qianbao.com - Path prefix
/partner/v1 - Based on the API notes of 2026-11-29
Payouts and chain payouts
Only that collect merchant's own balance is spent. When it is short you get MERCHANT_INSUFFICIENT_BALANCE (409); platform funds never cover it and bonds are never used. amount has at most 6 decimals (same for USDT, TRX and EB), and asset defaults to USDT.
Every request needs an Idempotency-Key. After a timeout or an unclear answer, resend with the same Idempotency-Key and exactly the same body to get the original payout and its current status; never retry with a new key, or the player may be paid twice. The same key with different content returns IDEMPOTENCY_MISMATCH (409). Save the key with your own payout record before sending.
| Method | Path | Description |
|---|---|---|
| POST | /partner/v1/collect/payouts | Pay out to a player's E8 wallet. Body: customer_ref, amount, asset (USDT / TRX / EB), user_ref (Telegram ID, @username or receive code), optional memo. The player must already have an E8 wallet; payouts to the merchant owner's own account are refused (SELF_PAYOUT); a developer key pays only recipients the merchant confirmed (see Developer accounts) |
| POST | /partner/v1/collect/chain-payouts | Pay to a player's on-chain address. Body: customer_ref, amount, asset, to_address, optional memo, optional network. Without network or with TRC20: a TRON address (34 characters) and asset USDT / TRX; with ERC20: an Ethereum address (0x plus 40 characters) and asset USDT / USDC |
| POST | /partner/v1/collect/chain-payouts/{payout_id}/approve | Pays out only after your manual approval: the 24-hour limit is checked again at that moment (409 PAYOUT_DAILY_LIMIT when over it; the payout stays pending_review); a payout waiting more than 48 hours returns 409 PAYOUT_EXPIRED; a developer key approves only payouts it made (NOT_DEVELOPER_PAYOUT); a payout a developer made is also checked against the developer's combined limit when you approve it (DEVELOPER_PAYOUT_LIMIT) |
| POST | /partner/v1/collect/chain-payouts/{payout_id}/reject | Reject this on-chain withdrawal (a developer key rejects only payouts it made) |
| POST | /partner/v1/collect/payout-mode | Body {"auto": false}: turns automatic payouts off, so later chain withdrawals wait for review and you call approve or reject. The API cannot turn automatic payouts on: {"auto": true} returns 403 AUTO_PAYOUT_NEEDS_PIN (or echoes the state if already on); the merchant owner turns it on in the Mini App's API access page with the payment PIN |
# Save the key with your own payout record before sending. On a timeout or an unclear answer,
# send the SAME key with the SAME body again: you get the original payout and its current status.
key = "payout-u1001-20261127-0001"
status, doc = call("POST", "/partner/v1/collect/payouts",
{"customer_ref": "u1001", "amount": "25.5", "asset": "USDT", "user_ref": "@player"},
idempotency_key=key)
if doc.get("code") == "MERCHANT_INSUFFICIENT_BALANCE":
pass # nothing was created: top up the merchant wallet, then resend with the same key and body
The API payouts switch and the 24-hour limit
- API payouts are off by default, and while off the five endpoints above return 403
PAYOUT_NOT_ENABLED. Only the merchant owner can turn them on or off in the Mini App's API access page: since 2026-11-29 turning API payouts or automatic payouts on and raising the limit take the payment PIN, turning off and lowering do not; the bot reports every change. A key cannot turn them on. - API payouts of each merchant have a daily allowance per rolling 24 hours, which the merchant owner sees in the Mini App's API access page: payouts and chain payouts together, with EB and ERC20 USDC payouts counted as USDT; rejected or fully returned chain payouts do not count. When the platform changes the allowance it tells the merchant owner. Beyond it you get 409
PAYOUT_DAILY_LIMIT, with nothing created and nothing charged. A chain payout counts from the moment it is released: at creation with automatic payouts, at approval otherwise; an approval checks the limit again at that moment, counting what was already released plus this payout. - The merchant owner sees the daily allowance in the Mini App's API access page and can set a lower limit within it (down to 0) or raise it back (raising takes the payment PIN); contact support for more.
- While the merchant owner is frozen by risk control, nothing can be paid out (
WITHDRAWAL_FROZEN) and chain payouts cannot be approved (rejecting still works). - Every API payout is reported to the merchant owner in real time (amount, masked recipient, player, status); beyond 5 in a minute for the same owner, the rest are merged into one summary per minute.
- A chain payout waits for review for at most 48 hours: after that it can no longer be approved (
PAYOUT_EXPIRED); the platform marks itrejectedwitherror_codePAYOUT_EXPIREDand calls back and tells the merchant owner as for a rejection. Nothing is held while a payout waits, so nothing moves; to pay it, send a new request with a newIdempotency-Key.
Statuses and results
- A payout to an E8 wallet ends in
completedand sendscollect.payout_completed, whosedataholdspayout_id,customer_ref,asset,amount,destination_type,to_ref,status,error_code,memo,created_at. - Chain payouts:
pending_review→approved→processing→completed; orrejected/failed. With automatic payouts they skippending_review; some chain payouts need a platform check and stayprocessingmeanwhile. A payout not reviewed within 48 hours becomesrejected(error_codePAYOUT_EXPIRED). - On
failed,error_codeisPAYOUT_REJECTED(rejected by the platform),PAYOUT_FAILEDorCHAIN_FAILED(payout failed), orMERCHANT_INSUFFICIENT_BALANCE, and the money is back in the merchant balance.PARTIAL_PAIDmeans part reached the player's address and the rest is back in the merchant balance: pay the difference by what actually arrived, never the whole amount again. - Query a payout with
GET /partner/v1/collect/payouts/{payout_id}orGET /partner/v1/collect/chain-payouts/{payout_id}; every state a chain payout reaches also comes as the callbackcollect.chain_payout_updated(see Order queries and reconciliation). Sending the same POST again with the sameIdempotency-Keyand exactly the same body still returns the payout's current status and never pays twice; do not retry with a new key. - Chain payout responses also carry
payout_id,to_address,from_address(reserved,null),error_code,memo,created_atandauto(the current automatic payout switch). - Payouts to the platform's own addresses (
INVALID_ADDRESS) or to any deposit address on the platform, including the deposit addresses you gave players, merchant receive addresses and other E8 users' deposit addresses (INTERNAL_ADDRESS), are refused at request time, with nothing created and nothing charged. To pay an E8 user, use a payout to their wallet.
ERC20 chain payouts
- Add
"network": "ERC20"to the body;assetcan only beUSDTorUSDC, andto_addressis an Ethereum address (0xplus 40 characters; with mixed case the checksum must be right). ETH cannot be paid out. - There is a fee: the platform fee plus Ethereum gas at the quote at request time, plus a cross-network service fee when the USDT came from TRC20 deposits. The fee is taken from the merchant balance together with the amount, so the player receives the full
amount; responses addnetwork(ERC20) andfee(once the payout is created). TRC20 payouts have no payout fee and unchanged responses. - There is a minimum per payout (below it:
WITHDRAW_TOO_SMALL). A single payout above the ERC20 automatic payout amount returns 409PAYOUT_NEEDS_REVIEW, with nothing created and nothing charged: split it into smaller amounts or use TRC20. Merchants with automatic payouts off can also get this code on approve; the payout then stayspending_review, so reject it and resend as described above. - Ethereum finality takes about 15–20 minutes, during which the status is
processing; on failure the amount and the fee all return to the merchant balance. While closed it returns 403NETWORK_NOT_ENABLED, with nothing created and nothing charged.
When the balance is short
The merchant balance comes from on-chain deposits to player addresses, buyer payments (both minus the collection fee), the owner moving funds in from the personal wallet, and the merchant wallet's own receive address. On MERCHANT_INSUFFICIENT_BALANCE, top up first: the merchant owner switches to the merchant wallet on the wallet page of the E8 Wallet Mini App and taps Move funds in to move USDT, TRX or EB from the personal wallet (USDT and TRX pay the merchant's collection fee rate, EB is free). A request that returned 409 directly created nothing: after topping up, resend with the same Idempotency-Key and body. A payout that was created and later ended failed with MERCHANT_INSUFFICIENT_BALANCE has returned the money: after topping up, start again with a new key.
Collect merchant refunds
Since 2026-11-27 a collect merchant's wallet orders (and unmatched receipts at their addresses) can be refunded. Flow: request → the merchant owner approves with the payment PIN → execution. When your server, the developer you authorized or the E8 buyer who paid files a request, no money moves: a refund is paid only after the merchant owner enters their own payment PIN in the E8 bot or the Mini App, and one PIN can approve several. Rejecting needs no PIN; requests nobody handles expire after 7 days.
Platform staff can neither start nor approve a refund. The platform never refunds from a merchant's balance on its behalf and never advances money; whether to refund is the merchant's decision.
Who can request a refund
| Source | How | Conditions |
|---|---|---|
Your server or the developer you authorized (source: api / developer) | The refund endpoints below | The key has the collect:refund scope and the merchant owner turned on API refunds on the Mini App's API access page (off by default; turning it on or off takes a confirmation, not the payment PIN, and the owner is told each time; while it is off you get 403 REFUND_NOT_ENABLED). API payouts do not need to be on and a developer does not need payout permission: money moves only after the merchant enters the payment PIN |
The E8 buyer who paid (buyer) | Request a refund on the bot's payment notice, or in the Mini App | Only the E8 user who paid: from the E8 balance, or the person you named with payer_telegram_id; one open buyer request per order at a time; at most 10 per buyer per day |
The merchant owner (owner) | The Mini App refund page (the Refund button on the bot's payment notice opens it) | Refunds directly with the payment PIN; the API refunds switch is not needed |
Web buyers without Telegram ask on your own website (giving a chain address), and your server files the request through the API.
Where the money goes
{"type": "payer_wallet"}: back to the E8 wallet that paid, booked inside E8, instant, not on chain. Only for orders paid from an E8 balance, and only to the original payer; other orders return 409PAYER_WALLET_UNKNOWN.{"type": "chain", "network": "TRC20" | "ERC20", "to_address": "…"}: to a chain address the buyer gives. It is an ordinary chain payout: it shows in/partner/v1/collect/chain-payoutswithcustomer_refe8refund.<refund id>(a prefix reserved for refunds: thecustomer_refof an API payout cannot use it, 422CUSTOMER_REF_RESERVED, and theIdempotency-Keyof a chain payout cannot start with it, 422INVALID_IDEMPOTENCY_KEY) and a memo naming your order number, andcollect.chain_payout_updatedfires as usual. ERC20 must be open for your merchant (otherwise 403NETWORK_NOT_ENABLED), and its network fee is taken from the merchant balance on top.- The platform never refunds to the address a payment came from: it is often an exchange address the buyer cannot receive at.
A wrong chain address, or someone else's, means the money cannot be recovered. Check the address and network with the buyer before approving. Platform addresses return 422 INVALID_ADDRESS; deposit addresses inside E8 return 400 INTERNAL_ADDRESS (to refund an E8 user, use payer_wallet).
Rules
- Only paid (
paid) orders, within 90 days of payment (409REFUND_WINDOW_CLOSED); a refunded order stayspaid. - Partial refunds are allowed, in total at most the order amount; requests still waiting count when a new one is filed (409
REFUND_EXCEEDS_ORDER), and approval checks again, so approving several at once never exceeds it. At most 5 refunds per order (409REFUND_LIMIT_REACHED, waiting requests included). - Collection fees are not refunded: the whole refund comes from the merchant balance (a 50 USDT order that paid a 0.5 fee still takes 50 from the merchant balance for a full refund). If the balance is short, nothing happens and the request keeps waiting (409
MERCHANT_INSUFFICIENT_BALANCE); move funds in, then approve again. - Orders paid from a USDC balance are refunded in USDT. An unmatched receipt refunds at most the
netthat reached the merchant balance (after the fee), in its own coin (USDT on TRC20 or ERC20, USDC on ERC20 only, TRX on TRC20 only), and only to a chain address. - Limits: refunds to E8 wallets have a cap per rolling 24 hours, which the merchant owner sees in the Mini App (above it: 409
REFUND_DAILY_LIMIT). The merchant owner lowers it in the Mini App with a confirmation and raises it, up to the platform ceiling, with the payment PIN; the platform changes the ceiling after review. Chain refunds count against the 24-hour API payout limit (409PAYOUT_DAILY_LIMIT). - Payment PIN: for 72 hours after a PIN reset the owner cannot approve any refund (
PIN_RESET_HOLD), and for 24 hours after a PIN change no chain refund (WITHDRAW_PIN_HOLD), as with withdrawals. - While the platform reviews the merchant (funds on hold), refunds cannot be approved or made (409
MERCHANT_FUNDS_HELD), as with moving funds out and payouts; requests can still be filed and handled once the review ends.
Refund endpoints
| Method | Path | Scope | Description |
|---|---|---|---|
| POST | /partner/v1/collect/orders/{order_id}/refunds | collect:refund | File a refund request for an order, Idempotency-Key required. Body: amount (a string), destination, reason (optional, up to 200 characters, shown on the owner's approval card). 201 the first time, 200 with Idempotent-Replayed: true on a replay |
| POST | /partner/v1/collect/unmatched/{unmatched_id}/refunds | collect:refund | File a refund request for an unmatched receipt, as above, chain only |
| GET | /partner/v1/collect/refunds | collect:read | Refunds, newest first; filter by status, order_id, unmatched_id, since, with limit and cursor |
| GET | /partner/v1/collect/refunds/{refund_id} | collect:read | One refund (status, destination, chain hash) |
| GET | /partner/v1/collect/orders/{order_id}/refunds | collect:read | All refunds of one order |
Every request needs an Idempotency-Key. The same key with the same body returns the original refund and its current status, never a second one; the same key with a different body returns 409 IDEMPOTENCY_MISMATCH. After a timeout, resend with the same key, never a new one. Filing requests is also limited to 30 per client per minute.
# Scope collect:refund, with the merchant owner's API refunds switch on. Nothing moves until the owner
# approves with the payment PIN. Keep the key with your own refund record; on a timeout resend the same key and body.
status, doc = call("POST", f"/partner/v1/collect/orders/{order_id}/refunds",
{"amount": "20.00",
"destination": {"type": "chain", "network": "TRC20", "to_address": "T…"},
"reason": "returned goods"},
idempotency_key=f"rf-{order_id}-1")
# 201 (200 with Idempotent-Replayed: true on a replay):
# {"refund_id": "…", "order_id": "…", "external_ref": "AD263152207211.822", "unmatched_id": null,
# "asset": "USDT", "amount": "20", "paid_amount": null,
# "destination": {"type": "chain", "network": "TRC20", "to_address": "T…"},
# "status": "awaiting_merchant", "status_label": "…", "reason": "returned goods", "decision_note": null,
# "error_code": null, "txid": null, "source": "api", "source_label": "…", "payout_id": null,
# "decided_via": null, "created_at": "…", "expires_at": "…", "decided_at": null, "updated_at": "…"}
Statuses
status | Meaning |
|---|---|
awaiting_merchant | Waiting for the merchant owner; no money moved. Becomes expired if not handled before expires_at |
approved | Approved with the owner's payment PIN (moves on at once) |
processing | A chain refund being paid out; payout_id is its chain payout |
completed | Refunded: E8 wallet refunds complete at once; chain refunds are on chain and txid is the hash |
failed | The chain payout failed and the money is back in the merchant balance; error_code as for chain payouts (such as PAYOUT_REJECTED, CHAIN_FAILED); with PARTIAL_PAID, paid_amount is what arrived and counts as refunded |
rejected | Rejected by the merchant; decision_note is the merchant's reason (the buyer sees it too) |
expired | Nobody handled it within 7 days |
Refund callbacks
collect.refund_requestedfires once when a request is created (from any source, including the owner's direct refunds); thencollect.order_refundedfires once for each status reached (approved,processing,completed,failed,rejected,expired).completed/failed/rejected/expiredare final.- In
data,to_addressis masked; refunds of unmatched receipts addunmatched_id; withdestinationpayer_wallet,networkandto_addressarenull;refunded_totalis what the order has had refunded so far. - Order queries (
GET /partner/v1/collect/orders/{id}, the list and the lookup by order number) gain a trailingrefunded_amountonce something was refunded (in progress included); orders never refunded return exactly what they did before.
{
"id": "…", "type": "collect.order_refunded", "created_at": "…", "test": false, "environment": "chain",
"data": {
"refund_id": "…", "order_id": "…", "external_ref": "AD263152207211.822",
"amount": "20", "asset": "USDT", "destination": "chain", "network": "TRC20", "to_address": "TQn9Y2…k5Ba",
"status": "completed", "source": "api", "reason": "returned goods", "txid": "…", "error_code": null,
"paid_amount": null, "refunded_total": "20", "expires_at": null, "created_at": "…"
}
}
Refund error codes
| Error code | HTTP | Meaning |
|---|---|---|
REFUND_NOT_ENABLED | 403 | The merchant owner has not turned on API refunds |
REFUND_EXCEEDS_ORDER | 409 | More than can still be refunded (waiting requests included) |
REFUND_WINDOW_CLOSED | 409 | More than 90 days since payment |
REFUND_LIMIT_REACHED | 409 | The order already has 5 refunds (waiting requests included) |
REFUND_DAILY_LIMIT | 409 | Refunds to E8 wallets over the 24-hour limit (on approval) |
PAYER_WALLET_UNKNOWN | 409 | Not paid from an E8 balance, or the payer's wallet cannot receive now: refund to a chain address |
ORDER_NOT_PAID | 409 | The order is not paid |
REFUND_REQUEST_OPEN | 409 | The order already has a buyer's request waiting for the merchant |
REFUND_NOT_PENDING | 409 | The request was already handled (when the owner decides) |
REFUND_DESTINATION_INVALID / REFUND_NETWORK_INVALID | 422 | destination is invalid, or the coin cannot go out on that network |
UNSUPPORTED_ASSET | 422 | Unmatched receipts in this coin cannot be refunded (such as ETH) |
ORDER_NOT_FOUND / UNMATCHED_NOT_FOUND / REFUND_NOT_FOUND | 404 | No such order, unmatched receipt or refund, or it is not yours |
MERCHANT_FUNDS_HELD | 409 | The merchant's funds are on hold during a platform review, so refunds cannot run (requests stay) |
For MERCHANT_INSUFFICIENT_BALANCE, PAYOUT_DAILY_LIMIT, IDEMPOTENCY_MISMATCH, INVALID_ADDRESS and INTERNAL_ADDRESS see Rate limits and error codes.
How the merchant owner decides
- The bot sends a card for each request (order number, source, amount, destination with the full chain address, reason) with Approve refund (shows it again, then asks for the payment PIN on a shuffled keypad) and Reject (with an optional reason the buyer sees); past 5 a minute the rest arrive in one digest.
- In the Mini App's Refunds → Pending, the owner ticks several, sees the total first (nothing moves), then approves them with one payment PIN; each runs on its own with its own result, and one failing for lack of balance or limit does not affect the others. The owner can also find an order by its order number in the Mini App and refund it directly, or refund an unmatched receipt.
Escrow checkouts (with refunds)
Escrow merchants create a checkout and send the returned checkout_url to the buyer; the buyer checks it in Telegram and pays with the payment PIN, the money is held in platform escrow, and after receipt is confirmed it is settled to the merchant minus the fee. The platform cannot order for the buyer, and the merchant cannot pay for the buyer.
| Method | Path | Scope | Description |
|---|---|---|---|
| POST | /partner/v1/orders | orders:write | Create a checkout: external_ref, title, description (optional), amount (string with two decimals), expires_in_minutes (5–1440), payer_telegram_id (optional; then only that user can pay). The same external_ref with the same content returns the same checkout (201 first; 200 on repeats with the Idempotent-Replayed: true header); different content returns EXTERNAL_REF_REUSED |
| GET | /partner/v1/orders | orders:read | List, optionally filtered by status, external_ref, limit (default 20, max 100) and offset; returns items and total |
| GET | /partner/v1/orders/{id} | orders:read | One checkout. status is pending, accepted, cancelled or expired |
| POST | /partner/v1/orders/{id}/cancel | orders:write | Cancel a checkout the buyer has not confirmed |
| POST | /partner/v1/orders/{id}/deliver | orders:write | Confirm delivery (the order must be paid), optionally with an Idempotency-Key: resending the same key does not run it twice and returns the current state with Idempotent-Replayed: true |
| POST | /partner/v1/orders/{id}/refund | orders:write | Refund the buyer in full on your own initiative (paid orders not completed yet), with Idempotency-Key as above |
| POST | /partner/v1/webhooks/test | webhooks:test | Send one test callback: without a body, type webhook.test; a collect merchant may send event_type to test by event type, see Test callbacks. test is true, sent once and never retried; the returned delivered says whether a 2xx came back |
| GET | /partner/v1/statements | orders:read | Daily statements (Beijing calendar day, built after the day ends); see Order queries and reconciliation |
The body of deliver and refund is a JSON object that may carry note (up to 500 characters); send {} without a note.
# Escrow checkout (scope orders:write): full refund of a paid order that is not completed yet.
status, doc = call("POST", f"/partner/v1/orders/{partner_order_id}/refund",
{"note": "out of stock"}, idempotency_key=f"refund-{partner_order_id}")
Refunds: an escrow checkout is refunded in full with POST /partner/v1/orders/{id}/refund. For a collect merchant's orders see Collect merchant refunds: after a request, money moves only once the merchant owner approves with the payment PIN.