【问题标题】:Stripe discount on upcoming payment of recurring subscription即将支付定期订阅的条纹折扣
【发布时间】:2022-01-31 22:06:51
【问题描述】:

我已经实施了按年计费的条带式定期订阅。我向我的客户提出了一项优惠,如果他们将我们的网站推荐给他们的 5 位朋友并注册,他们的订阅将获得 50% 的折扣。

我将如何在下次付款时为该特定客户实施该折扣?

【问题讨论】:

    标签: stripe-payments stripe-customer-portal


    【解决方案1】:

    最简单的选择是将Coupon 应用于客户的订阅。然后在订阅的下一个计费周期中,将自动应用优惠券。可以做到的是两步(这里做的是node.js):

    // Create the new Coupon, once
    // Doc: https://stripe.com/docs/api/coupons/create
    const coupon = await stripe.coupons.create({
      percent_off: 50,
      duration: 'once', // other possible value are 'forever' or 'repeating'
    });
    
    // Then every time a customer match your criteria, update their subscription
    // Doc: https://stripe.com/docs/api/subscriptions/update
    const subscription = await stripe.subscriptions.update(
      'sub_xxx',
      { coupon: coupon.id }
    );
    

    另一种选择是将优惠券应用于客户,而不是直接应用于订阅。在这种情况下,优惠券将适用于该客户的所有经常性费用。

    // Doc: https://stripe.com/docs/api/customers/update
    const customer = await stripe.customers.update(
      'cus_xxx',
      { coupon: coupon.id }
    );
    

    【讨论】:

      猜你喜欢
      • 2019-03-08
      • 2020-11-07
      • 2021-12-16
      • 2023-04-10
      • 2016-11-13
      • 1970-01-01
      • 2017-04-13
      • 1970-01-01
      • 2021-09-21
      相关资源
      最近更新 更多