先有已发布 Offering Version,再创建并发布 Paywall;绑定其 Product 子集、顺序和默认选择。准备当前 Customer 和购买接入。
Paywall 配置与独立接入
绑定 Offering,独立设计 Product 展示并接入购买。
SDK 示例对应当前 API。核对匹配版本与 HTTP 接入方式
开始前准备
配置与发布 Paywall
A Paywall owns presentation and pins a published Offering Version. It chooses its displayed Product subset, display groups, Product/group order and default independently within that Offering's leaves.
- 从 Paywalls 选择模板或空白设计,绑定已发布的 Offering Version,再配置展示 Product、分组、周期和默认选择。
- 同一 Offering Version 重新选择会保留现有设置;新 Offering 发布不会自动更新 Paywall。显式切换版本保留仍存在的选择及相对顺序,额外 Product 由作者选择。
- 完成内容语言、按钮和 Product 选择后预览并发布。未绑定 Offering 的草稿可保存,但不能发布。发布后可独立接入,也可被 Funnel 固定引用。
独立展示 Paywall
executeMerchantCheckout 是宿主后端接入点:只接受当前已认证 Customer 的 operationId,并读取服务端的原执行指令;不要信任浏览器提交的金额或 Stripe 参数。autumn 模式使用 onCheckoutUrl 跳转,record_only 模式由你的后端创建 Checkout。
独立 Paywall 不创建 Funnel,也不需要 Funnel 运行凭据。会话刷新固定原 Paywall/Offering Version。购买完成与访问授权分开;如配置了访问检查,只有重新检查允许后才继续受限操作。实际消费仍由后端原子执行。
相关:Offering·Stripe checkout·resolvePaywall API·SDK compatibility
import { createPaywallSession, showPaywall } from "@tinkerlandai/indiana-sdk"; const result = await showPaywall(container, { start: () => createPaywallSession({ baseUrl, scope }, { paywallId: configuredPaywallId, customerToken, // Issued by your authenticated backend. locale: "en", commerce: { provider: "stripe", currency: "USD" }, }), onCheckoutUrl: (url) => window.location.assign(url), // Required for record_only mode: execute on your authenticated backend. onPurchase: ({ operation, signal }) => executeMerchantCheckout(operation.operationId, signal), onComplete: () => refreshCustomerHoldings(), onError: reportError,});// On navigation/sign-out: result.host?.destroy();对应 HTTP 接口
可以在已完成的 HTTP 接入上调用这些操作。每页参考列出完整请求、响应和凭据要求;有匹配 SDK 时,也可使用本页 SDK 示例。
| 操作 | HTTP | 权限 |
|---|---|---|
| resolvePaywall | POST /api/v1/paywalls/resolve | entitlements:read |
| previewAttach | POST /api/v1/subscriptions/preview-attach | billing:read |
| attach | POST /api/v1/subscriptions/attach | billing:write |
| readSubscriptionOperation | POST /api/v1/subscriptions/operations/read | billing:read |
操作与权限
resolvePaywall
- HTTP
- POST /api/v1/paywalls/resolve
- 权限
- entitlements:read
previewAttach
- HTTP
- POST /api/v1/subscriptions/preview-attach
- 权限
- billing:read
attach
- HTTP
- POST /api/v1/subscriptions/attach
- 权限
- billing:write
readSubscriptionOperation
- HTTP
- POST /api/v1/subscriptions/operations/read
- 权限
- billing:read
相关:resolvePaywall·previewAttach·attach·readSubscriptionOperation
完成后检查
预期结果
独立打开固定 Paywall Version,报价后确认购买,恢复同一个操作,成功后重新检查权益。无需创建隐藏 Funnel。