v1
latestOpenAPI 3.0.02026-07-26318168886.7 KBGet Store Credits
To get customers store credits.<br>獲取商店購物金紀錄。<br><br> <strong>Strongly recommended: use cursor-based pagination (limit + previous_id) instead of offset (page + per_page).</strong><br> <strong>強烈建議使用 cursor 翻頁(limit + previous_id),不要用 page + per_page。</strong><br><br> <strong>How to switch to cursor / 如何切換:</strong> simply pass limit (and previous_id from the previous response's last_id for next pages). Response will return last_id instead of pagination.<br> 帶 limit 即啟用 cursor,後續頁帶上一次的 last_id 作為 previous_id。Response 回 last_id 取代 pagination。<br><br> <strong>Filters + cursor coexist / 篩選 + cursor 同時使用:</strong><br> Filter params (end_at_after, end_at_before, created_at_*) apply BEFORE cursor. Every page returns items already matching the filter — cursor paginates within the filtered set.<br> 篩選參數先套用,cursor 在篩選後的結果集內翻頁。每頁回的都是符合篩選條件的資料。<br><br> <strong>Example — fetch all credits expiring in the next 30 days / 撈未來 30 天到期名單:</strong><br> <strong>Page 1</strong> — pass filter + limit (no previous_id on first page):<br> <code>GET /v1/user_credits?end_at_after=2026-05-19T00:00:00Z&end_at_before=2026-06-18T23:59:59Z&limit=200</code><br> → { items: [200 items, all expiring 2026-05-19 ~ 2026-06-18], last_id: "6a056255..." }<br><br> <strong>Page 2</strong> — repeat filter + pass previous_id from previous last_id:<br> <code>GET /v1/user_credits?end_at_after=2026-05-19T00:00:00Z&end_at_before=2026-06-18T23:59:59Z&limit=200&previous_id=6a056255...</code><br> → { items: [200 more items, still within filter], last_id: "69faf974..." }<br><br> ...repeat until <code>items.length < limit</code> OR <code>last_id</code> is null (whichever comes first):<br> → { items: [...remaining items, fewer than limit...], last_id: null }<br> <strong>Stop condition / 停止條件:</strong> items.length < limit OR last_id === null. <br> Note: when total count is an exact multiple of limit, last_id may still be non-null on the final full page; the next call will return empty items with last_id = null. Always check both conditions.<br> 注意:當總筆數剛好是 limit 倍數時,最末頁 last_id 仍會回非 null;下一次呼叫才會回空陣列 + last_id = null。請同時檢查兩個條件。<br><br> Offset mode is retained only for backward compatibility and will not receive new improvements.
Query parameters
Filter store credits by those created after specific time (inclusive).<br> 取得 created_at 大於等於指定時間的購物金。<br> Accepts ISO 8601 format. Use UTC (Z suffix) to avoid timezone ambiguity.<br> 接受 ISO 8601 格式,建議帶 Z 明確指 UTC,避免時區歧義。
Filter store credits by those created before specific time (inclusive).<br> 取得 created_at 小於等於指定時間的購物金。<br> Accepts ISO 8601 format. Use UTC (Z suffix) to avoid timezone ambiguity.<br> 接受 ISO 8601 格式,建議帶 Z 明確指 UTC,避免時區歧義。
Filter store credits expiring after specific time (inclusive).<br> 取得 end_at 大於等於指定時間的購物金(撈「快到期」名單時可帶 now)。<br> Accepts ISO 8601 format. Use UTC (Z suffix) to avoid timezone ambiguity.<br> 接受 ISO 8601 格式,建議帶 Z 明確指 UTC。
Filter store credits expiring before specific time (inclusive).<br> 取得 end_at 小於等於指定時間的購物金(撈「快到期」名單時可帶 now + N days)。<br> Accepts ISO 8601 format. Use UTC (Z suffix) to avoid timezone ambiguity.<br> 接受 ISO 8601 格式,建議帶 Z 明確指 UTC。
Page Number (offset mode).<br>頁數<br> Ignored when limit or previous_id is provided (cursor mode).
Numbers of items per page (offset mode).<br>每頁顯示 n 筆資料<br> Ignored in cursor mode; use limit instead.
Cursor mode page size (default 24, max 999).<br> cursor 模式每次回傳筆數。<br> Presence of this param enables cursor mode (response returns last_id instead of pagination).<br> 帶 limit 即啟用 cursor,response 不再含 pagination。<br> Larger values reduce total round trips for large batch jobs (e.g. fetching 60k records with limit=999 takes ~60 calls vs ~2500 with limit=24).<br> 大批次任務建議用較大值以減少請求次數。
Cursor for the next page: the _id from the previous response's last_id.<br> 上一頁回傳的 last_id。第一頁不需帶。<br> Presence of this param also enables cursor mode.<br> Recommended for large batch / external integrations (avoids ES offset depth limit).
Could exclude certain parameters in the response<br>結果要排除哪些參數
[ "items.id" ]
Could only show certain parameters in the response<br>結果只顯示哪些參數
[ "items.id" ]
Response
OK<br> Response shape depends on mode: offset (neither limit nor previous_id provided) returns pagination; cursor (limit or previous_id provided) returns last_id.
Example response
{
"items": [
{
"_id": "5f55ad58d9ce6d003c1fd62f",
"customer_id": "5f47c96a86a983001614a834",
"credit_balance": 160,
"remarks": "hello",
"value": 20,
"end_at": "2021-11-30T00:00:00.000+00:00",
"performer_id": "61ad96bda6633e004cafe7db",
"performer_name": "staff1",
"fulfillment_balance": 10,
"type": "manual_credit",
"created_at": "2020-09-07T03:47:44.061Z",
"customer_ref_user_id": "MEMBR000000000000019034194",
"status": "active",
"order_id": "621701406dcff70039642cde",
"value_dollar": {
"cents": 999999999,
"currency_symbol": "NT$",
"currency_iso": "TWD",
"label": "NT$999,999,999",
"dollars": 999999999
},
"user_credit_rule_id": "583d630a69702d70850c0000",
"order_number": "2019052707260498"
}
],
"pagination": {
"current_page": 1,
"per_page": 24,
"total_count": 1,
"total_pages": 1
},
"last_id": "5f1e837c1be895004582ad47"
}