Skip to main content
API AUTOMATION · SANDBOX & WEBHOOKS

Automated Deposit & Withdrawal API with Live Sandbox & HMAC-SHA256 Webhooks

One REST integration covering Payin V2 AUTO deposits, idempotent Smart Withdrawals, bank-cleared slip fallback, and raw-body signed callbacks — with endpoint-by-endpoint specs.

Solution Overview

Spec updated 2026-12-04

SF PayGate unifies POST /api/v2/payins (merchant_ref_id, currency_code, request_amount), POST /api/v1/payouts (merchant_ref_id idempotency key), GET /api/v1/payins/{id}, POST /api/v1/settlements, and POST /api/v1/payins/{id}/slip under one HMAC-SHA256 signing model with 0 setup and 0 monthly fees.

35

Merchant API Endpoints

100+

Total Routes incl. Sandbox & Issues

3-Way

Signed Webhook + Query API + Slip QR

HMAC-SHA256

Constant-Time Raw-Body Verification

What should engineering, finance, and support sign off in Sandbox before go-live?

Walk through every happy-path and chaos scenario together using our Sandbox UAT and pre-launch sign-off matrix before switching credentials to production.

How do we harden payout state machines and webhook verification?

Pair our idempotent payout engine implementation guide with the HMAC-SHA256 raw-body webhook verification guide.

First Sandbox Call (POST /api/v2/payins)

Inspect the exact headers, request payload, and JSON response returning paypage_url.

Open full endpoint spec
# 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: <your-api-key>" \
  -H "X-Timestamp: <unix-timestamp>" \
  -H "X-Signature: <hmac-sha256-of-path>" \
  -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"
  }'

Sample JSON Response

{
  "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"
}

How to Integrate Deposits, Withdrawals & Webhooks

1. Create Deposits (POST /api/v2/payins)

AUTO mode routes dynamically across QR or bank transfer and enforces Active Payin Protection (PAYIN_ACTIVE_EXISTS).

Open Payin V2 Reference

2. Idempotent Withdrawals (POST /api/v1/payouts)

Pass a unique merchant_ref_id as the idempotency key; payouts execute via a 24/7 managed queue and remain queryable via GET /api/v1/payouts/{id}.

Open Payouts Reference

3. Verify Signed Webhooks (HMAC-SHA256)

Verify X-Signature over raw bytes using timingSafeEqual with X-Timestamp freshness validation, then acknowledge HTTP 200.

Open Webhook Guide

4. Bank-Cleared Slip Fallback

Submit transfer slip QR payloads to POST /api/v1/payins/{id}/slip for clearing validation and permanent replay-hash storage.

Open Slip Verification Docs

Automated REST API vs Manual Backoffice Operations

WorkflowSF PayGate Auto APIManual Backoffice
Deposit ReconciliationSigned Webhook + 24/7 Query APIManual slip checking in chat queues
Slip Fraud CheckBank-cleared QR payload + replay hashHuman review or editable OCR screenshots
Peak WithdrawalsIdempotent Smart Withdraw queueManual bottlenecks and duplicate transfers

30 connected banks

18 Thai banks · 12 Hong Kong FPS banks · USDT TRC20

PromptPayPromptPay QR
USDTUSDT (TRC20)
  • Kasikornbank

    KBANK

    Kasikornbank

  • Siam Commercial Bank

    SCB

    Siam Commercial Bank

  • Krungthai Bank

    KTB

    Krungthai Bank

  • Bangkok Bank

    BBL

    Bangkok Bank

  • Krungsri (Bank of Ayudhya)

    BAY

    Krungsri (Bank of Ayudhya)

  • TMBThanachart Bank

    TTB

    TMBThanachart Bank

  • Government Savings Bank

    GSB

    Government Savings Bank

  • BAAC Thailand

    BAAC

    BAAC Thailand

  • Government Housing Bank

    GHB

    Government Housing Bank

  • CIMB Thai

    CIMB

    CIMB Thai

  • UOB Thailand

    UOB

    UOB Thailand

  • Islamic Bank of Thailand

    IBANK

    Islamic Bank of Thailand

  • LH Bank

    LHB

    LH Bank

  • TISCO Bank

    TISCO

    TISCO Bank

  • Kiatnakin Phatra Bank

    KKP

    Kiatnakin Phatra Bank

  • HSBC Thailand

    HSBC

    HSBC Thailand

  • Thai Credit Bank

    TCRB

    Thai Credit Bank

  • ICBC (Thai)

    ICBC

    ICBC (Thai)

Signing Rule: Middleware strips a leading /api prefix before verifying signatures. Always sign /v2/payins when calling /api/v2/payins, alongside a fresh X-Timestamp.

Frequently Asked Questions

Where should our backend check status if a webhook is delayed?

Webhooks retry automatically until HTTP 200 is returned. Your backend can also poll GET /api/v1/payins/{id} 24/7 for authoritative order state or accept a slip fallback via POST /api/v1/payins/{id}/slip.

Which merchant_ref_id should we send when retrying a timed-out withdrawal?

Always reuse the original merchant_ref_id — never generate a fresh ID on retry, since it acts as the idempotency lock. Exercise timeout scenarios on the dedicated Sandbox debug endpoints before going live.

Is a full Sandbox environment included?

Yes. Sandbox API keys and signing secrets are issued after consultation with no live production domain required upfront.

ENGINEERING & MARKET INSIGHTS

Related Guides

All guides