查询购买操作结果
- 操作名
readSubscriptionOperation- 服务端 SDK
readSubscriptionOperation- Python
read_subscription_operation- Go
ReadSubscriptionOperation- 浏览器 SDK
readSubscriptionOperation
POST/api/v1/subscriptions/operations/read
读取购买操作的当前状态;结果未知时用它恢复。
API v1更新于
- 凭据
- Server Key(传
customerId)或 Customer Token,权限 billing:read。 - SDK
- JavaScript
createLongplayServer().readSubscriptionOperation · JavaScript createLongplay().readSubscriptionOperation · Python read_subscription_operation · Go ReadSubscriptionOperation - 成功状态
- HTTP 200
在 record_only 模式下,商户须先支持商户桥接 v4 的 operation.prepare 准备命令,Longplay 才能冻结报价并生成 merchantTerms;确认报价时提交与之匹配的 merchantConfirmation。
相关:商户准备报价
1curl -X POST "$LONGPLAY_API_URL/api/v1/subscriptions/operations/read" \2 -H "Authorization: Bearer $LONGPLAY_SERVER_KEY" \3 -H "X-Indiana-Protocol: 0.10" \4 -H "Content-Type: application/json" \5 -d '{6 "operationId": "a8b14e0c-6576-49a4-812c-7a1587e55255",7 "customerId": "8b258f8b-4228-40fa-8d24-5b16428e686d"8}'
响应为示例数据。
请求体参数#
application/json
operationIduuid必填业务操作 UUID;订阅执行引用 previewAttach 返回的 operationId,余额退款引用原消费操作。
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"
operationobject必填操作对象:状态、结果与恢复信息。
展开子字段
operationIduuid必填业务操作 UUID;订阅执行引用 previewAttach 返回的 operationId,余额退款引用原消费操作。
appendboolean可选是否追加到 Customer 现有的订阅,而不是新建订阅。
invoiceModeboolean可选开票方式设置(可选)。
statusenum必填状态,取值见允许值。
查看允许值
"pending""complete""cancelled""failed"
executorenum必填执行方,取值见允许值。
查看允许值
"indiana""merchant"
checkoutUrluri | null必填付款页面链接;为空时无需跳转。
executionobject | object | null必填执行信息。
展开子字段
invoiceModeobject可选开票方式设置(可选)。
展开子字段
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}$
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可选折扣。
展开子字段
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可选原购买指令是否要求商户使用自动计税能力。该要求随报价固定,由商户原生支付流程执行。
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"
catalogAmountMinorinteger必填金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
taxMinorinteger必填金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
totalMinorinteger | null必填金额,以最小货币单位计(如美分)。
quoteFinalizedboolean必填报价是否已确定。
nativePurchaseobject | null必填原生购买信息。
展开子字段
type"native_purchase"必填固定为 native_purchase:按这些条款在 App Store 或 Google Play 中完成购买。
productVersionIduuid必填Product Version 的 ID。
providerenum必填支付渠道,取值见允许值。
查看允许值
"apple""google"
productIdstring必填Product 的 ID。
minLength: 1 · maxLength: 255
productKindenum必填Product 类型,取值见允许值。
查看允许值
"membership""credit_pack""lifetime"
replacementobject | null必填替换信息。
展开子字段
sourceOrderIduuid必填本次 Product 变更所替换的商店购买的订单 ID。
sourceProductIdstring必填被替换订阅在 App Store 或 Google Play 中的商品 ID。
minLength: 1 · maxLength: 255
policyenum必填策略。
查看允许值
"apple_store""google_full_price"
sourceAccountTokensarray必填来源账户 Token。
maxItems: 50
appAccountTokenuuid可选Apple appAccountToken。
obfuscatedAccountIdstring可选仅 Google Play:在购买流程中作为 obfuscatedAccountId 传入。它是标识该 App 和环境中此 Customer 的稳定摘要值。
minLength: 1 · maxLength: 64
obfuscatedProfileIduuid可选仅 Google Play:在购买流程中作为 obfuscatedProfileId 传入。其值等于 orderId,用于将商店购买匹配到此订单。
basePlanIdstring可选要购买的订阅在 Google Play 中的基础方案(base plan)ID;仅 Google Play 会员购买时提供。
minLength: 1 · maxLength: 255
offerIdstring可选当前 Customer 已领取的优惠 ID,用于新购买;已有订阅改用 setBillingCoupons。
minLength: 1 · maxLength: 255
offerKindenum必填优惠类型,取值见允许值。
查看允许值
"none""introductory""promotional"
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"
catalogAmountMinorinteger必填金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
discountMinorinteger必填金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
trialDaysinteger | null必填试用天数。
seatBundlearray必填席位组合。
maxItems: 20
展开子字段
keystring必填该商店购买所含席位所属席位许可的键;quantity 为席位数量。
pattern: ^[a-z][a-z0-9_]{0,63}$
quantityinteger必填数量(整数)。
min: 1 · max: 10000
applePromotionalOfferobject | null必填Apple 促销优惠的签名信息。
展开子字段
offerIdstring必填当前 Customer 已领取的优惠 ID,用于新购买;已有订阅改用 setBillingCoupons。
minLength: 1 · maxLength: 255
keyIdstring必填为该优惠签名的 App Store Connect 订阅密钥 ID;与 nonce、signature、timestamp 一起作为 keyID 传给 StoreKit。
minLength: 1 · maxLength: 255
signaturestring必填签名。
minLength: 1 · maxLength: 1024
timestampinteger必填时间。
min: 0 · max: 9007199254740991
confirmedAtdate-time | null可选时间(ISO 8601)。
quoteobject可选报价。
展开子字段
operationIduuid必填业务操作 UUID;订阅执行引用 previewAttach 返回的 operationId,余额退款引用原消费操作。
merchantTermsobject可选商户已准备好的条款;有它时金额和周期以它为准。
展开子字段
requestobject | object | object必填商户收到的原准备请求,用来证明这些条款属于哪次选择。
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
observedAtdate-time必填时间(ISO 8601)。
expiresAtdate-time必填到期时间(ISO 8601,UTC)。
currencystring必填已发布价格支持的币种代码。
pattern: ^[A-Z]{3}$
automaticTaxboolean必填税额是否由商户按自动税计算;未知税额不会当作 0。
linesarray必填明细行。
maxItems: 100
subscriptionTermsobject | null必填后续周期的订阅承诺,独立于本次扣款;非订阅时为空。
subtotalMinorinteger必填金额,以最小货币单位计(如美分)。
min: -200000000 · max: 200000000
discountMinorinteger必填金额,以最小货币单位计(如美分)。
min: 0 · max: 200000000
nativeDiscountMinorinteger可选金额,以最小货币单位计(如美分)。
min: 0 · max: 200000000
discountobject | null可选折扣。
taxMinorinteger | null必填金额,以最小货币单位计(如美分)。
totalMinorinteger | null必填金额,以最小货币单位计(如美分)。
effectiveAtdate-time | null必填时间(ISO 8601)。
expectedEffectsarray必填商户承诺的原生结果,用于确认展示,不代表平台余额。
maxItems: 100
requiredConsentsarray必填确认前用户必须接受的商户条款。
maxItems: 20
entityIduuid | null必填当前客户范围内的 Entity ID;只用于已配置的 Entity 和许可 Feature。
billingSubscriptionIduuid | null必填计费订阅的 ID。
discountobject | null必填折扣。
展开子字段
offerIduuid必填当前 Customer 已领取的优惠 ID,用于新购买;已有订阅改用 setBillingCoupons。
couponIduuid必填当前 App 和环境中的优惠券 UUID。
discountobject | object必填折扣。
durationobject | object | object必填持续时长。
amountMinorinteger必填金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
allocationsarray必填本次规则计算或账本操作涉及的余额分配明细。
minItems: 1 · maxItems: 20
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
prepaidarray可选该行逐项列出的预付 Feature 数量。API 目前返回空数组;预付包费用已计入 baseAmountMinor。
maxItems: 100
catalogAmountMinorinteger必填金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
catalogAmountMinorinteger必填金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
nativeDiscountMinorinteger可选金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
automaticTaxboolean必填该购买是否使用 Stripe 自动计税;为 true 时,Stripe 会在 Checkout 时在报价金额之外计算税费。
executionobject | object | null必填执行信息。
展开子字段
invoiceModeobject可选开票方式设置(可选)。
appendobject可选追加到现有 Stripe 订阅时使用的上下文,字段见下。
provider"stripe" | "merchant"必填支付渠道,取值见允许值。
executorenum | "merchant"必填执行方,取值见允许值。
accountIdstring可选Stripe 账户 ID(acct_…)。
pattern: ^acct_[A-Za-z0-9]+$
modeenum | enum必填模式,取值见允许值。
lineItemsarray | array必填明细行。
discountsarray可选折扣列表。
maxItems: 1
trialPeriodDaysinteger | null | integer | null必填天数。
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可选折扣。
automaticTaxboolean可选原购买指令是否要求商户使用自动计税能力。该要求随报价固定,由商户原生支付流程执行。
merchantExecutionobject | object | object | null可选商户原操作的执行快照,分别保留付款、履约及回报 Longplay 的状态。
展开子字段
operationIduuid | uuid | uuid必填业务操作 UUID;订阅执行引用 previewAttach 返回的 operationId,余额退款引用原消费操作。
customerIduuid | uuid | uuid必填Customer 的 UUID。
merchantExecutionIdstring | string | string必填商户为原操作保存的稳定执行引用;读取和恢复时保留同一引用。
fulfillmentStatusenum | enum | enum必填商户原生履约的进度或结果,包括尚未开始、进行中、已应用、失败或不适用。
recordingStatusenum | enum | enum必填执行结果回报 Longplay 的进度;付款和原生履约是否完成仍由各自状态表示。
updatedAtdate-time | date-time | date-time必填记录最后更新时的 ISO 8601 UTC 时间。
problemobject | null | object | null | object | null必填此执行快照中记录的问题,包含发生阶段、错误码及原操作的恢复建议;无问题时为 null。
展开子字段
phaseenum | enum | enum必填问题发生的阶段:执行、付款、履约或回报 Longplay。
codeenum | enum | enum必填此问题的结构化 API 错误码,配合阶段及恢复建议处理原操作。
reasonenum | enum | enum可选此错误的细分原因;RESULT_UNKNOWN 表示财务结果未确认,须恢复原操作。
recoveryenum | enum | enum必填原操作的下一步恢复动作;财务结果未确认时按 recover_operation 恢复原操作。
retryableboolean | boolean | boolean必填是否可按给定恢复动作重试失败请求;RESULT_UNKNOWN 时为 false,保留原操作进行恢复。
pollAfterMsinteger | null | integer | null | integer | null必填再次读取同一原操作前建议等待的毫秒数;未提供轮询间隔时为 null。
type"purchase" | "subscription_change" | "refund"必填此执行快照所属的原操作类型:购买、订阅变更或退款。
merchantOrderIdstring | null可选原购买的商户订单稳定引用;尚未获得订单引用时为 null。
paymentStatusenum可选原购买的付款进度或已观察到的结果;履约及回报 Longplay 的进度分别查看对应状态。
查看允许值
"not_started""pending""succeeded""not_required""failed""expired""unknown"
checkoutUrluri | null可选付款页面链接;为空时无需跳转。
checkoutExpiresAtdate-time | null可选时间(ISO 8601)。
statusenum | enum可选状态,取值见允许值。
merchantSubscriptionIdstring可选此变更快照对应的商户原生订阅稳定引用。
minLength: 1 · maxLength: 200
scheduledFordate-time | null可选已安排的原订阅变更生效时间(ISO 8601);非 scheduled 状态时为 null。
nextActionobject可选原订阅变更的可选后续付款动作,包含商户提供的 HTTPS 支付页面及过期时间;读取或恢复时仍对应同一原操作。
展开子字段
type"redirect"必填后续付款动作类型,固定为 redirect:跳转到商户提供的原付款页面。
urlstring必填商户提供的原付款页面地址(HTTPS),用于完成原操作所需的付款或验证;结果以读取同一原操作为准。
pattern: ^https:\/\/.*
expiresAtdate-time必填到期时间(ISO 8601,UTC)。
merchantRefundIdstring | null可选原退款的商户稳定引用;尚未获得时为 null,成功退款必须保留此引用。
problemobject | null可选阻碍原商户操作继续推进的结构化问题,包含阶段、错误码及恢复建议;无问题时为 null。
展开子字段
phaseenum必填问题发生的阶段:执行、付款、履约或回报 Longplay。
查看允许值
"execution""payment""fulfillment""recording"
codeenum必填此问题的结构化 API 错误码,配合阶段及恢复建议处理原操作。
查看允许值
"INVALID_PROTOCOL_VERSION""UNSUPPORTED_PROTOCOL_VERSION""PROTOCOL_RETIRED""UNAUTHENTICATED""FORBIDDEN""SCOPE_MISMATCH""INVALID_REQUEST""NOT_FOUND""CONFLICT""PAYLOAD_TOO_LARGE""RATE_LIMITED""SERVICE_UNAVAILABLE""NOT_CONFIGURED""CAPABILITY_UNAVAILABLE""INTERNAL_ERROR"
reasonenum可选此错误的细分原因;RESULT_UNKNOWN 表示财务结果未确认,须恢复原操作。
查看允许值
"CAPABILITY_NOT_ENABLED""INTEGRATION_MISSING""PROVIDER_CREDENTIAL_REJECTED""PRICE_BINDING_REQUIRED""IDEMPOTENCY_CONFLICT""RESULT_UNKNOWN""STATE_CHANGED""IDENTITY_CONTEXT_CHANGED""CUSTOMER_BINDING_CONFLICT""RUN_CONTRACT_MISMATCH""OPERATION_IN_PROGRESS""FUNNEL_VERSION_RETIRED""FUNNEL_PAUSED"
recoveryenum必填原操作的下一步恢复动作;财务结果未确认时按 recover_operation 恢复原操作。
查看允许值
"fix_request""authenticate""check_permissions""check_scope""resolve_conflict""reload_state""retry_same_request""configure_integration""check_availability""upgrade_sdk""recover_operation""contact_support"
retryableboolean必填是否可按给定恢复动作重试失败请求;RESULT_UNKNOWN 时为 false,保留原操作进行恢复。
authorityobject可选原商户操作的执行授权,包含 App/环境、Customer、确认事实及固定商业指令。
展开子字段
scopeobject必填响应实际所属的 App 和环境。Header 只能核对,不能切换 Key 范围。
展开子字段
projectIduuid必填凭据绑定的 App ID。
environmentIduuid必填环境的 ID。
environmentenum必填独立数据范围:sandbox 或 live。
查看允许值
"sandbox""live"
operationIduuid必填业务操作 UUID;订阅执行引用 previewAttach 返回的 operationId,余额退款引用原消费操作。
customerIduuid必填Customer 的 UUID。
confirmedAtdate-time | null必填时间(ISO 8601)。
initialExecutionAllowedboolean必填当前授权是否允许首次派发原商业指令。为 false 时遵循原操作的状态与恢复要求。
instructionobject | object | object必填此授权绑定的原购买、订阅变更或退款指令;保留其 operationId、Customer 与固定商业参数。
展开子字段
provider"merchant" | "merchant" | "merchant"必填支付渠道,取值见允许值。
executor"merchant" | "merchant" | "merchant"必填执行方,取值见允许值。
operationIduuid | uuid | uuid必填业务操作 UUID;订阅执行引用 previewAttach 返回的 operationId,余额退款引用原消费操作。
customerIduuid | uuid | uuid必填Customer 的 UUID。
configurationRevisioninteger | integer | integer必填扫描配置的修订号。
connectionRevisioninteger | integer | integer必填原指令绑定的商户连接修订号;执行时须与该操作获准使用的连接配置一致。
currencystring | string | string必填已发布价格支持的币种代码。
expiresAtdate-time | date-time | date-time必填到期时间(ISO 8601,UTC)。
type"purchase" | "subscription_change" | "refund"必填授权绑定的原商户指令类型:购买、订阅变更或退款。
modeenum | enum可选模式,取值见允许值。
lineItemsarray | array可选明细行。
catalogAmountMinorinteger可选金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
nativeDiscountMinorinteger可选金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
discountobject | null | object | null可选折扣。
trialPeriodDaysinteger | null可选天数。
automaticTaxboolean可选此已授权购买指令固定的自动计税要求,由商户原生支付流程执行。
subscriptionIduuid可选订阅的 ID。
merchantSubscriptionIdstring可选原订阅变更指令绑定的商户原生订阅稳定引用。
minLength: 1 · maxLength: 200
membershipIduuid可选会员的 ID。
subscriptionActionenum可选获准对原订阅执行的动作:更新、取消、安排未来变更或释放已有安排。
查看允许值
"update""cancel""schedule""release"
supersedesOperationIduuid | null可选原指令明确替代的订阅变更操作 UUID;没有替代关系时为 null。
changeobject | object | object | object | object | object可选要变更到的目标。
timingenum可选立即变更或在周期末变更;只用于契约允许的套餐变更动作。
查看允许值
"immediate""renewal"
effectiveAtdate-time可选时间(ISO 8601)。
creditMinorinteger可选金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
debitMinorinteger可选金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
totalMinorinteger可选金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
discountMinorinteger可选金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
taxMinorinteger可选金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
prorationenum可选获准执行的按比例计费策略:不按比例处理、创建按比例项目或立即开票。
查看允许值
"none""create_prorations""always_invoice"
removePriceIdsarray可选此已授权订阅指令要求移除的 Longplay Price UUID 列表。
maxItems: 100
sourceLineItemsarray可选原订阅变更指令冻结的变更前价格明细。历史指令可能省略。
minItems: 1 · maxItems: 100
merchantInvoiceIdstring可选原退款指令绑定的商户原生发票稳定引用。
minLength: 1 · maxLength: 200
amountMinorinteger可选金额,以最小货币单位计(如美分)。
min: 0 · max: 100000000
entitlementActionenum可选退款后保留(retain)或撤销(revoke)权益。
查看允许值
"retain""revoke"
cancelSubscriptionsarray可选要取消的订阅。
maxItems: 100
merchantTermsobject可选原操作已接受的商户条款;执行时以它为准,不使用浏览器传入的内容。
展开子字段
requestobject | object | object必填商户收到的原准备请求,用来证明这些条款属于哪次选择。
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
observedAtdate-time必填时间(ISO 8601)。
expiresAtdate-time必填到期时间(ISO 8601,UTC)。
currencystring必填已发布价格支持的币种代码。
pattern: ^[A-Z]{3}$
automaticTaxboolean必填税额是否由商户按自动税计算;未知税额不会当作 0。
linesarray必填明细行。
maxItems: 100
subscriptionTermsobject | null必填后续周期的订阅承诺,独立于本次扣款;非订阅时为空。
subtotalMinorinteger必填金额,以最小货币单位计(如美分)。
min: -200000000 · max: 200000000
discountMinorinteger必填金额,以最小货币单位计(如美分)。
min: 0 · max: 200000000
nativeDiscountMinorinteger可选金额,以最小货币单位计(如美分)。
min: 0 · max: 200000000
discountobject | null可选折扣。
taxMinorinteger | null必填金额,以最小货币单位计(如美分)。
totalMinorinteger | null必填金额,以最小货币单位计(如美分)。
effectiveAtdate-time | null必填时间(ISO 8601)。
expectedEffectsarray必填商户承诺的原生结果,用于确认展示,不代表平台余额。
maxItems: 100
requiredConsentsarray必填确认前用户必须接受的商户条款。
maxItems: 20
失败时返回错误对象,按 error.code 与 error.recovery 处理。下表是这个接口的凭据、作用域和幂等字段决定的错误;视请求内容还可能返回 NOT_FOUND(引用的资源不存在)、NOT_CONFIGURED(所需的集成未连接)或 PAYLOAD_TOO_LARGE。有些拒绝(如余额不足)不是错误,而是成功响应里的 reason。
可能的错误| code | HTTP | 何时 | recovery |
|---|
INVALID_REQUEST | 400 | 请求不符合本页的参数。缺少或无法解析协议头时分别返回 UNSUPPORTED_PROTOCOL_VERSION 或 INVALID_PROTOCOL_VERSION。 | fix_request |
UNAUTHENTICATED | 401 | 凭据缺失、无效、过期或已撤销。 | authenticate |
FORBIDDEN | 403 | 凭据没有 billing:read 权限。 | check_permissions |
SCOPE_MISMATCH | 403 | X-Indiana-Project 或 X-Indiana-Environment 与凭据所属的 App 和环境不一致。 | check_scope |
RATE_LIMITED | 429 | 请求过多;按 Retry-After 等待后用同一请求重试。 | retry_same_request |
SERVICE_UNAVAILABLE | 503 | 服务暂时不可用;用同一请求重试。 | retry_same_request |
INTERNAL_ERROR | 500 | 结果未知;稍后重试。 | 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
RATE_LIMITED
- HTTP
- 429
- 何时
- 请求过多;按
Retry-After 等待后用同一请求重试。 - recovery
retry_same_request
SERVICE_UNAVAILABLE
- HTTP
- 503
- 何时
- 服务暂时不可用;用同一请求重试。
- recovery
retry_same_request
INTERNAL_ERROR
- HTTP
- 500
- 何时
- 结果未知;稍后重试。
- recovery
recover_operation
相关:错误码与恢复·请求约定·全部接口