Stripe Firebase Extension: Trial period not applied when creating checkout session from frontend

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:

  1. I create a new document in Firestore to start a checkout session.
  2. In this document, I include subscription_data with trial_period_days set to 2.
  3. The Stripe extension picks up this document and creates a checkout session.
  4. 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?

hey, i had a similar issue. turns out the problem was in the extension config. check if you’ve enabled the trial period option in the firebase console for the stripe extension. it’s easy to miss! if that’s not it, maybe try setting the trial period on the price object in stripe dashboard instead. hope this helps!

I encountered a similar challenge with the Stripe Firebase Extension. One crucial aspect to consider is that the trial period functionality is governed by your Stripe product configuration, not just the checkout session parameters. Ensure that your Stripe product is set up to allow trials. Additionally, verify that the price object associated with your subscription has the trial period correctly defined. If these settings are in place and you’re still facing issues, it might be worth reviewing the extension’s logs in Firebase for any error messages or unexpected behaviors. Lastly, double-check that your Stripe API version is up to date, as older versions might not fully support certain trial period implementations.