Forum Academy Marketplace Showcase Pricing Features

Accessing Stripe Subscription Price ID from Webhook

Setting up a subscription using Bubble’s Stripe plugin. The basics are no problem and working fine: connecting to Stripe, adding a payment method, and creating a subscription for the user. My problem is updating the bubble db once the subscription is created.

In my bubble db I have the following data types:

  • User: Contains several fields including a Stripe Plan field of type Stripe Plans (below)
  • Stripe Plans: Contains several fields including Stripe Price ID (price_1JaOblahblahblah in Stripe)
  • Stripe Invoices: Captures data relevant to the invoice like Invoice ID, etc.
  • Stripe Payment Methods: Catpures data for the stored payment method, like Payment Method ID, Last4, etc.

When a user creates a subscription, I want to update the bubble User with the plan they have subscribed to using the Stripe Price ID (the one that is price_1JaOblahblahblah in Stripe).

I have tried creating several different stripe webhooks using several different events (in separate webhooks).

  • customer.subscription.created
  • invoice.created
  • invoice.payment.succeeded
  • charge.succeeded

Each of these webhooks contains the data value I need (the Stripe Price ID), but in the Bubble API workflow, it will not let me reference that value (it isn’t in the list).

Once I am able to get that Stripe Price ID, I can create a workflow to update the User’s plan, but I can’t seem to get it. It appears as a list item in the webhook data. Are list item values not accessible in the Bubble Stripe Plugin?

Is the problem the Bubble Stripe plugin? Is it that I am dynamically detecting values and I should be manually entering the parameter for the list it I need (if so, what is the format of that)? Should I instead use the stripe.js plugin? Should I setup an API call to Stripe using the regular Bubble API connector to get this value?

Any help would be really appreciated! Things were going great until I hit this and none of the tutorials out there seem to address this issue.

I am not familiar with the Stripe Plugin but if you were to use APIs to integrate you would be able to accomplish what you want with the use of the metadata parameters so you can send values that Stripe will ‘hold’ and not use, but you can access via API calls during the series of actions you run when accepting a webhook event notification via Stripe regarding the subscription.

I don’t know if it is accessible via the Plugin, but the way the webhook data works is that you have the ‘Request Data’ and all associated details, including lists, and so your data should be accessible by referencing the ‘Request Data’ in your dynamic expression that you are trying to use for the price_id

I don’t know about other tutorials but I know my course covers it in detail, although the course is focused on eliminating the need to rely on plugins and to take full control over the integration through APIs.

Learn More

Boston85719 is an expert Bubbler with a decade experience as an educator. Real name Matthew, he has been actively building SaaS apps, marketplace apps, scheduling apps and more for clients, himself and for sale as templates.

As an official Bubble Bootcamp Instructor, he leads Bubble Bootcamps on a regular basis.

Always willing to offer advice via the Bubble Forum, Matthew also offers Private Personal and Group Training Sessions.

Through his site, NoCodeTrainer, Matthew provides a range of tutorials with editor access to help you jumpstart your Bubble development.

Always accessible you can send Matthew a private message via the forum or send an email directly with your requests.

Be sure to checkout the Stripe Integration Course when you are ready to integrate Stripe payments to start monetizing your application via product sales or subscriptions.

Stripe Integration Course

NoCodeTrainer.com

Well, perhaps someone else can provide an insight about the topic. The

I’m not familiar with what you’re asking about, I don’t know, I don’t know, but here, try my course

wasn’t exactly what I was hoping for. I know someone has encountered this issue. I would think there is a stupid simple solution I’m just missing. Thanks to all for any assistance!

Sorry you must have skipped over the insight I provided as to how to do it.

If you already have your webhook setup and understand that portion of things, then the ability to utilize the ‘Request Data’ is probably well within your reach without needing a course on how to setup your Stripe integration.

And apologizes if my reply was not what you were looking for when you posted.

Share a screen shot of the Webhook Initialization Data so I could see what Stripe returns to your Webhook as the Reqest Data and I could tell you in more clear and direct terms what data value you are supposed to be utilizing in your dynamic expressions.

Well, first, sorry for the snippy response, and I probably will check out the course, because you are 100% right, I hate the idea of relying on plugins… that’s why I’m moving away from the wordpress universe in the first place.

As to your suggestion, that is the confusing part. The price id does come through in the webhook, but is not available in the request data list of parameters.

This is what I’m trying to access from the webhook:
image

And this is what I see in bubble (the required value is not in the list)
image

When I look at the setup of the API Workflow Request, it is listed:

Any ideas?

Screen Shot 2021-09-17 at 6.04.26 PM

No worries I can understand how frustrating it is to get hung up on something and not finding the solution. That is part of why I created the course, as it is either a copy and past into your app a full integration or learn from the videos and DIY it.

It can be difficult sometimes to find the right path for getting to the list data…Usually the Request Data will show the name to follow and that is where I turn to find my way.

I double take-back my original response. That worked! For anyone facing this issue, my exact error was not noticing that bubble displays two “object” choices in the Request Data list for this particular stripe webhook (customer.subscription.created), and not knowing to drill down to find price id, not looking for it in the initial list of request data values. One “object” is at the top of the list, and the second is about half-way down, which then exposes the list of item lines to be able to select the plan id or other stripe price information. Beautiful!

A million thanks @boston85719

1 Like

This is the corrected version: