@subtle lava pressed the ๐งโ๐ป Code button in https://discord.com/channels/841573134531821608/842637025524842496 to ask a question:
Code
const product = await stripe.products.create({
name: `Campaign : Montreal - ${new Date().toLocaleTimeString()}`,
});
const subscription = await stripe.subscriptions.create({
customer: customer.id,
items: [
{
price_data: {
product: product.id,
currency: "cad",
unit_amount: 0,
recurring: {
interval: "month",
interval_count: engagementPeriod,
},
},
},
],
Question
My users create campaigns.
They provide multiple daily budgets per region.
exemple:
{region}-{daily budget}
region1-10$
region2-15$
region3-5$
engagement period: 3 months
total should be (10+15+5) * 3 months = 2700$
Based on this plan, user should be charged 2700$ on campaign creation. Also it will be renewable hence why subscriptions.
Problem. Stripe subscription are limited to 20 items per subscription as mentioned multiple times in this discord.
What have you already attempted?
Ive tried go go around by trying the following:
option 2.a: create subscription with a single item of 0 $ THEN add invoice items that represent each daily-budgets/region provided by the user.
problem: subscription is active right away even if not paid as single subscription item is set to 0$.
option 2.b) do the oposite. use total in single sub item and add multiple invoice items as 0$.
option 3: just create my own invoice and link it to stripe invoice and use metadata
What are you working on?
web app where use can create custom campaign (subscriptions)