NATSpayment.subscription.create创建订阅

业务服务经本 subject 创建周期订阅;扣款方式缺省用用户默认支付方式。

Request Payload

消息格式:JSON

NameData TypeRequiredDescription
userIdstringYes用户 ID
titlestringYes订阅标题
businessServicestringYes业务服务标识
amountnumberYes周期金额
currencystringYes币种
intervalstringYesmonthly / yearly
defaultMethodIdstringNo扣款支付方式(可选)
type RequestBody = {
  /** 用户 ID */
  userId: string
  /** 订阅标题 */
  title: string
  /** 业务服务标识 */
  businessService: string
  /** 周期金额 */
  amount: number
  /** 币种 */
  currency: string
  /** monthly / yearly */
  interval: string
  /** 扣款支付方式(可选) */
  defaultMethodId?: string
}
{
  "userId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
  "title": "Xeegam Cloud · 专业版",
  "businessService": "cloud",
  "amount": 28,
  "currency": "USD",
  "interval": "monthly"
}

Response Payload

回复使用统一信封 {id, code, messages, result},其 result:

NameData TypeRequiredDescription
subscriptionIdstringYes订阅 ID
statusstringYes固定为 active
nextRenewalAtstringYes下次续订时间
createdAtstringYes创建时间
type ResponseBody = {
  /** 订阅 ID */
  subscriptionId: string
  /** 固定为 active */
  status: string
  /** 下次续订时间 */
  nextRenewalAt: string
  /** 创建时间 */
  createdAt: string
}
{
  "subscriptionId": "01JD8SOBHV0C3D9JD",
  "status": "active",
  "nextRenewalAt": "2026-11-13T09:00:00Z",
  "createdAt": "2026-10-14T15:30:00Z"
}

Response Code

回复使用统一信封 {id, code, messages, result},其 code 字段:

code Meaning Notes
0 成功 创建订阅
2803 缺少可用支付方式 既无指定方式也无默认方式

Examples

{
  "userId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
  "title": "Xeegam Cloud · 专业版",
  "businessService": "cloud",
  "amount": 28,
  "currency": "USD",
  "interval": "monthly"
}
{
  "id": "01JD8SX6UJ0H7IE",
  "code": 0,
  "messages": [],
  "result": {
    "subscriptionId": "01JD8SOBHV0C3D9JD",
    "status": "active",
    "nextRenewalAt": "2026-11-13T09:00:00Z",
    "createdAt": "2026-10-14T15:30:00Z"
  }
}