Summary
A gambling payment gateway stays healthy at peak only when all three layers are handled: your app, the gateway and the banks. Smart routing moves new orders away from degraded routes, but the merchant still needs per-player rate limits, a payout queue, a webhook handler that can take the load and the query API as a fallback, plus a sandbox rehearsal and a runbook the whole team has read before the night itself.
01Why a spike is not just more of the same traffic
Platforms with large player bases see transactions bunch up around predictable moments: evening prime time, a major football fixture just before kick-off, a lottery draw night, or a promotion announced to everyone at once. What these moments share is a deadline. Many players decide to top up in the same short window because betting closes or the bonus expires, rather than arriving at a steady trickle.
The less obvious problem is that human behaviour changes when the system slows down. A player who pays and does not see a balance within a few seconds taps again, force-closes the app, or messages support alongside dozens of others. The real request volume ends up well above the number of people who actually intended to deposit, so a small delay in one layer gets amplified into duplicate requests, complaints and reconciliation work later.
For the finance team, a peak is also when mistakes cost the most. One stuck order on a quiet Tuesday can be chased down in minutes; on a draw night, hundreds can be stuck at once. The goal is therefore not the fastest possible system but one in which every order ends in a state you can verify, even while the system is under pressure.
02How spikes stress each of the three layers
The first layer is your own app and backend. The usual failures are an exhausted database connection pool, workers that cannot keep up with webhook processing, or a deposit page that calls the API again on every tap. You control this layer completely, and it is typically the first thing to give way when load rises.
The second layer is the gateway, which has to create orders, issue a QR code or account details, match incoming funds to orders, and deliver webhooks to a merchant endpoint that may be slow to answer. The third is the banks and payment networks, where each institution has its own response pattern and its own slow periods, entirely outside the control of both merchant and gateway. Knowing which layer a symptom belongs to is the first skill of whoever has to fix it.
SF PayGate supports PromptPay QR and bank transfer across 18 Thai banks, Hong Kong FPS across 12 banks, and USDT on TRC20, all push-payment rails. Cards are not supported, so there is no card-network chargeback step. The peak-time risk therefore moves to transfer latency and payment matching, and that is what needs to be designed for.
| Layer | Common pressure | Who can act |
|---|---|---|
| Merchant app | Repeated taps, full queues, slow webhook handler | The merchant |
| Gateway | Many order creations and matches at once | The gateway (smart routing, Active Payin Protection) |
| Banks and networks | Some banks respond or settle funds more slowly than usual | The bank (the gateway can route around it, not fix it) |
03What smart routing does when one bank slows down
SF PayGate scores each provider route on latency, success rate and risk, and fails over away from routes that degrade, rather than waiting for a person to notice and flip a switch. In practice, when one route starts to slow, new orders created after that point can be directed to a healthier one.
When you create a pay-in with mode AUTO, the system chooses between QR and bank transfer for you. Your code does not need its own channel-selection logic or a view of which bank is slow right now; it calls POST /api/v2/payins and shows the returned paypage_url, which gives the player a mobile-ready payment page.
It is worth being clear about the limits. Failover helps orders that have not yet been created or paid. Money a player has already sent through a slow route still has to wait for that bank to clear it. That is why confirmation is three-way (signed webhook, query API, slip), so that a slow order does not become a lost one.
04On your side: per-player limits and Active Payin Protection
The first guard to build is a rate limit per player, not only per system. Cap how many deposit orders one player can request in a short window and answer with a clear message pointing at the existing order. A per-player limit stops one impatient user from consuming capacity that belongs to everyone else, and it cuts down on orders that expire for no reason.
The gateway adds Active Payin Protection as a second layer. If the player already has a pending order, a repeated POST /api/v2/payins returns PAYIN_ACTIVE_EXISTS together with the existing paypage_url rather than creating a stacked duplicate. Your app should treat that code as a normal situation and send the player back to the original payment page, not show an error.
If the player really wants to change the amount or channel, cancel the old order with POST /api/v2/payins/{id}/cancel before creating a new one. Only do that when you are sure the player has not transferred yet; if money may already have moved, check status first. Keep amounts within the real limits as well: 50 to 45,000 THB per deposit, from the customer's registered bank account, so matching stays quick.
05Withdrawals: queues, back-pressure and idempotency
Withdrawal requests tend to bunch up right after outcomes land, such as when a draw is announced or a match ends. If your app fires every request at POST /api/v1/payouts the instant it arrives, you both load your own system and create duplicates whenever a call times out. Put a payout queue on your side that releases work at a steady rate and slows down when the gateway responds slowly or returns more errors. That is back-pressure.
The unique merchant_ref_id acts as the idempotency key. If the first request times out and you resend with the same merchant_ref_id, the system does not treat it as a new payout. So bind that ID to the withdrawal record in your own database before the first attempt, rather than generating a fresh one on each retry, or your automatic retry will turn into a double payment.
Smart Withdraw can split execution into steps and report each step in signed callbacks, so surface those intermediate states to players and support staff instead of leaving a vague 'processing' label up. Stay within 100 to 45,000 THB per payout in whole multiples of 100 THB so requests are not rejected just when the queue is longest.
06Webhook capacity and the query API as a fallback
SF PayGate retries a webhook automatically until your endpoint returns HTTP 200. That is good for reliability, but at peak it means a slow handler faces new events and retried events at the same moment, which slows it further. The safer pattern is to verify the HMAC-SHA256 signature over the raw body, write the event to a queue, return 200 immediately, and let workers do the real processing afterwards.
Because webhooks can arrive more than once or out of order, the handler must be idempotent: processing the same event twice must have the same effect as processing it once. For example, check the order's state in your own ledger before crediting the player. The classic mistake is crediting directly inside the handler without that check, which hands a player a second credit when the webhook is redelivered after a timeout.
The query API is the second leg of three-way confirmation. GET /api/v1/payins/{id} is available around the clock, so run a background job that sweeps orders pending longer than a threshold you choose, at a controlled pace, rather than asking about every order at once and adding load. The third leg is the slip, which the player can submit through the PayPage or POST /api/v1/payins/{id}/slip; the QR payload is checked against bank clearing data and a cryptographic hash is stored so a replayed slip is rejected.
07Rehearse in the sandbox before the real event
A useful rehearsal is not about producing an impressive load figure. It is about finding which of your layers breaks first and whether the team knows what to do about it. Review the developer API overview and use the sandbox to simulate what actually happens: repeated taps, slow webhook responses and retried payout requests, then write down what occurred and who had to do what. Do not experiment on the live system while players are using it.
Run it as a fixed script so results compare between rounds, and derive your targets from your own forecast rather than anyone else's numbers. For illustration, suppose you expect a draw night to bring several times your normal concurrent depositors; set the test load a notch above that, and see whether your queues and handlers still keep up.
- 1Estimate the peak from your own platform's history, then set the test load above it.
- 2Test repeated taps: create pay-ins repeatedly for one player, confirm PAYIN_ACTIVE_EXISTS comes back and your app routes to the original paypage_url.
- 3Test slow and duplicate webhooks: delay your responses and confirm there is no double credit and the queue does not overflow.
- 4Test repeated payouts with the same merchant_ref_id and confirm no second payout appears.
- 5Take your handler down briefly, bring it back, and check the redelivered webhooks are all processed and agree with the query API.
- 6Rehearse roles: who coordinates the incident, who talks to support, who communicates with players.
08The incident runbook: detect, triage, communicate, recover, reconcile
A good runbook is short enough to follow at 1 a.m. and ordered the way incidents actually unfold. The first phase is detection, and it should rely on signals you can measure yourself, such as the age of your oldest pending order, webhook queue depth and the rate of failed payout calls, rather than waiting for angry player messages.
Triage means answering quickly which of the three layers the problem sits in, because fixing the wrong one wastes time and sometimes makes things worse, for instance by adding retries to a webhook handler that is already struggling. Communication means telling players something truthful, that their transaction is being checked, and notifying gateway support with details they can trace.
Recovery and reconciliation are the phases most often skipped, yet they matter most for the books. Once the system is stable, sweep every pending order through the query API against your ledger and make sure each one reaches a final state, rather than leaving them until month-end to reconcile in one painful batch.
- 1Detect (first minutes): notice stuck orders, a long webhook queue or rising payout failures, and name one incident coordinator.
- 2Triage: check your own app first (pool, workers, handler), then the gateway and banks, and establish whether it is one bank or every route.
- 3Communicate: give players a truthful message, and alert the support room or open a ticket with a request_id and sample orders.
- 4Recover: slow the payout queue, add handler capacity, confirm you can return HTTP 200, then restore the pace gradually once status is stable.
- 5Reconcile: sweep pending orders with the query API against your ledger, close the remainder through slips or tickets, and write the lessons into the runbook.
09The 24/7 support room and using POST /me/issues
Every live merchant organisation gets a dedicated private Telegram support room, staffed around the clock, and ticketing through POST /me/issues. They serve different purposes. The chat room suits urgent flags during a peak; a ticket suits a case that needs evidence and follow-through, because every ticket carries a request_id you can cite.
A strong ticket contains what support needs to trace the case immediately: order IDs, time of occurrence, the channel and bank involved, and the symptom observed. Writing only 'money not received' forces a round of questions at the moment when each minute counts. Transfer disputes or bank holds are handled as tracked cases with a request_id under the written merchant agreement.
The request below is an illustration of the shape only; take actual field names from the API documentation, and remember every call must be signed with HMAC-SHA256 over the raw body, with the leading /api stripped before signing.
// POST /api/me/issues (illustration only — confirm field names in the API docs)
{
"subject": "Deposits pending after 20:30 peak",
"description": "Orders for KBANK route remain pending; webhook queue healthy; sample order IDs attached.",
"related_order_ids": ["<order-id-1>", "<order-id-2>"]
}10Spike symptoms: likely layer and first action
Pair this table with the SF PayGate platform console as a quick reference during an incident. It is not a rigid answer, because some symptoms come from several layers at once, but it helps the team start from the most probable place instead of guessing or changing everything at the same time.
The habit worth building is to record the symptom and the outcome after every incident and update the table for your own platform. Over time it becomes knowledge specific to your system, which is worth more than any generic advice.
| Symptom | Likely layer | First action |
|---|---|---|
| Many repeated deposit attempts, lots of expired orders | Your app | Check the per-player rate limit and make PAYIN_ACTIVE_EXISTS route to the existing paypage_url |
| Players paid but balances are not updating, webhook queue growing | Your webhook handler | Return 200 immediately and process later; add workers; reconcile with the query API |
| Orders stuck for one bank only | That bank or route | Let smart routing divert new orders, alert the support room, ask affected players to submit slips |
| Payout requests time out intermittently | Gateway call path or your retries | Slow the payout queue; retry only with the same merchant_ref_id |
| Players credited twice | A non-idempotent handler | Check order state in your ledger before crediting; audit past events for duplicates |
| Slips rejected | Replayed slip or amount mismatch | Check whether the slip was already used or differs from the order, then open a ticket if unclear |
11Pitfalls, and when this approach fits
The most common mistake is assuming a good gateway solves every layer. Smart routing and Active Payin Protection reduce risk, but they do not replace an idempotent handler, a throttled payout queue, or a team that has rehearsed. Another is adding retries everywhere with no ceiling, which tends to make an already slow system slower.
This approach suits high-volume iGaming platforms with clearly bunched load and an engineering team that runs its own stack. If you are just starting, build the payout queue and the idempotent handler first, then add the rest. Merchants are responsible for their own licensing and for complying with the rules of the markets they operate in, and SF PayGate reviews merchants before going live. Scams, phishing, fake investment and Ponzi operations are prohibited on the network, as a matter of policy.
To get going, request a technical consultation (no live domain needed), sandbox evaluation, then production review and a written agreement. That is a natural moment to plan for peaks at the same time.
Frequently asked questions
- Does smart routing mean transactions cannot fail?
- No. Smart routing scores routes on latency, success rate and risk and diverts new orders away from degraded ones, which reduces risk. You still need webhooks, the query API and slips as fallbacks, because money already sent has to wait for the bank to clear it.
- What happens when a player taps deposit repeatedly during a slow period?
- If a pending order exists, a repeated POST /api/v2/payins returns PAYIN_ACTIVE_EXISTS with the existing paypage_url. Send the player back to that page rather than showing an error, and add a per-player rate limit as a second layer.
- Will balances be lost if our webhook handler goes down briefly?
- Webhooks are retried automatically until you return HTTP 200, and the query API is available 24/7 for catching up. The handler must be idempotent so a redelivered event does not credit a player twice.
- Is it safe to resend a payout request after a timeout?
- Yes, provided you resend with the same merchant_ref_id, which acts as the idempotency key. Do not generate a new ID per retry, and store the ID in your own database before the first attempt.
- How should we rehearse, and what load number should we use?
- Rehearse in the sandbox with a fixed script, and set test load from your own platform's history, above your expected peak. There is no universal number; the aim is to find which layer breaks first and whether the team knows how to respond.
- During an incident, should we use the chat room or open a ticket?
- Use the private 24/7 Telegram room for urgent flags and POST /me/issues for cases needing evidence and tracking, since each ticket carries a request_id. Include order IDs, timestamps and the bank involved in either.