此端点也接受 customer session token — 见 Customer Session 端点。使用 customer token 调用时,买家身份从 token 中取得,请求体中的
buyerIdentity 字段会被覆盖。资格判定规则
资格判定基于买家在该产品(或同产品组内任一产品)是否已有试用记录:- 无试用记录 →
isEligible: true,trialDays返回产品配置的试用天数 - 已有试用记录 →
isEligible: false,trialDays为null
buyerIdentity 为空时,视为全新买家,恒返回 isEligible: true。
请求体
| 字段 | 类型 | 必需 | 说明 |
|---|---|---|---|
checkoutSessionId | string | 是 | 由「创建 Checkout Session」返回的会话 ID(必须是订阅产品) |
buyerIdentity | string | 条件 | 买家邮箱。Customer 模式下从 token 取得(必填);visitor 模式可选 — 不传则视为有完整试用资格,不查记录 |
请求示例
成功响应 (200) — 有试用资格
成功响应 (200) — 无试用资格
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
isEligible | boolean | 是否有试用资格(无试用记录为 true) |
trialDays | number | null | 有资格时返回试用天数;无资格时为 null |
错误响应
重试策略:4xx 一律不要重试 — 修正请求后重发。5xx 指数退避重试(起步 5s,最多 3 次)。
| 状态码 | errors[0].message | 含义 | 推荐处理 |
|---|---|---|---|
| 400 | Invalid JSON body | 请求体不是合法 JSON | 修正请求体后重新提交 |
| 400 | Missing required field: checkoutSessionId | 未提供 checkoutSessionId | 修正请求体后重新提交 |
| 400 | Session product type mismatch: expected subscription | Session 是一次性产品创建的 | 创建订阅类型的 checkout session 再重试 |
| 401 | Unauthorized | Store Slug 或 session token 无效 | 检查认证请求头 |
| 404 | Session not found | Checkout session 不存在或已过期 | 重新创建 checkout session 再重试 |
| 404 | Session does not belong to this store | Session 属于其他门店 | 使用调用方门店的 session |
| 500 | Internal server error | 服务端意外失败 | 指数退避重试(起步 5s,最多 3 次) |