gpt4 book ai didi

php - Stripe 与认购初始安装费

转载 作者:行者123 更新时间:2023-12-01 09:47:20 25 4
gpt4 key购买 nike

我正在使用 Stripe 构建一个相对简单的基于订阅的应用程序。

我目前唯一真正的问题是订阅需要支付初始设置费,我真的很难接受。

例子:
新用户注册订阅-A;订阅-A 的每月间隔价格为 10 美元。注册后,新用户将一次性支付 1 美元和 10 美元的订阅费用,然后在接下来的几个月中仅收取 10 美元的费用。

目前我的代码是:

// Stripe New customer
$customer = \Stripe\Customer::create(array(
"email" => $customer_email,
"source" => $token,
),
array("stripe_account" => $connected_account)
);

// Stripe Subscription
$sub = \Stripe\Subscription::create(array(
"customer" => $customer['id'],
"items" => array(
array(
"plan" => $plan_id,
),
),
),
array("stripe_account" => $connected_account)
);

任何的想法?谢谢

最佳答案

creating the customer后,但creating the subscriptioncreate an invoice item的安装费之前。

当您创建认购,第一发票将立即创建,而这种发票将包括对客户的所有悬而未决的发票项目。

有关发票项目的更多信息,请参阅https://stripe.com/docs/subscriptions/invoices#adding-invoice-items

关于php - Stripe 与认购初始安装费,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45940150/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com