Designing coin top-ups and host payouts for a live-streaming app without paying twice
By the PAYJN Operations team
Live-streaming and social apps run two money flows that look similar but behave very differently: users buy coins, and hosts withdraw earnings. Most of the expensive bugs we see come from treating them as one flow.
Two flows, two ledgers
| User top-up | Host payout | |
|---|---|---|
| Who moves money | The user pays from a wallet | The platform pays the host |
| Trigger | A coin purchase | An approved payable |
| Proof | Verified callback or status query | Final payout status |
| Typical bug | Coins credited twice | Payout sent twice after a timeout |
Keep three balances separate: purchased coins, host earnings, and agency shares. If they share one table, nobody can explain a balance during a dispute.
Top-ups: credit once
- Create the order with your own unique reference and exact amount, and store it before showing payment instructions.
- Credit coins only after a verified callback or a status query, never from the client's return page.
- Store the provider reference when you credit, and ignore repeated notifications for it.
- If the callback is late, query the order. Do not ask the user to pay again.
Payouts: query before you retry
A timeout means you did not get an answer, not that the transfer failed.
- One payable, one merchant reference, kept for every status check.
- On timeout, query the original payout.
- Create a replacement only when the original is confirmed failed and someone approves it.
- Close the payable only on a confirmed final status.
Reconcile daily
Reconcile top-ups and payouts separately, then compare them. Collections show what users paid, payouts show what hosts received, and your earnings ledger explains the difference.
Example code for safe payout retries: https://github.com/payjn/payout-safe-retry
Disclosure
I work at PAYJN, which provides local collections and payouts for social, live-streaming and game platforms in South and Southeast Asia. The patterns above apply whichever provider you use. If you are planning top-ups and host payouts in Pakistan, our guide to live-streaming payments with JazzCash and Easypaisa covers what to prepare for a provider review.