本页对应当前源码,必须使用与 Indiana 部署匹配的 SDK。npm 已发布 0.0.1 beta;当前源码的方法与 DTO 以本页和 contracts 为准,不能将工作区版本号当作发布回执。
先在宿主完成真实登录,由后端签发当前客户会话。浏览器不传任意 customerId。
当前导出与方法
setupPayment({ requestId, currency, makeDefault })权限
billing:write创建独立银行卡设置;不产生订阅、权益或用量扣款授权。
返回 { setup }
readPaymentSetup({ setupId })权限
billing:read核对原设置的实际渠道结果,重试不会重复收费。
返回 { setup }
readBillingInvoice({ invoiceId, after, limit })权限
billing:read读取完整已验证明细,按 nextCursor 分页;不会收费。
返回 { detail }
readCreditStatement({ from, to, entityId?, snapshotAt, after, limit })权限
credits:read范围上限 366 天;首屏 snapshotAt/after 为 null,后续沿用原快照和完整游标。
返回 { statement }
previewUpdate({ requestId, membershipId, timing, change })权限
billing:read按明确会员合同固定套餐或席位报价,保留同订阅的其他套餐。
返回 { quote }
update({ operationId })权限
billing:write确认固定报价并恢复原收费尝试;实际已验证付款决定交付。
返回 { operation }
readSubscriptionUpdate({ operationId })权限
billing:read读取变更状态;待付款、下期计划和已生效均保留原操作身份。
返回 { operation }
previewAttach({ entityId?, requestId, plans, provider, currency, offerId? })权限
billing:read使用已识别客户会话保存 15 分钟报价;不传 customerId,不触发付款或付费授予。
返回 { quote }
attach({ operationId })权限
billing:write客户明确接受报价后执行;checkoutUrl 由宿主展示,响应丢失时重试原 operationId。
返回 { operation }
restoreNativePurchase({ requestId, provider, purchaseIntentId, productId, signedTransaction?, purchaseToken? })权限
billing:write使用已识别客户身份恢复经过商店验证的购买。
返回 { restore }
readSubscriptionOperation({ operationId })权限
billing:read恢复原订单状态和验证后的交付,不重新发起收款。
返回 { operation }
setBillingCoupons({ authorizationId, requestId, grantIds })权限
billing:write为当前客户的已启用授权设置有序优惠;只能使用本人持有的券。原 requestId 的重试返回原回执,待结算期间不能更换优惠。
返回 { coupons }
confirmBillingAdjustment({ invoiceId, accepted: true })权限
billing:write仅在客户审阅并同意当前固定追加账单后调用。不能由页面加载或自动重试推断同意。
返回 { invoice }
readBillingControls(input?)权限
billing:read读取已验证客户的授权、限额、窗口和自动充值状态。
返回 { controls }
prepareBillingAuthorization(input)权限
billing:write保留原 requestId,准备固定版本与限额条款;准备不等于客户同意。
返回 { prepared }
confirmBillingAuthorization({ authorizationId, accepted: true })权限
billing:write只在客户明确接受条款后调用;服务端再次验证当前授权和 provider 设置。
返回 { authorization }
revokeBillingAuthorization({ authorizationId, requestId })权限
billing:write撤销当前客户授权;原请求重试不换 UUID。
返回 { authorization }
listBillingInvoices({ after, limit }?)权限
billing:read读取当前客户用量账单;按 nextCursor 分页,limit 最多 100。
返回 { invoices }
readBillingControls(input) / listBillingInvoices({ after, limit })权限
billing:read读取当前已认证客户的自动付款授权、用量窗口、限额与分页账单。读取、刷新和分页不触发扣款。
返回 { controls } / { invoices }
prepareBillingAuthorization(input) / confirmBillingAuthorization({ authorizationId, accepted: true }) / revokeBillingAuthorization({ authorizationId, requestId })权限
billing:write以持久 requestId 准备固定条款与 Sandbox 支付方式;只有支付准备完成且客户明确接受后才能启用付款。撤销会阻止后续自动付款,并保留已有财务事实。
返回 { prepared } / { authorization }
identify(customerToken) / reset()Token 只保存在内存;重置或换号会中止旧身份请求。展示中的 Funnel 也必须销毁并丢弃。
返回 void
subscribeIdentity(listener)观察 identify/reset,宿主据此清理界面;返回取消订阅函数。
返回 Unsubscribe function
checkEntitlement({ requirement, commerce?, paywallId? })权限
entitlements:read后续源码入口,已发布 npm 0.0.1 不含此方法。匹配 SDK/服务后,使用当前客户 Token 返回 allowed、拒绝原因和商品推荐;浏览器不能指定客户身份。
返回 { check }
readHoldings()权限
entitlements:read读取当前已认证客户的会员与余额,不接收 customerId。
返回 { holdings }
readLedger(query)权限
credits:read按当前客户分页读取完整历史;游标包含记录类型与精确时间。
返回 { ledger }
quoteBalance(command)权限
credits:read传 operation: quote、entitlementId、十进制 quantity 和 properties。只估价,不扣量。
返回 { quote }
listOffers()权限
offers:resolve读取当前客户的有效优惠;实际领取和购买在发布的 Funnel 节点中执行。
返回 Offer[]
redeemCoupon(code, requestId)权限
offers:resolve兑换当前范围中的优惠码,原 requestId 用于响应丢失后的重试。
返回 { offer, reason }
redeemReward(input) / createReferralCode(input)权限
offers:resolve按已配置的奖励与推荐计划执行;创建推荐码另需 offers:resolve。
返回 Reward / referral code
setBillingCoupons(input)权限
billing:write在客户确认的授权上替换后续收款的有序优惠券列表;空列表移除,重试保留 requestId。进行中的收款拒绝修改。
返回 BillingCoupons
claimRewardProduct(input)权限
offers:resolve审阅奖励兑换与后续续费条款后传入 accepted: true;重试保留 redemptionId 和 requestId。新订阅返回 type: checkout 与结账状态;已有相同付费订阅返回 type: subscription 与追加优惠任务状态,保留原优惠和订阅身份。
返回 RewardProductCheckout
formatCouponTerms / formatCouponDiscount / formatCouponMoney使用服务端返回的 coupon 条款格式化展示,文案不决定资格或实际收费。
返回 string