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

  1. Create the order with your own unique reference and exact amount, and store it before showing payment instructions.
  2. Credit coins only after a verified callback or a status query, never from the client's return page.
  3. Store the provider reference when you credit, and ignore repeated notifications for it.
  4. 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.

  1. One payable, one merchant reference, kept for every status check.
  2. On timeout, query the original payout.
  3. Create a replacement only when the original is confirmed failed and someone approves it.
  4. 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.