跳至正文內容
API AUTOMATION · SANDBOX & WEBHOOKS

全自動充提 REST API:沙盒範例、冪等代付與 HMAC-SHA256 回調

單一 REST 接口覆蓋自動充值、智能代付、銀行清算回單核驗與簽名 Webhook,附完整接口文件。

方案概覽

Spec 2026-12-04

SF PayGate 整合 POST /api/v2/payins、POST /api/v1/payouts(以 merchant_ref_id 作冪等鎖)、POST /api/v1/settlements 及 POST /api/v1/payins/{id}/slip,全部採用 HMAC-SHA256 原始報文簽名,0 開戶費、0 月費。

35

Merchant API Endpoints

100+

系統總路由(含沙盒)

3-Way

Webhook + Query API + Slip QR

HMAC-SHA256

原始報文簽名校驗

切換正式環境前,沙盒 UAT 應完成哪些聯調驗收?

工程、財務與客服主管可對照 全自動充提 API 沙盒 UAT 驗收簽核清單,逐項驗證超時重試、重複回單與跨日切賬。

如何設計冪等狀態機與原始報文驗簽?

結合 冪等代付防重複出款指南 與 HMAC-SHA256 Webhook 驗簽實戰 完成安全閉環。

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

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

充值、代付與 Webhook 串接步驟

POST /api/v2/payins

AUTO 智能路由與防重複未付訂單

檢視 Payin V2 文件

POST /api/v1/payouts

冪等代付與智能分步執行

檢視 Payouts 文件

HMAC-SHA256 Webhooks

恒定時間比對原始報文簽名

檢視驗簽指南

POST /api/v1/payins/{id}/slip

銀行級回單二維碼哈希核驗

檢視回單核驗文件

自動化 API vs 人工核單

流程SF PayGate API人工後台處理
充值確認即時簽名回調 + 24/7 主動查詢依賴客服逐筆看圖上分
高峰出款冪等鍵保護與分步回調易出現積壓或重複打款

直連 30 間銀行通道

泰國 18 間銀行 · 香港 FPS 12 間銀行 · 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)

簽名規則:商戶主動請求 API 時,參與簽名的路徑須剔除開頭的 /api(例如呼叫 /api/v2/payins 時對 /v2/payins 簽名)。

常見問題

若未收到 Webhook 如何查詢狀態?

系統會自動重試直至收到 HTTP 200,同時可隨時呼叫 GET /api/v1/payins/{id} 查詢權威狀態。

提現超時重試應使用哪個 merchant_ref_id?

務必沿用原本的 merchant_ref_id 作為冪等鍵,切勿重新生成新 ID,並於沙盒環境驗證實際回應。

ENGINEERING & MARKET INSIGHTS

相關技術文章

瀏覽全部