Stripe Webhooks:Invoice.paid 与 Checkout.Session.Completed [英] Stripe Webhooks: Invoice.paid vs Checkout.Session.Completed

查看:65
本文介绍了Stripe Webhooks:Invoice.paid 与 Checkout.Session.Completed的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Stripes 的 webhooks 并希望在客户成功支付账单"时收到通知.我遇到了两个 webhook,我认为它们都可以胜任:

I use Stripes' webhooks and want to get notified, if the customer successfully "paid the bill". I came across two webhooks, which in my opinion both could do the job:

  1. Webhookinvoice.paid"- 根据 Stripe 文档:在发票付款尝试成功或发票被标记为带外支付时发生.
  2. Webhookcheckout.session.completed"- 根据 Stripe 文档:在结帐会话成功完成时发生.

我的问题是:

  1. 我不明白invoice.paid"的第二部分webhook:发票被标记为带外支付";->带外"是什么意思?意思?这算是成功付款吗?
  2. 关于checkout.session.complete"->如果付款失败,也会发生这种情况 - 正确吗?
  3. 我应该考虑使用哪些网络钩子(或是否有其他网络钩子)来查看客户已成功支付账单"的状态?
  4. 此外,我真的不知道是否应将争议视为成功付款:一方面,我收到了一个 invoice.paid webhook,另一方面,我收到了一个 charge.dispute.created webhook.哎呀……

感谢您的帮助!谢谢.

推荐答案

我不明白invoice.paid"的第二部分webhook:发票被标记为带外支付";->带外"是什么意思?意思?这算是付款成功吗?

I don't understand the second part of the "invoice.paid" webhook: "invoice is marked as paid out-of-band" -> What does "out-of-band" mean? Is this to be considered a successful payment?

这特指标记发票支付带外(即,客户在 Stripe 之外向您付款,而您希望将 Stripe 发票标记为已付但不收取付款).这不会涉及实际付款,但会将发票转换为 status=paid,因此会触发此事件.

This is specifically referring to marking an invoice paid out of band (ie, the customer paid you outside of Stripe and you want to mark the Stripe invoice paid without collecting a payment). This will not involve an actual payment, but does transition the invoice to status=paid so this event fires.

关于checkout.session.complete"->如果付款失败,也会发生这种情况 - 正确吗?

Regarding "checkout.session.complete" -> This can also occur, if payment fails - correct?

此事件仅表示结帐会话已完成.取决于 mode 使用对于 Checkout,这可能涉及也可能不涉及付款.如果需要立即付款,则会话仅在付款成功后才能完成.例如,免费试用的 mode=setupmode=subscription 不涉及立即付款.但是,试用订阅将创建一张 0 美元的发票并触发 invoice.paid.

This event signals only that the Checkout session is complete. Depending on the mode use for Checkout, this may or may not involve a payment. If an immediate payment is expected, the session will only complete if that payment is successful. For example mode=setup or mode=subscription with a free trial will not involve an immediate payment. A subscription with trial, though, will create a $0 invoice and fire invoice.paid.

我应该考虑看哪些 webhooks(或者是否有其他 webhooks)状态客户支付成功"?

Which webhooks shall I consider (or are there other webhooks) to see the status "customer paid the bill successfully"?

这取决于您所说的付费"是什么意思.和账单".如果您的意思是专门针对发票(无论是否与订阅相关),那么 invoice.paid 是一个不错的选择.然后,您可以过滤大于 0 美元的金额等以进一步限制被支付"的金额.意味着.

This depends on what you mean by "paid" and "bill". If you mean specifically for invoices (whether related to subscriptions or not), then invoice.paid is a good choice. You can then filter for amounts greater than $0 etc to further constrain was "paid" means.

此外,我真的不知道是否应该将争议视为付款成功与否:一方面,我收到了一个发票.已付款的网络钩子,另一方面,我得到了一个 charge.dispute.created webhook.

What is more, I don't really know if disputes should be considered as successful payments or not: On one hand, I get a invoice.paid webhook, on the other hand, I get a charge.dispute.created webhook.

争议不是付款,应该单独讨论.您只能在付款后提出争议.建议首先阅读 有关争议的文档.

Disputes are not payments, and should be an entirely separate discussion. You can only have a dispute after a payment. Suggest starting by reading the docs on disputes.

总结:你真正想要做什么?这些事件是相关的,有时会重叠,但并非总是如此.这在很大程度上取决于你在做什么.

To summarize: What are you really trying to do? These events are related and sometimes overlap, but not always. It highly depends on what you're doing.

这篇关于Stripe Webhooks:Invoice.paid 与 Checkout.Session.Completed的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆