跳到正文
Longplay
开发文档
章节目录 / 预览购买报价
本页内容

预览购买报价

操作名
previewAttach
服务端 SDK
previewAttach
Python
preview_attach
Go
PreviewAttach
浏览器 SDK
previewAttach
POST/api/v1/subscriptions/preview-attach

为所选 Product、Provider 与币种生成固定报价和 operationId;不扣款。

Markdown
API v1更新于

请求#

凭据
Server Key(传 customerId)或 Customer Token,权限 billing:read。
SDK
JavaScript createLongplayServer().previewAttach · JavaScript createLongplay().previewAttach · Python preview_attach · Go PreviewAttach
成功状态
HTTP 200
在 record_only 模式下,商户须先支持商户桥接 v4 的 operation.prepare 准备命令,Longplay 才能冻结报价并生成 merchantTerms;确认报价时提交与之匹配的 merchantConfirmation。

相关:商户准备报价

request.shShell
curl -X POST "$LONGPLAY_API_URL/api/v1/subscriptions/preview-attach" \  -H "Authorization: Bearer $LONGPLAY_SERVER_KEY" \  -H "X-Indiana-Protocol: 0.10" \  -H "Content-Type: application/json" \  -d '{  "requestId": "0f58d1f8-069f-4288-8ec1-4ed10af55b45",  "plans": [    {      "productVersionId": "8c489a1a-5542-44fe-8e80-da2f6a319d01"    }  ],  "provider": "stripe",  "currency": "USD",  "customerId": "8b258f8b-4228-40fa-8d24-5b16428e686d"}'

响应为示例数据。

请求体参数#

application/json

requestIduuid必填

你的业务请求 UUID;同一次操作重试复用,新的操作生成新值。

predecessorOperationIduuid可选

前一次相关操作的 ID。

invoiceModeobject可选

开票方式设置(可选)。

展开子字段
enabledboolean必填

是否启用。

enable_plan_immediatelyboolean可选

是否立即启用 Product。

default: false

finalizeboolean可选

是否立即定稿。

default: true

invoice_template_idstring可选

发票模板的 ID。

net_terms_daysinteger可选

付款期限(天)。

max: 9007199254740991

entityIduuid可选

当前客户范围内的 Entity ID;只用于已配置的 Entity 和许可 Feature。

billingSubscriptionIduuid可选

计费订阅的 ID。

newBillingSubscriptiontrue可选

仅 Stripe 可设为 true,强制新建财务订阅,不能同时指定 billingSubscriptionId;仍校验跨渠道主套餐互斥。

offerIduuid可选

当前 Customer 已领取的优惠 ID,用于新购买;已有订阅改用 setBillingCoupons。

nativeOfferobject可选

App Store 或 Google Play 的优惠选择。

展开子字段
offerKindenum必填

优惠类型,取值见允许值。

查看允许值

"none""introductory""promotional"

offerIdstring | null必填

当前 Customer 已领取的优惠 ID,用于新购买;已有订阅改用 setBillingCoupons。

discountMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

trialDaysinteger | null必填

试用天数。

plansarray必填

要购买的 Product Version,可附带席位和 Feature 数量。

minItems: 1 · maxItems: 20

展开子字段
productVersionIduuid必填

Product Version 的 ID。

seatQuantitiesobject可选

按许可键(报价中的 seats.key)指定该 Product 每个席位许可要购买的席位总数,取值为 0 到 10000 的整数。省略的许可或低于包含数量的值按包含的席位数计算,超出部分收费。

featureQuantitiesobject可选

按 Feature UUID 指定该 Product 每个预付 Feature 要购买的包数,取值为 0 到 10000 的整数;每包增加该 Price 的计费单位数量。该 Product 的每个预付 Feature 都必须提供(0 表示不购买)。

providerenum必填

支付渠道,取值见允许值。

查看允许值

"stripe""apple""google""merchant"

currencyenum必填

已发布价格支持的币种代码。

查看允许值

"USD""EUR""CNY""GBP""JPY""CAD""AUD""NZD""CHF""HKD""SGD""KRW""INR""BRL""MXN""TWD""THB""IDR""MYR""PHP""VND""ZAR""AED""SAR""SEK""NOK""DKK""PLN""CZK""HUF""ILS""TRY""RON"

funnelIduuid可选

Funnel 的 ID。

funnelVersionIduuid可选

Funnel 版本的 ID。

customerIduuid可选

Customer 的 UUID。

响应字段#

成功响应都包含 requestId(本次请求 ID,排查时提供)和 scope(App 与环境)。

HTTP 200 · application/json

requestIduuid必填

服务端为这次 HTTP 请求生成的 UUID,排查时提供;它不是你的业务 requestId。

scopeobject必填

响应实际所属的 App 和环境。Header 只能核对,不能切换 Key 范围。

展开子字段
projectIdstring必填

凭据绑定的 App ID。

minLength: 1

environmentenum必填

独立数据范围:sandbox 或 live。

查看允许值

"sandbox""live"

quoteobject必填

报价。

展开子字段
operationIduuid必填

业务操作 UUID;订阅执行引用 previewAttach 返回的 operationId,余额退款引用原消费操作。

merchantTermsobject可选

商户已准备好的条款;有它时金额和周期以它为准。

展开子字段
requestobject | object | object必填

商户收到的原准备请求,用来证明这些条款属于哪次选择。

展开子字段
subjectobject | object | object必填

原准备请求绑定的 App、环境和 Customer。

operationIduuid | uuid | uuid必填

业务操作 UUID;订阅执行引用 previewAttach 返回的 operationId,余额退款引用原消费操作。

configurationRevisioninteger | integer | integer必填

原准备请求绑定的配置修订号。

connectionRevisioninteger | integer | integer必填

发起准备时的商户连接版本;连接变更后需重新准备。

expiresAtdate-time | date-time | date-time必填

到期时间(ISO 8601,UTC)。

action"purchase" | "subscription_change" | "refund"必填

本次业务动作。不同动作的目标字段和数量要求不同,见请求结构与示例。

modeenum | enum可选

模式,取值见允许值。

currencystring | string | string必填

已发布价格支持的币种代码。

itemsarray可选

列表项。

minItems: 1 · maxItems: 100

offerRefsarray | array可选

这次选择带上的商户优惠引用。

merchantSubscriptionIdstring可选

要变更的商户订阅引用。

minLength: 1 · maxLength: 200

changeobject | object | object | object | object | object可选

要变更到的目标。

timingenum可选

立即变更或在周期末变更;只用于契约允许的套餐变更动作。

查看允许值

"immediate""renewal"

prorationenum可选

这次计划变更使用的按比例结算方式。

查看允许值

"none""create_prorations""always_invoice"

merchantInvoiceIdstring可选

要退款的商户账单引用。

minLength: 1 · maxLength: 200

amountMinorinteger可选

金额,以最小货币单位计(如美分)。

max: 200000000

entitlementActionenum可选

退款后保留(retain)或撤销(revoke)权益。

查看允许值

"retain""revoke"

requestDigeststring必填

原准备请求的规范摘要。

pattern: ^[a-f0-9]{64}$

merchantQuoteIdstring必填

商户这次报价的引用。

minLength: 1 · maxLength: 200

quoteTermsDigeststring必填

条款规范摘要;确认时绑定它,之后不可更换。

pattern: ^[a-f0-9]{64}$

termsVersionstring必填

商户条款版本。

minLength: 1 · maxLength: 200

sourceRevisionsarray必填

报价依据的商品目录或订阅版本。

maxItems: 100

展开子字段
referencestring必填

报价依据的数据来源引用。

minLength: 1 · maxLength: 200

revisionstring必填

特定资源的版本号;Customer 资料更新不使用版本号。

minLength: 1 · maxLength: 200

observedAtdate-time必填

时间(ISO 8601)。

expiresAtdate-time必填

到期时间(ISO 8601,UTC)。

currencystring必填

已发布价格支持的币种代码。

pattern: ^[A-Z]{3}$

automaticTaxboolean必填

税额是否由商户按自动税计算;未知税额不会当作 0。

linesarray必填

明细行。

maxItems: 100

展开子字段
merchantLineIdstring必填

商户原生发票行稳定标识;同一发票内不能重复。

minLength: 1 · maxLength: 200

merchantPriceIdstring | null必填

这一行的商户价格引用;无对应价格时为空。

quantitystring必填

数量,十进制字符串,避免浮点误差。

pattern: ^(0|[1-9]\d{0,11})(\.\d{1,6})?$

subtotalMinorinteger必填

金额,以最小货币单位计(如美分)。

min: -200000000 · max: 200000000

discountMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 200000000

taxMinorinteger | null必填

金额,以最小货币单位计(如美分)。

totalMinorinteger | null必填

金额,以最小货币单位计(如美分)。

subscriptionTermsobject | null必填

后续周期的订阅承诺,独立于本次扣款;非订阅时为空。

展开子字段
itemsarray必填

列表项。

minItems: 1 · maxItems: 100

trialobject | null必填

试用。

discountobject | null可选

折扣。

discountExpiresAtdate-time | null可选

时间(ISO 8601)。

initialAmountMinorinteger可选

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

subtotalMinorinteger必填

金额,以最小货币单位计(如美分)。

min: -200000000 · max: 200000000

discountMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 200000000

nativeDiscountMinorinteger可选

金额,以最小货币单位计(如美分)。

min: 0 · max: 200000000

discountobject | null可选

折扣。

展开子字段
grantIduuid必填

发放记录的 ID。

couponIduuid必填

当前 App 和环境中的优惠券 UUID。

amountMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

applicationPolicyenum可选

此优惠与原生价格折扣的组合方式:替换原生折扣,或在原生折扣上叠加。

查看允许值

"replace""stack_native"

applicableProductIdsarray可选

当前 App 和环境中,此优惠适用的商户原生 Product 标识。

minItems: 1 · maxItems: 100

termsobject | object必填

条款内容。

durationobject | object | object必填

持续时长。

taxMinorinteger | null必填

金额,以最小货币单位计(如美分)。

totalMinorinteger | null必填

金额,以最小货币单位计(如美分)。

effectiveAtdate-time | null必填

时间(ISO 8601)。

expectedEffectsarray必填

商户承诺的原生结果,用于确认展示,不代表平台余额。

maxItems: 100

展开子字段
referencestring必填

这项预期结果的稳定标识。

minLength: 1 · maxLength: 200

kindenum必填

类型,取值见允许值。

查看允许值

"grant""revoke""change"

descriptionstring必填

描述。

minLength: 1 · maxLength: 1000

quantitystring | null必填

数量,十进制字符串,避免浮点误差。

unitstring | null必填

数量对应的商户单位;没有数量时为空。

requiredConsentsarray必填

确认前用户必须接受的商户条款。

maxItems: 20

展开子字段
referencestring必填

这项同意条款的稳定标识。

minLength: 1 · maxLength: 200

versionstring必填

版本号。

minLength: 1 · maxLength: 200

summarystring必填

向用户展示的条款摘要。

minLength: 1 · maxLength: 1000

entityIduuid | null必填

当前客户范围内的 Entity ID;只用于已配置的 Entity 和许可 Feature。

billingSubscriptionIduuid | null必填

计费订阅的 ID。

discountobject | null必填

折扣。

展开子字段
offerIduuid必填

当前 Customer 已领取的优惠 ID,用于新购买;已有订阅改用 setBillingCoupons。

couponIduuid必填

当前 App 和环境中的优惠券 UUID。

discountobject | object必填

折扣。

展开子字段
type"percent" | "amount"必填

折扣类型:percent 按 percentOff 的百分比减免;amount 减免 amountOffCents,以 currency 的最小货币单位计。

percentOffnumber可选

折扣百分比。

min: 1 · max: 100

amountOffCentsinteger可选

减免金额(最小货币单位)。

min: 1 · max: 100000000

currencyenum可选

已发布价格支持的币种代码。

查看允许值

"USD""EUR""CNY""GBP""JPY""CAD""AUD""NZD""CHF""HKD""SGD""KRW""INR""BRL""MXN""TWD""THB""IDR""MYR""PHP""VND""ZAR""AED""SAR""SEK""NOK""DKK""PLN""CZK""HUF""ILS""TRY""RON"

durationobject | object | object必填

持续时长。

展开子字段
type"once" | "repeating" | "forever"必填

适用时长:once 仅适用于一张发票,repeating 适用 months 个月,forever 持续适用。

monthsinteger可选

月数。

min: 1 · max: 36

amountMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

allocationsarray必填

本次规则计算或账本操作涉及的余额分配明细。

minItems: 1 · maxItems: 20

展开子字段
productVersionIduuid必填

Product Version 的 ID。

amountMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

expiresAtdate-time必填

到期时间(ISO 8601,UTC)。

chargeobject | null必填

将 Product 加入 billingSubscriptionId 指定的现有 Stripe 订阅时,从 effectiveAt 到 periodEndsAt 按比例计算的费用;新购买时为 null。

展开子字段
effectiveAtdate-time必填

时间(ISO 8601)。

periodEndsAtdate-time必填

时间(ISO 8601)。

debitMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

discountMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

taxMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

totalMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

expiresAtdate-time必填

到期时间(ISO 8601,UTC)。

providerenum必填

支付渠道,取值见允许值。

查看允许值

"stripe""apple""google""merchant"

nativeOfferobject可选

App Store 或 Google Play 的优惠选择。

展开子字段
offerKindenum必填

优惠类型,取值见允许值。

查看允许值

"none""introductory""promotional"

offerIdstring | null必填

当前 Customer 已领取的优惠 ID,用于新购买;已有订阅改用 setBillingCoupons。

discountMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

trialDaysinteger | null必填

试用天数。

currencyenum必填

已发布价格支持的币种代码。

查看允许值

"USD""EUR""CNY""GBP""JPY""CAD""AUD""NZD""CHF""HKD""SGD""KRW""INR""BRL""MXN""TWD""THB""IDR""MYR""PHP""VND""ZAR""AED""SAR""SEK""NOK""DKK""PLN""CZK""HUF""ILS""TRY""RON"

linesarray必填

明细行。

minItems: 1 · maxItems: 20

展开子字段
lineIduuid必填

该报价行的 ID,在报价内唯一。

productVersionIduuid必填

Product Version 的 ID。

productNamestring必填

Product 名称。

minLength: 1 · maxLength: 80

intervalenum必填

周期,取值见允许值。

查看允许值

"free""week""month""year""one_time"

intervalCountinteger可选

收费周期的次数:week 最多 156、month 最多 36、year 最多 3,省略为 1;free 和 one_time 不接受。额度重置周期独立。

min: 1 · max: 156

baseAmountMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

seatsarray必填

席位。

maxItems: 20

展开子字段
keystring必填

该 Product 所含席位许可的键;在 plans.seatQuantities 中使用,也可在 previewUpdate 中作为 change.licenseKey 使用。

minLength: 1 · maxLength: 64 · pattern: ^[a-z][a-z0-9_]*$

quantityinteger必填

数量(整数)。

min: 0 · max: 10000

includedQuantityinteger必填

Product 价格中已包含、不额外收费的席位数;quantity 不会低于该值。

min: 0 · max: 10000

maximumQuantityinteger必填

该许可可请求的最大席位总数(10000)。

min: 0 · max: 10000

unitAmountMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

prepaidarray可选

该行逐项列出的预付 Feature 数量。API 目前返回空数组;预付包费用已计入 baseAmountMinor。

maxItems: 100

展开子字段
itemKeystring必填

明细项键。

pattern: ^paid:feature:[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$

internal_feature_iduuid必填

Feature 的 ID。

includedAmountstring必填

购买包之前该 Feature 已包含的数量,十进制字符串;总量为该值加上 terms.units × quantity。

pattern: ^(0|[1-9]\d{0,11})(\.\d{1,6})?$

quantityinteger必填

数量(整数)。

min: 0 · max: 10000

termsobject必填

条款内容。

pricingobject可选

计价明细。

unitAmountMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

productIdstring | null必填

Product 的 ID。

priceIdstring | null必填

绑定到该预付包的支付渠道 Price ID,例如 Stripe Price ID;未绑定时与 productId 一起为 null,仅在该包不收费时允许。

catalogAmountMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

trialobject | null必填

试用。

展开子字段
daysinteger必填

天数。

min: 1 · max: 730

cardRequiredboolean必填

试用是否需要先收集付款方式。未启用 invoiceMode 的 Stripe 报价中为 false 时没有 execution:attach 会立即开始试用,不经过 Checkout,也不能使用优惠券。

catalogAmountMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

nativeDiscountMinorinteger可选

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

automaticTaxboolean必填

该购买是否使用 Stripe 自动计税;为 true 时,Stripe 会在 Checkout 时在报价金额之外计算税费。

executionobject | object | null必填

执行信息。

展开子字段
invoiceModeobject可选

开票方式设置(可选)。

展开子字段
enabledboolean必填

是否启用。

enable_plan_immediatelyboolean可选

是否立即启用 Product。

default: false

finalizeboolean可选

是否立即定稿。

default: true

invoice_template_idstring可选

发票模板的 ID。

net_terms_daysinteger可选

付款期限(天)。

max: 9007199254740991

appendobject可选

追加到现有 Stripe 订阅时使用的上下文,字段见下。

展开子字段
subscriptionIdstring必填

Stripe 订阅 ID(sub_…)。

pattern: ^sub_[A-Za-z0-9]+$

customerIdstring必填

Stripe Customer ID(cus_…)。

pattern: ^cus_[A-Za-z0-9]+$

sourceItemsarray必填

来源明细项。

minItems: 1 · maxItems: 100

prorationDateinteger必填

将 Product 加入现有 Stripe 订阅时作为 Stripe proration_date 发送的 Unix 时间(秒);按比例计费从该时刻计算到周期结束。

min: 0 · max: 9007199254740991

amountMinorinteger必填

金额,以最小货币单位计(如美分)。

max: 9007199254740991

periodStartMsnumber必填

周期开始时间(毫秒时间戳)。

periodEndMsnumber必填

周期结束时间(毫秒时间戳)。

provider"stripe" | "merchant"必填

支付渠道,取值见允许值。

executorenum | "merchant"必填

执行方,取值见允许值。

accountIdstring可选

Stripe 账户 ID(acct_…)。

pattern: ^acct_[A-Za-z0-9]+$

modeenum | enum必填

模式,取值见允许值。

lineItemsarray | array必填

明细行。

展开子字段
pricestring | null可选

Stripe Price ID(price_…)。

quantityinteger | integer必填

数量(整数)。

priceIduuid | uuid必填

该明细行所计费的目录 Price 的 UUID;price 是与之绑定的 Stripe Price。

productNamestring可选

Product 名称。

minLength: 1 · maxLength: 80

amountMinorinteger可选

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

currencystring可选

已发布价格支持的币种代码。

pattern: ^[a-z]{3}$

intervalenum | enum必填

周期,取值见允许值。

intervalCountinteger | integer必填

Stripe Price 的计费间隔数量,最多 52。

slotenum可选

该行使用该 Price 的哪个 Stripe Price:stripe_price_id 为常规 Stripe Price;stripe_empty_price_id 为计量 Price 的零金额周期性 Stripe Price,仅在没有其他周期性项目维持订阅时加入,用量在续订时计费。

查看允许值

"stripe_price_id""stripe_empty_price_id"

tiersobject | null | object | null必填

阶梯价格档位。

productVersionIduuid可选

Product Version 的 ID。

productIdstring可选

Product 的 ID。

minLength: 1 · maxLength: 200

unitAmountMinorinteger可选

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

totalMinorinteger可选

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

kindenum可选

类型,取值见允许值。

查看允许值

"fixed""prepaid""seat"

discountsarray可选

折扣列表。

maxItems: 1

展开子字段
couponstring必填

优惠券。

pattern: ^[A-Za-z0-9_-]{1,200}$

termsobject必填

条款内容。

trialPeriodDaysinteger | null | integer | null必填

天数。

metadataobject可选

自定义键值数据。

展开子字段
grooveCheckoutIduuid必填

Longplay 写入 Stripe metadata 的归因字段,原样复制,不要修改。

grooveCustomerIduuid必填

Longplay 写入 Stripe metadata 的归因字段,原样复制,不要修改。

expiresAtdate-time | date-time必填

到期时间(ISO 8601,UTC)。

operationIduuid可选

业务操作 UUID;订阅执行引用 previewAttach 返回的 operationId,余额退款引用原消费操作。

customerIduuid可选

Customer 的 UUID。

configurationRevisioninteger可选

扫描配置的修订号。

min: 0 · max: 9007199254740991

connectionRevisioninteger可选

冻结此商业指令时的商户连接修订号;用于核对此操作仍使用同一连接配置。

min: 0 · max: 9007199254740991

currencystring可选

已发布价格支持的币种代码。

pattern: ^[A-Z]{3}$

type"purchase"可选

原商户商业指令的类型:购买、订阅变更或退款。按该类型读取对应的固定商业参数。

catalogAmountMinorinteger可选

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

nativeDiscountMinorinteger可选

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

discountobject | null可选

折扣。

展开子字段
grantIduuid必填

发放记录的 ID。

couponIduuid必填

当前 App 和环境中的优惠券 UUID。

amountMinorinteger必填

金额,以最小货币单位计(如美分)。

min: 0 · max: 100000000

applicationPolicyenum可选

此优惠与原生价格折扣的组合方式:替换原生折扣,或在原生折扣上叠加。

查看允许值

"replace""stack_native"

applicableProductIdsarray可选

当前 App 和环境中,此优惠适用的商户原生 Product 标识。

minItems: 1 · maxItems: 100

termsobject | object必填

条款内容。

durationobject | object | object必填

持续时长。

automaticTaxboolean可选

原购买指令是否要求商户使用自动计税能力。该要求随报价固定,由商户原生支付流程执行。

错误#

失败时返回错误对象,按 error.code 与 error.recovery 处理。下表是这个接口的凭据、作用域和幂等字段决定的错误;视请求内容还可能返回 NOT_FOUND(引用的资源不存在)、NOT_CONFIGURED(所需的集成未连接)或 PAYLOAD_TOO_LARGE。有些拒绝(如余额不足)不是错误,而是成功响应里的 reason。

可能的错误
codeHTTP何时recovery
INVALID_REQUEST400请求不符合本页的参数。缺少或无法解析协议头时分别返回 UNSUPPORTED_PROTOCOL_VERSION 或 INVALID_PROTOCOL_VERSION。fix_request
UNAUTHENTICATED401凭据缺失、无效、过期或已撤销。authenticate
FORBIDDEN403凭据没有 billing:read 权限。check_permissions
SCOPE_MISMATCH403X-Indiana-Project 或 X-Indiana-Environment 与凭据所属的 App 和环境不一致。check_scope
CONFLICT409同一个 requestId 用了不同的输入(reason: IDEMPOTENCY_CONFLICT)。resolve_conflict
RATE_LIMITED429请求过多;按 Retry-After 等待后用同一请求重试。retry_same_request
SERVICE_UNAVAILABLE503服务暂时不可用;用同一请求重试。retry_same_request
INTERNAL_ERROR500结果未知;先读取原操作,或用原 ID 和原输入重放。recover_operation

可能的错误

  • INVALID_REQUEST

    HTTP
    400
    何时
    请求不符合本页的参数。缺少或无法解析协议头时分别返回 UNSUPPORTED_PROTOCOL_VERSION 或 INVALID_PROTOCOL_VERSION。
    recovery
    fix_request
  • UNAUTHENTICATED

    HTTP
    401
    何时
    凭据缺失、无效、过期或已撤销。
    recovery
    authenticate
  • FORBIDDEN

    HTTP
    403
    何时
    凭据没有 billing:read 权限。
    recovery
    check_permissions
  • SCOPE_MISMATCH

    HTTP
    403
    何时
    X-Indiana-Project 或 X-Indiana-Environment 与凭据所属的 App 和环境不一致。
    recovery
    check_scope
  • CONFLICT

    HTTP
    409
    何时
    同一个 requestId 用了不同的输入(reason: IDEMPOTENCY_CONFLICT)。
    recovery
    resolve_conflict
  • RATE_LIMITED

    HTTP
    429
    何时
    请求过多;按 Retry-After 等待后用同一请求重试。
    recovery
    retry_same_request
  • SERVICE_UNAVAILABLE

    HTTP
    503
    何时
    服务暂时不可用;用同一请求重试。
    recovery
    retry_same_request
  • INTERNAL_ERROR

    HTTP
    500
    何时
    结果未知;先读取原操作,或用原 ID 和原输入重放。
    recovery
    recover_operation

相关:错误码与恢复·请求约定·全部接口