条纹订阅现在和每个月的第一天支付
stripe subscription pay now and the first of each month
我正在尝试通过 Stripe 创建订阅 API。我已经创建了产品和项目,现在需要为用户提交订阅,但我现在需要向客户收取全价 - 无论是每月的哪一天 - 然后在每个月初收费 -即使明天开始。
看来我现在可以创建一个一次性项目来收费,然后为每月结算周期设置订阅,但我想知道我是否可以通过订阅在一次通话中完成这一切 =>创建功能。我不想按比例分配第一个月,我看不出有什么方法可以告诉它现在收取全价并在接下来的每个月的第一天设置重复。有办法吗?
处理您描述的流程的一种方法是组合 backdate_start_date
and billing_cycle_anchor
属性。这个想法是,在创建订阅时,您可以将 billing_cycle_anchor
设置为下个月的第一天,并将 backdate_start_date
设置为当月的第一天。例如,假设您想为一位用户注册从今天(2 月 5 日)开始的 10.00 美元订阅,但您希望立即向他们收取全部 10.00 美元的费用(即使他们错过了前 5 天)。然后,您想在 3 月 1 日和此后每个月的第一天再次向他们收取 10.00 美元。创建订阅时,您将设置:
billing_cycle_anchor
:1614556800(3 月 1 日)
backdate_start_date
:1612137600(2 月 1 日)
今天会产生 10.00 美元的发票,3 月 1 日再次产生 10.00 美元的发票,随后每个月的第一天产生 10.00 美元的发票。
这是在 Node 中的样子:
(async () => {
const product = await stripe.products.create({ name: "t-shirt" });
const customer = await stripe.customers.create({
name: "Jenny Rosen",
email: "jenny.rosen@gmail.com",
payment_method: "pm_card_visa",
invoice_settings: {
default_payment_method: "pm_card_visa",
},
});
const subscription = await stripe.subscriptions.create({
customer: customer.id,
items: [
{
quantity: 1,
price_data: {
unit_amount: 1000,
currency: "usd",
recurring: {
interval: "month",
},
product: product.id,
},
},
],
backdate_start_date: 1612137600,
billing_cycle_anchor: 1614556800,
expand: ["latest_invoice"],
});
console.log(subscription);
})();
我正在尝试通过 Stripe 创建订阅 API。我已经创建了产品和项目,现在需要为用户提交订阅,但我现在需要向客户收取全价 - 无论是每月的哪一天 - 然后在每个月初收费 -即使明天开始。
看来我现在可以创建一个一次性项目来收费,然后为每月结算周期设置订阅,但我想知道我是否可以通过订阅在一次通话中完成这一切 =>创建功能。我不想按比例分配第一个月,我看不出有什么方法可以告诉它现在收取全价并在接下来的每个月的第一天设置重复。有办法吗?
处理您描述的流程的一种方法是组合 backdate_start_date
and billing_cycle_anchor
属性。这个想法是,在创建订阅时,您可以将 billing_cycle_anchor
设置为下个月的第一天,并将 backdate_start_date
设置为当月的第一天。例如,假设您想为一位用户注册从今天(2 月 5 日)开始的 10.00 美元订阅,但您希望立即向他们收取全部 10.00 美元的费用(即使他们错过了前 5 天)。然后,您想在 3 月 1 日和此后每个月的第一天再次向他们收取 10.00 美元。创建订阅时,您将设置:
billing_cycle_anchor
:1614556800(3 月 1 日)backdate_start_date
:1612137600(2 月 1 日)
今天会产生 10.00 美元的发票,3 月 1 日再次产生 10.00 美元的发票,随后每个月的第一天产生 10.00 美元的发票。
这是在 Node 中的样子:
(async () => {
const product = await stripe.products.create({ name: "t-shirt" });
const customer = await stripe.customers.create({
name: "Jenny Rosen",
email: "jenny.rosen@gmail.com",
payment_method: "pm_card_visa",
invoice_settings: {
default_payment_method: "pm_card_visa",
},
});
const subscription = await stripe.subscriptions.create({
customer: customer.id,
items: [
{
quantity: 1,
price_data: {
unit_amount: 1000,
currency: "usd",
recurring: {
interval: "month",
},
product: product.id,
},
},
],
backdate_start_date: 1612137600,
billing_cycle_anchor: 1614556800,
expand: ["latest_invoice"],
});
console.log(subscription);
})();