端點參考
StagePay REST API v1 端點清單 — 建立付款、交易、商品、App、結算查詢的路徑、範圍、參數與回應欄位。
所有路徑的基本網址皆為 https://api.stagepay.io,且需要 API 金鑰驗證。機器可讀的規格可從 GET /api/v1/openapi.json(OpenAPI 3.1)取得。
| 方法 | 路徑 | 範圍 | 說明 |
|---|---|---|---|
POST | /api/v1/payments | write:transactions | 建立付款 |
GET | /api/v1/transactions | read:transactions | 交易清單 |
GET | /api/v1/transactions/{id} | read:transactions | 交易詳情 |
GET | /api/v1/products | read:products | 商品清單(僅限啟用中) |
GET | /api/v1/products/{id} | read:products | 商品詳情 |
GET | /api/v1/apps | read:apps | App 清單 |
GET | /api/v1/apps/{id} | read:apps | App 詳情 |
GET | /api/v1/settlements | settlement:read | 結算批次清單 |
GET | /api/v1/settlements/{batchNo} | settlement:read | 結算批次詳情 |
GET | /api/v1/settlements/{batchNo}/lines | settlement:read | 結算明細行(JSON 或 CSV) |
read:all 範圍允許所有交易・商品・App 查詢(不含結算)。
交易
GET /api/v1/transactions
| 查詢參數 | 說明 |
|---|---|
page, limit | 分頁(預設 1、20) |
appId | App 篩選 |
status | pending, success, failed, cancelled, expired, partial_refunded, refunded |
startDate, endDate | 建立時間範圍(ISO 8601) |
交易物件主要欄位
| 欄位 | 說明 |
|---|---|
tid | StagePay 交易編號 |
appId, userId, serverId, playerId | 請求時傳入的值 |
productId, productName | 商品 |
status | 交易狀態 |
amount / amountMinor / currency | 顯示金額 / 結算基準金額(minor)/ 幣別 |
refundedAmountMinor, refunds[] | 累計退款金額、退款明細 {refundId, amountMinor, reason, at} |
pgCode, method, pgTid | PG、付款方式、PG 交易編號(退款 API 的 tno 等) |
paidAt, createdAt | 付款確定時間、建立時間 |
callback | {status, attempts, lastAttemptAt, lastStatusCode, nextAttemptAt} 回呼狀態 |
crypto | USDT 付款資訊(USDT) |
userdata, etc, uniqueId | 商戶自由資料 |
商品
GET /api/v1/products
| 查詢參數 | 說明 |
|---|---|
page, limit | 分頁(預設 1、20) |
appId | App 篩選 |
回應中只包含 status=active 的商品。收銀台的 productId 請使用商品 ID(控制台上顯示的值)。
App
GET /api/v1/apps
金鑰可存取的 App 清單。回應中不包含 App 機密資訊(webhookSecret、apiKey)。
結算
路徑、參數、回應欄位與 CSV 格式整理於結算查詢 API。
curl "https://api.stagepay.io/api/v1/settlements?status=APPROVED&from=2026-01-01T00:00:00%2B09:00" \
-H "Authorization: Bearer $STAGEPAY_KEY_ID:$STAGEPAY_KEY_SECRET"規格與文件不一致時
OpenAPI 規格(/api/v1/openapi.json)是由 API 伺服器產生的基準文件。若與本頁內容不同,請以規格為準,並告知我們文件錯誤。