跳到內容

查詢商店定期購訂單列表

在 ChatGPT 開啟在 Claude 開啟

GET /subscriptions

  • 正式環境:https://payment-api.oen.tw/subscriptions
  • 測試環境:https://payment-api.testing.oen.tw/subscriptions

列出的是應援商店的「定期購」訂單,不是用 Payment API 建立的定期定額。只有在應援商店販售訂閱制商品的商家才需要。Payment API 定期定額請用查詢定期定額明細。依建立時間由新到舊,每頁最多 50 筆;用 status 篩選時,一頁可能少於 50 筆但仍有下一頁。

Header 帶 Authorization: Bearer <token> 。token 的取得方式見驗證與 token。

欄位型別必填說明
statusstring選填用逗號分隔的狀態。不帶就是全部。
可用值:ongoing、cancelled、done、error、retryScheduled
範例:ongoing,retryScheduled
pagestring選填下一頁的分頁標記。把上一頁回應的 page 原封不動帶入。

範例一律打測試環境。把 OEN_API_TOKEN 設成測試環境 CRM 產生的 token。

終端機視窗
curl -X GET "https://payment-api.testing.oen.tw/subscriptions?status=ongoing" \
-H "Authorization: Bearer $OEN_API_TOKEN"
HTTP說明
200回傳定期購訂單列表與下一頁代碼
401token 錯誤
欄位型別出現說明
subscriptionsarray一定有定期購訂單
id
subscriptions[].id
string可能沒有訂單的內部 id
status
subscriptions[].status
string可能沒有ongoing 進行中、retryScheduled 待重扣、error 扣款失敗、cancelled 已取消、done 已完成
items
subscriptions[].items
array可能沒有訂購的商品
totalAmount
subscriptions[].totalAmount
number可能沒有每期金額
period
subscriptions[].period
integer可能沒有已扣期數
numberOfPeriods
subscriptions[].numberOfPeriods
integer可能沒有總期數
lastChargedAt
subscriptions[].lastChargedAt
string可能沒有最近一次扣款時間(台北時間,帶 +08:00)
user
subscriptions[].user
object可能沒有訂購人 { name, email }
createdAt
subscriptions[].createdAt
string可能沒有建立時間
cancelledAt
subscriptions[].cancelledAt
string可能沒有取消時間
endedAt
subscriptions[].endedAt
string可能沒有結束時間(台北時間,帶 +08:00)
pagestring | null一定有下一頁的分頁標記;沒有下一頁時是 null
錯誤碼HTTP什麼時候會發生
V0001400status 值不正確
A0001401token 錯誤

完整清單與處理方式見錯誤碼一覽。

Payment API 建立的定期定額請用查詢定期定額明細。