I’m having trouble with the Stripe Firebase Extension. I’m trying to set up a trial period for subscriptions, but it’s not working as expected.
Here’s what I’m doing:
- I create a new document in Firestore to start a checkout session.
- In this document, I include
subscription_data
withtrial_period_days
set to 2. - The Stripe extension picks up this document and creates a checkout session.
- The customer gets sent to the Stripe checkout page.
The problem is that the trial period is completely ignored. The subscription starts right away and the customer is charged immediately.
I’ve even tried hardcoding the trial_period_days
to 2, but it still doesn’t work.
Here’s a simplified version of my code:
const checkoutDoc = await addDoc(collection(db, 'checkouts'), {
price: 'price_123',
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
subscription_data: {
trial_period_days: 2,
},
});
Does anyone know why the trial period isn’t being applied? Am I missing something in the setup?