【问题标题】:What Stripe webhook is used to capture subscription renewal when invoicing outside of Stripe?在 Stripe 之外开具发票时,使用什么 Stripe webhook 来捕获订阅续订?
【发布时间】:2021-01-06 13:39:36
【问题描述】:

我直接在 Stripe 控制面板中创建了一个客户和订阅,因为客户在 Stripe 之外通过支票 + 发票付款。

与普通信用卡订阅类似,Stripe 每月都会发送 webhook,特别是发票 webhook(invoice.updatedinvoice.finalizedinvoice.sent)以及 customer.subscription.updated

我的应用寻找以下 webhook 来连接计费事件/实际升级客户的帐户:

customer.created
customer.subscription.created
customer.subscription.updated
customer.subscription.deleted
charge.succeeded

charge.succeeded 一直是我的首选网络挂钩,用于提醒我的应用更新客户的帐户(例如提供每月福利)。我的问题是,在开具发票时,实际上将发票标记为“已付款”比发票生成晚 7 到 14 天以及帐户应该更新的时间,所以我不能使用 invoice.paid 等同于 charge.succeeded .

我正试图弄清楚在订阅续订时发送什么 webhook 以通过支票客户付款。 customer.subscription.updated 确实会在订阅续订时发生,但这可能会在计划更改时触发。与invoice.sent 相同——这也可能在计划更改时发生。

是否有专门针对“此客户的订阅刚刚续订,无论他们是否已付款”的 webhook?

【问题讨论】:

    标签: stripe-payments webhooks


    【解决方案1】:

    没有专门针对续订的事件。您应该做的是监听customer.subscription.updated 事件,然后查看更改的数据以评估它是否是续订。我们的想法是查看Event 上的data[previous_attributes] (doc) 内部,并检查current_period_startcurrent_period_end 属性是否已更改,这表明续订(或计费周期更改)。

    【讨论】:

    • 谢谢。我认为current_period_end 可能是这里的关键——也许我会检查一下该日期是否在未来 26-36 天之间。
    猜你喜欢
    • 2014-05-01
    • 1970-01-01
    • 2023-03-11
    • 1970-01-01
    • 2021-05-22
    • 2016-10-18
    • 2018-01-02
    • 2013-10-24
    • 1970-01-01
    相关资源
    最近更新 更多