【问题标题】:Stripe: recurring payments without PLAN apiStripe:没有 PLAN api 的定期付款
【发布时间】:2019-06-20 20:16:42
【问题描述】:

我打算使用 Stripe 来处理信用卡。

但是,我已经有一个程序可以根据客户对我们产品的订阅来计算他们的月薪,而且由于计算非常复杂,我不想使用 Stripe 的系统重新制作整个东西。

所以,

  1. 是否可以在不使用 Stripe 的 PLAN api 的情况下定期向客户收费?

  2. 如果是这样,我该如何实现?

【问题讨论】:

    标签: stripe-payments


    【解决方案1】:

    是的,您可以在 Stripe 中向客户收费,而无需使用他们的订阅逻辑。

    为此,您需要在前端收集卡信息,然后将其保存到 Stripe 中的客户;您可以将此客户的 ID 存储在您的数据库中。

    在向用户收费时,您可以让您的应用程序从您在 Stripe 中创建的客户的保存卡中收费。

    # Create a Customer:
    customer = Stripe::Customer.create({
        source: 'tok_mastercard',
        email: 'paying.user@example.com',
    })
    
    # Charge the Customer instead of the card:
    charge = Stripe::Charge.create({
        amount: 1000,
        currency: 'usd',
        customer: customer.id,
    })
    
    # YOUR CODE: Save the customer ID and other info in a database for later.
    
    # When it's time to charge the customer again, retrieve the customer ID.
    charge = Stripe::Charge.create({
        amount: 1500, # $15.00 this time
        currency: 'usd',
        customer: customer_id, # Previously stored, then retrieved
    })
    

    更多信息请见https://stripe.com/docs/saving-cards

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-12-16
      • 2017-04-16
      • 2014-04-28
      • 2015-08-23
      • 2011-09-16
      • 2015-06-13
      • 2012-04-05
      相关资源
      最近更新 更多