【问题标题】:How to identify Stripe customers who started a payment subscription after trial ends如何识别试用结束后开始付款订阅的 Stripe 客户
【发布时间】:2020-11-22 08:19:35
【问题描述】:

是否有特定的 API 端点或事件在例如客户处于试用期并结束支付第一张订阅发票时触发?

简而言之,我想跟踪在试用期结束后首次订阅的客户。

我正在考虑在我的最后进行此处理,我会收听customer.subscription.trial_will_end webhook 事件并将它们标记在桌子上,一旦发生invoice.payment_succeeded 事件,我可以检查来自试验的同一张桌子。但是,如果有任何推荐的方法可以仅通过 API 执行此操作,那就太好了。

提前致谢。

【问题讨论】:

    标签: stripe-payments


    【解决方案1】:

    我只会听invoice.payment_succeeded 并检查两件事:

    1. billing_reasonsubscription_update(例如,为了从创建订阅中过滤掉发票)https://stripe.com/docs/api/invoices/object#invoice_object-billing_reason
    2. 检索相关订阅对象(invoice.subscription)并检查trial_end == current_period_start https://stripe.com/docs/api/subscriptions/object#subscription_object-current_period_start + https://stripe.com/docs/api/subscriptions/object#subscription_object-trial_end

    当试用结束时,它会开始一个新的计费周期,trial_end 是最近一次试用结束的时间,因此当您查看此类事件时,它应该始终保持不变。

    【讨论】:

      【解决方案2】:

      您可以在 webhook 中收听一个条带事件:customer.subscription.updated。

      您可以使用订阅状态字段。当客户第一次付款时,状态会从“试用”变为“活动”。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-02-04
        • 1970-01-01
        • 2021-01-05
        • 2018-05-26
        • 2021-08-19
        • 1970-01-01
        • 2017-07-01
        • 2018-04-21
        相关资源
        最近更新 更多