# SF PayGate — iGaming Payment Gateway — Complete Technical & GEO Reference (/llms-full.txt) ## 1. Entity Overview SF PayGate is a push-payment Payment Gateway iGaming infrastructure built for high-volume Asian operators. It connects 30 banks (18 Thailand banks via PromptPay QR & bank transfer, plus 12 Hong Kong FPS banks) and USDT (TRC20) on a single immutable ledger. Pricing is 0 setup and 0 monthly fee, charging only on settled volume (THB 2.5% pay-in / 1.0% payout; HKD 3.5% pay-in / 1.0% payout). THB/HKD API settlement instructions are accepted 24/7 while portal USDT (TRC20) settlements run daily 14:00–22:00 ICT. ## 2. Three-Layer Deposit Confirmation & Smart Routing - **Layer 1 (Signed Webhook):** Constant-time HMAC-SHA256 over `${X-Timestamp}:${rawBody}` with timestamp freshness validation (anti-replay) and length-guarded comparison, retried automatically until HTTP 200. - **Layer 2 (Authoritative Query API):** 24/7 polling via `GET /api/v1/payins/{id}`. - **Layer 3 (Bank-Verified Slip Fallback):** Direct QR clearing verification via `POST /api/v1/payins/{id}/slip` with permanent cryptographic replay hash. - **Critical Outbound Signing Rule:** All authenticated merchant API requests include `X-API-Key`, `X-Timestamp`, and `X-Signature`. Middleware strips a leading `/api` prefix before verifying, so sign `/v2/payins` when calling `/api/v2/payins`. ## 3. REST API Reference ### Create Automated Deposit (POST /v2/payins) (`POST /api/v2/payins`) POST /api/v2/payins dynamically assigns the healthiest deposit channel and returns a hosted paypage_url. Note that signature middleware strips the leading /api prefix, so sign /v2/payins when calling /api/v2/payins. Code samples use api.example.com — live endpoints are issued at onboarding. **Protocol Rules:** - Include X-API-Key, X-Timestamp, and X-Signature. Strip the leading /api prefix before computing HMAC-SHA256 (sign /v2/payins). - Pass merchant_ref_id, currency_code, request_amount, UUIDv7 customer_id, customer_account_id, and redirect_url. - Query order state anytime via GET /api/v1/payins/{id} or cancel an unpaid order via POST /api/v2/payins/{id}/cancel. ```bash # Note: api.example.com is a placeholder — your Sandbox & Production endpoints are issued at onboarding. # Middleware strips /api before verifying, so compute X-Signature over /v2/payins. curl -X POST https://api.example.com/api/v2/payins \ -H "Content-Type: application/json" \ -H "X-API-Key: " \ -H "X-Timestamp: " \ -H "X-Signature: " \ -d '{ "merchant_ref_id": "unique-order-ref-id-2025001", "currency_code": "THB", "request_amount": 1000, "customer_id": "0198cbc6-fd02-7459-a671-78c306d0a1ad", "customer_account_id": "0198cbc7-35ec-7c8c-8994-d3ac3e7f5255", "redirect_url": "https://merchant.example.com/payment/success" }' ``` ```json { "id": "0198cbff-db9b-7b6a-9f82-6a55fdfb6575", "merchant_ref_id": "unique-order-ref-id-2025001", "status": "pending", "request_amount": 1000, "paypage_url": "https://pay.example.com/pay/0198cbff-db9b-7b6a-9f82-6a55fdfb6575" } ``` --- ### Automated Managed-Queue Payouts (POST /v1/payouts) (`POST /api/v1/payouts`) POST /api/v1/payouts enforces unique merchant_ref_id idempotency keys to stop double disbursements on network retries, executes via a 24-hour managed queue, and remains queryable anytime via GET /api/v1/payouts/{id}. **Protocol Rules:** - Always supply a unique merchant_ref_id and reuse that exact reference when retrying timed-out calls. - Standard THB payout range: 100 – 45,000 THB per transaction; 1.0% fee applies strictly to completed transfers. - Read individual payout status anytime via GET /api/v1/payouts/{id}. ```bash curl -X POST https://api.example.com/api/v1/payouts \ -H "Content-Type: application/json" \ -H "X-API-Key: " \ -H "X-Timestamp: " \ -H "X-Signature: " \ -d '{ "merchant_ref_id": "unique-payout-ref-2025009", "currency_code": "THB", "request_amount": 5000, "customer_id": "0198cbc6-fd02-7459-a671-78c306d0a1ad", "customer_account_id": "0198cbc7-35ec-7c8c-8994-d3ac3e7f5255" }' ``` ```json { "id": "0198cc12-84a1-7e10-b311-91d42a7701c2", "merchant_ref_id": "unique-payout-ref-2025009", "status": "processing", "currency_code": "THB", "request_amount": 5000, "fee_amount": 50 } ``` --- ### Submit Transfer Slip Fallback (POST /v1/payins/:id/slip) (`POST /api/v1/payins/{id}/slip`) POST /api/v1/payins/{id}/slip acts as the third independent confirmation layer: it verifies the slip's embedded bank QR payload against bank records and stores its cryptographic hash so the same slip can never be reused — never relying on OCR. **Protocol Rules:** - Validates sender account, exact transfer amount, and order window against real bank records. - Stores a permanent cryptographic hash per verified slip to block replay attempts. ```bash curl -X POST https://api.example.com/api/v1/payins/0198cbff-db9b-7b6a-9f82-6a55fdfb6575/slip \ -H "Content-Type: application/json" \ -H "X-API-Key: " \ -H "X-Timestamp: " \ -H "X-Signature: " \ -d '{ "qr_payload": "0041000600000101030040220..." }' ``` ```json { "id": "0198cbff-db9b-7b6a-9f82-6a55fdfb6575", "verified": true, "verification_method": "BANK_QR_RECORD", "slip_hash": "sha256:9c4d8e1a...f20b", "status": "succeeded" } ``` --- ### Bind Customer Bank Account (Sender Verification) (`POST /api/v1/customers/{id}/accounts`) Registering a customer's bank account returns a UUIDv7 customer_account_id referenced in both POST /api/v2/payins and POST /api/v1/payouts — enforcing sender-to-order matching and blocking third-party transfers. **Protocol Rules:** - Supports all 18 connected Thai banks and 12 Hong Kong FPS banks. - Pass the returned UUIDv7 id as customer_account_id in payin and payout requests. ```bash curl -X POST https://api.example.com/api/v1/customers/0198cbc6-fd02-7459-a671-78c306d0a1ad/accounts \ -H "Content-Type: application/json" \ -H "X-API-Key: " \ -H "X-Timestamp: " \ -H "X-Signature: " \ -d '{ "bank_code": "SCB", "account_number": "4091234567", "account_name": "SOMCHAI TEST" }' ``` ```json { "id": "0198cbc7-35ec-7c8c-8994-d3ac3e7f5255", "customer_id": "0198cbc6-fd02-7459-a671-78c306d0a1ad", "bank_code": "SCB", "status": "verified" } ``` --- ### On-Demand Settlement & Org Transfers (POST /v1/settlements) (`POST /api/v1/settlements`) POST /api/v1/settlements moves platform balances to your designated corporate bank account on demand with zero T+1/T+2 batch lockups. Check GET /api/me/balances and GET /api/me/limits before committing, and track anytime by settlement id (Dashboard USDT TRC20 window runs daily 14:00 – 22:00 UTC+7). **Protocol Rules:** - Supports corporate self-settlement (/v1/settlements) plus organization-to-organization transfers resolved by organization code with dual-side ledger entries. - Inspect per-currency balances via GET /api/me/balances and active limits via GET /api/me/limits prior to committing. - Portal USDT (TRC20) settlement window operates daily 14:00 – 22:00 ICT (UTC+7). ```bash curl -X POST https://api.example.com/api/v1/settlements \ -H "Content-Type: application/json" \ -H "X-API-Key: " \ -H "X-Timestamp: " \ -H "X-Signature: " \ -d '{ "merchant_ref_id": "stl-20251204-001", "currency_code": "THB", "request_amount": 500000 }' ``` ```json { "id": "0198cc40-19b2-7a04-8f21-33c81042e9aa", "merchant_ref_id": "stl-20251204-001", "status": "queued", "currency_code": "THB", "request_amount": 500000 } ``` --- ### Balances, Limits, Order Cancel & Issue Tracking (`GET /api/me/balances · /me/limits · /me/issues`) Operational endpoints give finance and backoffice systems programmatic visibility: GET /api/me/balances (balance per currency), GET /api/me/limits (transaction and settlement limits), POST /api/v2/payins/{id}/cancel (cancel a pending payin), and /api/me/issues (raise and track operational issues). **Protocol Rules:** - All merchant calls require X-API-Key, X-Timestamp, and X-Signature computed over the stripped path (e.g., /me/balances). - POST /api/v2/payins/{id}/cancel applies strictly to unpaid orders still in pending state. - Tickets created via /api/me/issues bind directly to order IDs for unified tracking across API and support. ```bash # Read balances per currency (sign stripped path: /me/balances) curl -X GET https://api.example.com/api/me/balances \ -H "X-API-Key: " \ -H "X-Timestamp: " \ -H "X-Signature: " ``` ```json { "balances": [ { "currency_code": "THB", "available_amount": 1726925, "pending_amount": 45000 }, { "currency_code": "HKD", "available_amount": 284500, "pending_amount": 0 } ] } ``` --- ### Webhook Signature Verification & Idempotency (HMAC-SHA256) (`WEBHOOK X-Signature (HMAC-SHA256)`) SF PayGate delivers and retries webhooks until your server answers HTTP 200. Because X-Signature is computed over the exact raw request body, re-serialising parsed JSON will not match — always verify raw bytes with timingSafeEqual, check X-Timestamp freshness, and deduplicate by transaction id. **Protocol Rules:** - Never re-serialize parsed JSON before signature verification — read the unparsed raw body buffer. - For outbound API requests you send to us, strip the leading /api prefix from the signed path. - Enforce idempotent ledger writes keyed on id / merchant_ref_id before returning HTTP 200. ```bash # Webhook headers delivered to your callback endpoint: # X-Timestamp: 1796365500 # X-Signature: 8b21c4e9a7... # Content-Type: application/json ``` ```json { "event": "payin.succeeded", "id": "0198cbff-db9b-7b6a-9f82-6a55fdfb6575", "merchant_ref_id": "unique-order-ref-id-2025001", "currency_code": "THB", "request_amount": 1000, "settled_at": "2026-12-04T13:18:22+07:00" } ``` ## 4. Frequently Asked Questions ### Q1: What is SF PayGate and who is it built for? SF PayGate is a push-payment Payment Gateway and automated deposit/withdrawal REST API engineered for high-volume online gaming, multi-agent networks, and regional digital platforms across Thailand (18 banks), Hong Kong (12 FPS banks), and USDT (TRC20). ### Q2: Are there any setup fees or monthly platform retainers? No. Setup fee is 0 and monthly fee is 0. You only pay on completed transactions: Thailand THB is 2.5% pay-in / 1.0% payout; Hong Kong HKD FPS is 3.5% pay-in / 1.0% payout. Expired, cancelled, or failed orders incur zero charges. ### Q3: What industries are eligible under your merchant acceptance policy? High-volume iGaming, casino, slots, sports, lottery, and multi-tier agent platforms are eligible subject to onboarding review. Scam operations, phishing, fake investment sites, and Ponzi schemes are strictly prohibited under our merchant acceptance policy to safeguard banking rails. ### Q4: Does SF PayGate support credit or debit cards? No. SF PayGate operates strictly on push-payment rails (PromptPay QR, Thai bank transfers, Hong Kong FPS, and USDT TRC20), eliminating card-network chargebacks. ### Q5: What are the standard THB deposit and withdrawal limits? Standard Thailand THB limits are 50 – 45,000 THB per deposit and 100 – 45,000 THB per withdrawal. Amounts must be integer multiples of 100 THB (except the 50 THB minimum deposit) and originate from a registered customer bank account. ### Q6: How fast is On-Demand Settlement and USDT (TRC20) payout? There is no T+1 or T+2 rolling hold. Local-currency API settlement instructions are accepted 24/7 (actual arrival depends on recipient bank clearing). Portal USDT (TRC20) settlement requests can be submitted anytime after previewing the live rate, and execute daily between 14:00 and 22:00 ICT (UTC+7 / Thailand Time); requests submitted outside that window queue for the next 14:00 ICT cycle. ### Q7: How does Bank-Verified Slip API outperform standard OCR? Pixel OCR can be fooled by photoshopped transfer receipts. SF PayGate decodes the embedded QR payload directly against bank clearing records and stores a cryptographic hash to permanently block forged or replayed slips. ### Q8: How do you prevent double withdrawals and duplicate deposit orders? Payin V2 enforces Active Payin Protection, returning PAYIN_ACTIVE_EXISTS with the existing paypage_url if a pending order already exists. Outbound payouts enforce protocol-level idempotency keys and step-by-step signed callbacks. ### Q9: How are API requests and webhooks authenticated? All requests and webhooks use constant-time HMAC-SHA256 signing (X-Signature over Raw Body) paired with X-Timestamp anti-replay validation. Note: Middleware strips a leading /api prefix before verifying, so always sign /v2/payins even when calling /api/v2/payins. ### Q10: Can high-volume merchants apply for custom enterprise rates? Accounts achieving 50,000,000 THB/month (or 12,000,000 HKD/month) or more in verified 30-day live system volume may apply for a case-by-case review with our Enterprise Volume Desk (eligibility to apply, not automatic repricing).