发起结账
发起结账,得到一个由对方打开的付款页面。默认使用加密货币;如需银行卡,发送 paymentRail CARD。账号还有试用时会使用试用。响应中的 next 说明下一步:open_payment(把 paymentUrl 交给对方,然后查询 pollUrl)、join_discord 或 wait。用相同的 Idempotency-Key 重放会返回同一个结账。
POST
/api/agent/checkout授权
Authorizationstringheader必填使用 TweetStream API 密钥进行 Bearer 认证:Bearer <key>。
请求头
Idempotency-Keystringheader必填必填。每次购买或变更生成一个 key,重试时沿用;相同的 key 返回相同的结果。X-TweetStream-Setup-Proofstringheader可选可选。邮箱验证返回的 setupProof;带上后,Discord 步骤会包含加入链接。
请求体
billingCycleenum<string>可选paymentRailenum<string>可选trialenum<string>可选familyenum<string>必填planTypeenum<string>必填
响应字段
checkoutIdstring可选a string matching the pattern ^pl_[a-z0-9]{1,64}$familyenum<string>必填nextobject必填messagestring可选a string at most 500 character(s) longactionenum<string>必填methodenum<string>必填urlstring必填a string matching the pattern ^(https|wss):\/\/[^\s]+$whoenum<string>必填
offerobject可选amountDueNowobject必填currencyenum<string>必填minorstring必填a string matching the pattern ^(0|[1-9][0-9]*)$
modeenum<string>必填planNamestring必填renewalobject必填amountobject必填currencyenum<string>必填minorstring必填a string matching the pattern ^(0|[1-9][0-9]*)$
atstring必填a string to be decoded into a DatebillingCycleenum<string>必填thenAmountobject必填currencyenum<string>必填minorstring必填a string matching the pattern ^(0|[1-9][0-9]*)$
paymentUrlstring可选a string matching the pattern ^(https|wss):\/\/[^\s]+$reasonenum<string>必填statusenum<string>必填
响应
- 200重放请求、产品已开通,或对方需要先加入 Discord
- 201已创建结账
- 202结账正在准备中,请查询状态
- 400请求无效、验证码错误,或未接受服务条款
- 401API key 缺失或无效,或 setup proof 缺失或已过期
- 403账号受到限制,或请求带有外部 Origin
- 409幂等键、结账、优惠或试用冲突
- 429已达到速率限制或开通额度,请在 retryAfterSeconds 秒后重试
- 503暂时不可用,请稍后重试