Firebase, Stripe extension integration.
I have one product on Stripe, and two recurring prices (subscription options)
The problem is appearing when I try to add yearly and monthly subscription options, in line-items
, before that I used one subscription option it was sent via the "price" param.
Now When I want to send two subscription prices for the same product on the stripe side, I cannot generate the stripe checkout session... cus "payload" is not good.
This is the code that generated the checkout session.
Note: If I remove line-items and include just one price, and send it with "price: priceId" it works
const checkoutSessionRef = collection(
firestore,
`users/${uid}/checkout_sessions`,
);
const docData = {
success_url: url,
cancel_url: url,
line_items: [
{
price: montlyPriceId,
quantity: 1,
},
{
price: yearlyPriceId,
quantity: 1,
},
],
};
}
await addDoc(checkoutSessionRef, docData);
Documentation explanation on including multiple subscription options in checkout sessions:
You can’t use 2 recurring prices with different billing periods - e.g. annual and monthly - in a single Subscription. You can only combine prices that have the same billing periods - e.g. both monthly, or both annual. If you want the same Customer to have both monthly and annual subscriptions, you will need to create 2 separate Subscriptions, or, in your case, two Checkout Sessions.