Getting Stripe Customer ID from Bubble Stripe Plugin

I’m using the Bubble provided Stripe plugin and it’s working for one off purchases and subscriptions.

Now it’s time to create the webhook so I know when a subscription charge fails.

Per this example in the Bubble manual on how to do that, I should have/know the Stripe Customer ID, which I don’t, as the Bubble Stripe plugin action of Subscribe the user to a plan doesn’t seem to return it.
https://manual.bubble.io/using-the-bubble-api/examples

Also, this Bubble forum thread confirms the Bubble Stripe plugin action of Subscribe the user to a plan doesn’t seem to return it.

My preference is to use the Bubble provided Stripe plugin so that if anything doesn’t work in the future I have one vendor/entity to deal with for troubleshooting problems, but in order to implement this webhook, I need this piece of data.

Has anyone solved this?

Hey @kevin4

If you check under current user, it’s built in.

Bubble takes care of that for you. Check it out:

Cool huh! Was that what you were looking for?

Hope that helps! :blush:

@j805 www.NoCodeMinute.com

For All Your No-Code Education Needs:

  • One-on-One Tutoring
  • eLearning Hub
  • Video Tutorials
  • No-Code Classes
1 Like

This isn’t working.

I’ve added the field Stripe CustID to the User record:

And here is the workflow where I run the Subscribe the user action and the Make changes to User action.

And here is what is what I see when I add the Stripe CustID value within the Make change to User action.
MakeChanges

So it appears in the example you provided that various choices available in the Create a new thing action you show are fields within a DB record.

Am I missing something?

What @J805 told you is that the Stripe Customer ID field, for the user data type, is a built-in field provided by Bubble, and this field contains the Customer ID for Stripe, once the “subscribe user to a plan” action has been called successfully.

So remove your CustID field which will never be set, and use the built-in field provided by Bubble. And in this case, in your “Make change to User” action, you don’ t need to set the Stripe Customer ID as this field and its value are already available for the user

1 Like

I get it now. Thank you. By creating a field User:Stripe Cust ID, I was negating the built in variable. I resolved this issue by moving that field from the User record to the LogPaymentSubscription record (a record where I simply capture the data returned by the action Subscribe user to a plan) and then capturing that detail in step 8 of the workflow above, rather than trying to capture that detail in step 9. The built in variable is not intuitive, at least it wasn’t to me, but I get it now. Thank you.

1 Like

Sorry that wasn’t clear in my response. Thanks @Christophe_HK for chiming in to clarify. :pray:

@kevin4 glad you got it figured out now. I actually don’t save anything to my database after they subscribe since Bubble takes care of all that.

To confirm they have a subscription I also use the Current Users subscription status is “active”.

Bubble takes care of the webhooks to update the subscription status as well.

Glad you figured it out! :blush:

2 Likes

In addition, I would say that if you need to display to your users additional info regarding their subscriptions, you can also make use of some great plugins available in the Bubble Marketplace, I would recommand Stripe.js or Stripe Marketplace. You can use some calls they provide based on the built-in information provided by Bubble regarding the subscriptions (Stripe customer ID and Stripe Subscription ID). Based on this 2 piece of information, you can manage to get all necessary info for your users.

And it’s not so difficult. So Bubble as-is to manage users’ subscriptions, and plugins to get additionnal info

I forget the Stripe Self Service Portal plugin : an AWESOME plugin that really avoid to manage subscription management and credit card details in your app ! All this stuff is externalized to Stripe itself. Really cool ! (and more secure !)

1 Like

Yeah, I use the Stripe Self Service Portal Plugin too. Very helpful.

Can you elaborate more on what you mean by “Bubble takes care of the webhooks to update the subscription status as well”?

Where can I learn more about this?

Sure. If you check the current user’ subscription status it updates automatically even if the users card payment gets declined.

So you don’t have to create a field to say if the users subscription is active. It’s built into the current user. :blush:

Does that make sense?

That does make sense and will save me needing to write the webhook. Thank you.

1 Like

No problem. Glad it helped! :blush:

I need a little more help.

I just started creating the Workflow for when the Current User’s Stripe Customer subscription’s Status is… whatever a failed payment will set the status to, and I’ve discovered I don’t know what the various values of Stripe Customer subscription’s Status might be.

Here is where I’m at, and I’m not certain how to proceed, and what documents I’ve found doesn’t help.

Where can I learn more about how this works?

This may be helpful?

https://stripe.com/docs/api/subscriptions/list#list_subscriptions-status

1 Like

Very much so. Thank you!

2 Likes

No problem! :blush:

Is that true? I tested this in development by canceling the user’s subscription but the subscription status field in Bubble still remains as “active”.

Is there any documentation on this? I can’t find it on Bubble docs.

@jayy
I did verify that it works. Can you share a screenshot of how you are accessing the ‘status is active’? Might help diagnose it. :blush:

is there a way to update or edit the built-in Stripe customer id? I deleted a user on Stripe (test mode) and now Bubble cant find the customer anymore and i can’t find a way to relink bubble user and stripe user