Stripe subscription works only once per customer 🥲

Hi everyone,

I’m working on a feature allowing the users to suscribe to a plan on my app.

I have 3 different plans, with 3 different payment methods.

  1. Mensual subscription via Stripe subscription
  2. Trimestrial subscription via Stripe (only one payment, the user won’t be charge at the end of the period)
  3. Trimestrial subscription via Alma, which allows user to pay in 3 or 4 times.

I am having trouble with the first one.

At the beggining, I was using the action Suscribe the user to a plan and the webhook on the event customer.subscription.created

It happened that the webhook is triggered before the field Stripe customer ID was initialized in my database, and the user couldn’t access to his content.

Then, I tried to use a Database trigger event.
The condition is User before change’s Stripe Customer Subscription’s Status is not User now’s Stripe Customer Subscription’s Status
I launch my Backend Workflow to create the subscription and give access to the content if the User now’s Stripe Customer Subscription’s Status is trialing or active

It works, but only if it’s the first time the user subscribe to a plan.
After that, the fields
User now’s Stripe Customer Subscription’s Status & User before change’s Stripe Customer Subscription’s Status are always empty :exploding_head:
The trigger is triggered, but I can’t access the status, neither in the logs nor in my handmade log (Create a new thing).

It’s really annoying because I’ve a solution for the first subscription (the trigger) and another one for the other one (the webhook) but it’s annoying and not really clean to handle things differently, as I have so many different scenarios…

Have you ever encounter this kind of issues?

Thank you so much guys 🥲

I would avoid the Stripe plugin and Stripe customer ID provided by the Stripe plugin.

Instead, have a ‘stripeCustomerID’ field on the user (or their Billing Account data type depending on how you have it set up). When they click subscribe or whatever, if their stripeCustomerID is empty, create one using the Stripe API (it’s really simple: Create a customer | Stripe API Reference) and save it. Then, create a Stripe checkout page with the customer ID and the plan you want to subscribe to. Open that checkout URL and ensure you have a webhook that listens to subscription created. That webhook should search for users where stripeCustomerID is Request Data’s customer and update the plan accordingly.

1 Like

Thanks, that’s what I thought of ! Let’s do it then :slight_smile: