套餐报价预览(query sku=plan:<tier>:<1y|1m>):与 POST /v1/orders 同一判定函数回显动作/应付/起算/到期/差价算式;带 x-tansr-org 头 = org 语境(owner/billing);形外 sku 400;存在 scheduled 降档行 409
GET
/v1/plan/quote
const url = 'https://api.tansr.com/v1/plan/quote?sku=example';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.tansr.com/v1/plan/quote?sku=example' \ --header 'Authorization: Bearer <token>'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”x-tansr-org
string
Org 作用域声明(org 公开 id);服务端校验成员资格与角色,非成员恒 404、角色不够 403
Query Parameters
Section titled “Query Parameters”sku
required
string
‘plan:
Responses
Section titled “Responses”报价
Media typeapplication/json
object
sku
required
string
offer
object
catalogRevision
required
integer
caps
required
amount
required
string
listPrice
required
string
currency
required
string
startsAt
required
新行起算(ISO;renew = 旧 expires_at;downgrade = 当前 expires_at;其余 = 下单时刻)
string
expiresAt
required
string
proration
required
Example
{ "offer": { "giftTokens": { "grantOn": "purchase" } }, "tier": "test", "cycle": "1y", "action": "new", "status": "active", "from": { "tier": "test", "status": "active" }}Bad_request(sku 形外)
Media typeapplication/json
object
error
required
object
code
required
错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)
string
message
required
string
requestId
required
string
detail
object
Example
{ "error": { "code": "adjudicator_not_authorized" }}Conflict(plan_scheduled_exists)
Media typeapplication/json
object
error
required
object
code
required
错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)
string
message
required
string
requestId
required
string
detail
object
Example
{ "error": { "code": "adjudicator_not_authorized" }}本文是否有帮助?
感谢反馈,我们会持续改进这篇文章。