跳转到内容

创建订单(登录态;sku 缺省 recharge = amount 直充;sku plan:<tier>:<1y|1m> = 套餐单,动作 new/renew/upgrade/downgrade 与金额恒服务端算(客户端 amount 不一致 400;差价 0.00 不可下单 409 plan_zero_amount;存在 scheduled 降档行 409 plan_scheduled_exists);渠道参数未交割时 503;带 x-tansr-org 头 = org 单,owner/billing)

POST
/v1/orders
curl --request POST \
--url https://api.tansr.com/v1/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "sku": "example", "amount": "example", "channel": "wechat", "catalogRevision": 1 }'
x-tansr-org
string

Org 作用域声明(org 公开 id);服务端校验成员资格与角色,非成员恒 404、角色不够 403

Media typeapplication/json
object
sku

缺省 ‘recharge’(amount 必填直充);‘plan::<1y|1m>’ 套餐单(金额服务端按档价/差价算;客户端 amount 可省或须与报价一致,否则 400)

string
/^(recharge|plan:(test|small|medium|large):(1y|1m))$/
amount

DECIMAL(18,2) 字符串;recharge 必填 = 直充额;plan:* 可省(在场须等于服务端报价)

string
/^\d+(\.\d{1,2})?$/
channel
required
Any of:
string
Allowed value: wechat
catalogRevision

套餐报价的目录修订号;不一致须重新报价

integer

订单 + 收银载荷(codeUrl/qrCode)

Media typeapplication/json
object
order
required
object
id
required
string
sku
required
string
amount
required
string
currency
required
string
channel
required
string
status
required
Any of:
string
Allowed value: created
createdAt
required
string
planOffer
object
catalogRevision
required
integer
caps
required
object
concurrency
required

并发会话上限(软帽;硬帽 = floor(×1.1))

integer
apps
required

应用数上限(active app-scope 键)

integer
orgMembers
required

组织成员上限(仅 org owner 生效)

integer
monthlyEndUsers
required
Any of:
integer
gatewayLane
required

可登记出口 IP 进网关档(SC-34)

boolean
walletCredit
required
Any of:
string
giftTokens
required
object
enabled
required
boolean
amount
required
integer
<= 1000000000000
grantOn
required
string
Allowed value: purchase
expiresAfterDays
required
Any of:
integer
>= 1 <= 3660
paidAt
required
Any of:
string
payload
required
object
codeUrl

微信 Native 扫码串

string
qrCode

支付宝当面付二维码串

string
Example
{
"order": {
"status": "created",
"planOffer": {
"giftTokens": {
"grantOn": "purchase"
}
}
}
}

Bad_request(金额与报价不符 / recharge 缺 amount)

Media typeapplication/json
object
error
required
object
code
required

错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)

string
Allowed values: adjudicator_not_authorized admin_forbidden admin_key_invalid app_disabled app_ip_denied app_key_invalid approval_self_forbidden asr_not_configured asr_quota_exceeded auth_channel_undelivered bad_request conflict content_blocked context_window_exceeded currency_not_supported device_code_denied device_code_expired device_code_pending device_code_slow_down egress_blocked endpoint_disabled envelope_key_undelivered fence_denied forbidden idempotency_conflict idp_untrusted image_not_supported imagegen_not_configured imagegen_quota_exceeded insufficient_balance internal_error invalid_api_key license_required limit_exceeded liquidation_not_enabled model_not_authorized model_not_found nonce_replayed not_found order_state_invalid org_byok_not_available org_ceiling_exceeded otp_invalid otp_rate_limited pay_amount_mismatch pay_channel_undelivered pay_signature_invalid payload_too_large payment_required plan_apps_exceeded plan_concurrency_exceeded plan_end_users_exceeded plan_gate_unavailable plan_members_exceeded plan_required plan_tier_insufficient policy_locked pool_signing_undelivered preflight_required pricing_guard_tripped principal_required protocol_unsupported quota_exceeded rate_limited refund_not_eligible section_not_deliverable session_archived signature_invalid stream_backpressure token_expired tts_not_configured tts_quota_exceeded unauthorized upstream_connect_timeout upstream_disconnected upstream_error upstream_idle_timeout upstream_timeout upstream_total_timeout upstream_ttfb_timeout validation_failed videogen_not_configured videogen_quota_exceeded websearch_not_configured websearch_quota_exceeded
message
required
string
requestId
required
string
detail
object
Example
{
"error": {
"code": "adjudicator_not_authorized"
}
}

Conflict(plan_zero_amount / plan_scheduled_exists)

Media typeapplication/json
object
error
required
object
code
required

错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)

string
Allowed values: adjudicator_not_authorized admin_forbidden admin_key_invalid app_disabled app_ip_denied app_key_invalid approval_self_forbidden asr_not_configured asr_quota_exceeded auth_channel_undelivered bad_request conflict content_blocked context_window_exceeded currency_not_supported device_code_denied device_code_expired device_code_pending device_code_slow_down egress_blocked endpoint_disabled envelope_key_undelivered fence_denied forbidden idempotency_conflict idp_untrusted image_not_supported imagegen_not_configured imagegen_quota_exceeded insufficient_balance internal_error invalid_api_key license_required limit_exceeded liquidation_not_enabled model_not_authorized model_not_found nonce_replayed not_found order_state_invalid org_byok_not_available org_ceiling_exceeded otp_invalid otp_rate_limited pay_amount_mismatch pay_channel_undelivered pay_signature_invalid payload_too_large payment_required plan_apps_exceeded plan_concurrency_exceeded plan_end_users_exceeded plan_gate_unavailable plan_members_exceeded plan_required plan_tier_insufficient policy_locked pool_signing_undelivered preflight_required pricing_guard_tripped principal_required protocol_unsupported quota_exceeded rate_limited refund_not_eligible section_not_deliverable session_archived signature_invalid stream_backpressure token_expired tts_not_configured tts_quota_exceeded unauthorized upstream_connect_timeout upstream_disconnected upstream_error upstream_idle_timeout upstream_timeout upstream_total_timeout upstream_ttfb_timeout validation_failed videogen_not_configured videogen_quota_exceeded websearch_not_configured websearch_quota_exceeded
message
required
string
requestId
required
string
detail
object
Example
{
"error": {
"code": "adjudicator_not_authorized"
}
}

Pay_channel_undelivered

Media typeapplication/json
object
error
required
object
code
required

错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)

string
Allowed values: adjudicator_not_authorized admin_forbidden admin_key_invalid app_disabled app_ip_denied app_key_invalid approval_self_forbidden asr_not_configured asr_quota_exceeded auth_channel_undelivered bad_request conflict content_blocked context_window_exceeded currency_not_supported device_code_denied device_code_expired device_code_pending device_code_slow_down egress_blocked endpoint_disabled envelope_key_undelivered fence_denied forbidden idempotency_conflict idp_untrusted image_not_supported imagegen_not_configured imagegen_quota_exceeded insufficient_balance internal_error invalid_api_key license_required limit_exceeded liquidation_not_enabled model_not_authorized model_not_found nonce_replayed not_found order_state_invalid org_byok_not_available org_ceiling_exceeded otp_invalid otp_rate_limited pay_amount_mismatch pay_channel_undelivered pay_signature_invalid payload_too_large payment_required plan_apps_exceeded plan_concurrency_exceeded plan_end_users_exceeded plan_gate_unavailable plan_members_exceeded plan_required plan_tier_insufficient policy_locked pool_signing_undelivered preflight_required pricing_guard_tripped principal_required protocol_unsupported quota_exceeded rate_limited refund_not_eligible section_not_deliverable session_archived signature_invalid stream_backpressure token_expired tts_not_configured tts_quota_exceeded unauthorized upstream_connect_timeout upstream_disconnected upstream_error upstream_idle_timeout upstream_timeout upstream_total_timeout upstream_ttfb_timeout validation_failed videogen_not_configured videogen_quota_exceeded websearch_not_configured websearch_quota_exceeded
message
required
string
requestId
required
string
detail
object
Example
{
"error": {
"code": "adjudicator_not_authorized"
}
}