Talivia 使用文档
Talivia 使用文档
首页数据看板
简介安装团队获取更新
Stripe
Stripe 结账会话Stripe 付款链接Stripe 付款意图Stripe 订阅与账单Stripe 的其他归因方式测试与排查 Stripe 归因
Yolfi
Dodo Payments
LemonSqueezy
Polar
手动付款接口测试付款集成
集成
人工智能代理与模型上下文协议llms.txtllms-full.txt
收入Stripe

Stripe 付款意图

归因自定义结账、Elements 或移动付款流程直接使用的付款意图。

查看 Markdown 原文

后端直接调用 stripe.paymentIntents.create 时使用本指南。对于大多数新网页集成,Stripe 推荐通过结账会话使用付款元素,因为它能代为管理更多结账行为。

将会话带入付款创建流程

把 Talivia 会话编号发送到创建付款意图的后端。切勿在浏览器代码中用 Stripe 密钥创建付款意图。

浏览器移交
const sessionId = window.talivia.getSessionId();

const response = await fetch('/api/create-payment-intent', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ sessionId }),
});

const { clientSecret } = await response.json();

在服务器创建付款意图,并把会话直接附加到元数据。

创建付款意图
const paymentIntent = await stripe.paymentIntents.create({
  amount: 2500,
  currency: 'usd',
  automatic_payment_methods: { enabled: true },
  customer: stripeCustomerId,
  receipt_email: customerEmail,
  metadata: { talivia_session_id: sessionId },
});

return Response.json({ clientSecret: paymentIntent.client_secret });

Talivia 监听 payment_intent.succeeded、记录 amount_received,并按付款意图编号对直接付款去重。与 Stripe 账单关联的付款意图留给账单事件处理,以免丢失续费和订阅上下文。订单引用以 cs_ 开头的结账会话支持的付款意图则留给结账会话事件处理,避免同一笔付款被记录两次。

移动端与网页转应用结账

请通过经过身份验证的结账移交或深层链接状态传递原始网页会话编号,并与后端订单一起保存。移动应用不需要 Talivia 浏览器追踪器;后端创建付款意图时只需附加之前捕获的不透明编号。

身份备用信号

提供稳定的 Stripe 客户和收据电子邮箱,有助于匹配后续付款。登录或注册后,请在已追踪网站上关联身份:

识别 Stripe 客户
window.talivia.identify('user_123', {
  email: 'buyer@example.com',
  stripeCustomerId: 'cus_123',
});

身份是备用信号和续费桥梁;元数据仍是把首次付款归因到准确结账会话的最可靠信号。

Stripe 付款链接

直接或通过已追踪的返回网址归因无需代码的 Stripe 付款链接。

Stripe 订阅与账单

在订阅注册、续费、失败和生命周期变化中保留归因。