【问题标题】:Charge a setup-fee immediately and start recurring payment on the 1st of each month立即收取安装费,并在每月 1 日开始定期付款
【发布时间】:2020-04-24 21:30:37
【问题描述】:

我正在使用 Stripe 向客户收取订阅费用。 订阅客户(立即)支付 10 美元的安装费,然后在每月 1 日支付 10 美元。 我尝试了不同的 Stripe 配置,得到了不同的结果,但没有一个是我想要的。 目前,通过设置prorate=false,我总共收到了 20 美元的账单,但是是在 2 月 1 日。

谢谢!

【问题讨论】:

    标签: stripe-payments


    【解决方案1】:

    您可以使用发票项目收取设置费:https://stripe.com/docs/billing/invoices/subscription#first-invoice-extra,然后将试用期设置为每月 1 日,以便将计划付款延迟到那时。这是 Node 中的一个示例:

    // create customer and payment method
    let customer = await stripe.customers.create({
        email: "test@example.com",
    });
    let pm = await stripe.paymentMethods.attach("pm_card_visa", {customer: customer.id});
    
    // add a floating item for the setup fee, will be charged in the first invoice
    let item = await stripe.invoiceItems.create({
        customer: customer.id,
        amount : 1000,
        currency : "usd",
        description: "Setup fee"
    })
    
    let subscription = await stripe.subscriptions.create({
        customer: customer.id,
        default_payment_method : pm.id,
        //set the subscription plan on trial until start of next month
        trial_end : moment().add(1, 'months').startOf('day').unix(),
        items: [
            {
                plan: "plan_GVHFF1ESMXZ7CN", // $10 plan
            },
        ],
        expand : ["latest_invoice"]
    }); 
    

    您可以看到它现在向客户收取 10 美元的发票,然后在 2 月份即将发出的是 10 美元的定价计划。

    【讨论】:

      猜你喜欢
      • 2016-08-03
      • 2013-09-20
      • 2016-09-03
      • 2018-11-21
      • 2019-04-09
      • 2017-05-12
      • 2015-06-24
      • 2012-02-10
      • 2014-11-15
      相关资源
      最近更新 更多