Case study
ARBI Pay
Cross-currency payment acceptance for merchants in Thailand. Payers pay by SBP, USDT, Thai QR, card or cash; stores are settled in their own currency. Underneath: routing with failover, a double-entry ledger, KYC and transaction monitoring.


Five ways to pay,one way to settle
The payer pays in one currency and the store is settled in another. Every method runs through the same state machine, ledger and checks. Pick a method to see how it works.
- gRPC services behind one gateway
- 10
- HTTP routes in the gateway
- 627
- database models, one database per service
- 128
- backend test files
- 328

SBP
- The payer picks a bank, scans a QR or jumps straight into the banking app; status updates every few seconds
- Several SBP acquirers in one pool, chosen by weight and health, with failover to the next on any error
- Payer identity is matched against the bank data, with KYC levels set by amount

Thai QR
- A PromptPay QR drawn on the server from the EMVCo string, with a countdown and live status
- The provider is picked per merchant and business type between two Thai QR gateways
- Late payments revive an expired payment instead of being lost

USDT
- Small TRC-20 payments go to Gate Pay; larger ones to our own crypto node with a deposit address per invoice
- The node sweeps funds to treasury, screens them for AML and keeps a hot wallet that drains to cold storage
- Energy for TRON transfers can be rented instead of burning TRX
Card
- Card form on our own page with Omise, 3-D Secure and a limited number of retries
- Token to charge through the orchestrator, with the same state machine as every other method
Cash
- An invoice with a six-digit code; the cashier accepts full or partial payment
- Rate and fee are locked when the invoice is issued; refunds within 24 hours reverse the ledger entries
- Office balances and collections are tracked in the CRM
What the payer sees

Checkout The store’s amount, converted live into rubles or USDT as the payer switches methods.

Thai QR The QR counts down while the page polls for the payment.

SBP banks A bank list with a QR and a deep link into the banking app.

Back to the store A clear result, a return link and, for walk-in stores, a review prompt.
Routing thatsurvives a bad day
Each acquirer has a weight and a health score. A payment goes to one of them by weight; if that acquirer fails, the payment moves to the next in the pool, and only fails when the whole pool is exhausted. Try it.
- Acquirer A0weight 50
- Acquirer B0weight 30
- Acquirer C0weight 20
Nothing sent yet.

The life of a payment
Create
Gateway checks the signed request and IP list; merchant, methods and terminals are validated.
Quote
The rate is built from live market feeds through a chain of store, merchant and progressive markups.
Route
Limits, a risk check and the monitoring gate run; an acquirer is picked by weight and health.
Confirm
A signed provider webhook or the status poller; both paths must reach the same result.
Settle
Double-entry postings in the ledger, then a signed webhook to the merchant with retries.
Every bahtaccounted for
Money lives in a double-entry ledger, not in balance fields. Debits always equal credits, and every posting can be traced back to the payment that caused it.
- Accounts for the system, merchants, stores and agents in every currency; balance is credits minus debits
- Every journal entry has an idempotency key per leg, so a repeated webhook can never post twice
- Payouts reserve, then settle or release; reserving more than the balance is refused under a row lock
- A recovery sweeper finishes payments stuck between confirmation and posting every 15 seconds
- Raw provider payloads are journaled with a hash, and Thai bank transfers are reconciled against receipt emails
| Account | Side | Amount |
|---|---|---|
| Acquirer receivable | Debit | 3,850.00 THB |
| Merchant balance | Credit | 3,696.00 THB |
| Platform revenue (spread) | Credit | 115.50 THB |
| Agent accrual | Credit | 38.50 THB |
Debits equal credits
Idempotency key payment:{id}:settlement. Illustrative amounts.
Compliance builtinto the flow
Know-your-customer checks scale with the amount, and a monitoring engine watches every merchant for patterns that need a human look.
KYC levels
- Basicany amount
- Extendedfrom 100k RUB
- Fullfrom 500k RUB
- Maximumfrom 1M RUB
Measured on the payment plus the payer’s last 30 days across all merchants.
28 monitoring rules in 8 groups
- CChannel3
- VVolume4
- ACheck7
- PPayer5
- TTime3
- GGeo2
- RPost-fact3
- DData1
- KYC with Didit: one client per email or phone across all merchants; passport data stays with the vendor
- Typo-tolerant name matching between the KYC result and the bank payer, with a mismatch flag in the payments register
- Monitoring scores every merchant over a 7-day window with daily decay, into Normal, Watch, Review and Suspend
- Alerts go to the on-duty officer by Telegram and email; cases carry an SLA and an append-only review journal
- Thresholds are versioned and editable without a release, and can be retro-run over 30, 60 or 90 days
A cabinet for merchants,a CRM for operators
Merchants and stores
Directors, admins, managers, cashiers and accountants; stores and branches with their own methods, markups and QR.
Agents
Referral partners with their own cabinet, accruals and payouts.
Operators
Fifteen platform roles, from compliance officers to finance, with managers who only see their own merchants.
Payers
A mobile checkout in their language, and a KYC cabinet when an amount needs it.

Merchant cabinet: stores and branches ranked by payment volume

Agent cabinet: commission, balance and a personal referral link

CRM: payments across merchants with status, source and commissions

CRM: monitoring dashboard with merchants under attention

CRM: a monitoring case with its signals, points and the payments behind them

CRM: monitoring rule catalogue with versions and tuned thresholds

CRM: KYC registry with levels, statuses and name mismatches

Merchant cabinet: payments across stores and currencies
Ten services,one contract
One HTTP gateway in front of ten gRPC services, each with its own PostgreSQL database and a shared contract in Protocol Buffers. Pushes to the main branches deploy with migrations.
- Edge One gateway with signed requests, IP lists, rate limits and idempotency
- Services Ten gRPC services: merchants, pricing, orchestrator, provider adapters, ledger and more
- Outside Acquirer pool, crypto node, KYC and AML, rate feeds, webhooks and alerts
What it is made of
Backend
- NestJS 11
- TypeScript
- gRPC
- Protocol Buffers
- Nx
- pnpm
Data
- PostgreSQL
- Prisma
- Redis
- Outbox tables
Frontends
- React 19
- MUI
- Vite
- Telegram Mini App
Crypto node
- TRON
- Ethereum
- BSC
- Java signer
- Grafana
- Prometheus
Integrations
- Omise
- Gate Pay
- Didit
- AMLBot
- PostHog
- Telegram
- LINE
Moving moneyfor your product?
Payment flows, ledgers and compliance that hold up in production. Tell us what you need.