Need Help: Updating User Credits Based on Stripe Product ID

Hi everyone,

I am working on a project where users can purchase credit packs (Small, Medium, Large) via Stripe. Each credit pack has a unique Product ID in Stripe.

What I want to achieve is to update the user’s credits in my Bubble app based on the Stripe Product ID when a purchase is made. So, for example, if a user buys a Small credit pack, I want to add 100 credits to their account, and so on for Medium and Large packs.

I have set up a webhook in Stripe to send events to my Bubble app, and I am trying to capture the Product ID from the webhook data to determine which credit pack was purchased, and then update the user’s credits accordingly.

For context, these products are purchasable via a pricing table which is embedded in HTML on a pricing page I have in bubble. More context, yes I did make these products beforehand before adding them to a pricing table. Each product is a one-time purchase product.

Also, I’ve already successfully done something with a subscription pricing table, it’s working fine and giving users credits when x user subscribes to x plan. I cannot get it to work with one-time purchases though.

Thanks in advance!

AFAIK, Stripe pricing tables apply only to subscriptions and there’s not a way to configure them for products that are one-time purchases.

Consider instead simply presenting the list of products to the user using Bubble elements (e.g., a radio button) and providing a checkout button that triggers a workflow including both the action to charge the current user and the action to add the credits to their account in your app.

1 Like

Hi @davidb ,

Thanks so much for this. To confirm, list of products being UI made elements in bubble? Not displaying the stripe products via any embedding right?

Thanks again.

Solution. Thank you.

That’s correct. No need to embed code from Stripe in your app. Just use a Bubble element like Radio Buttons to make a simple UI like the following. You can create an option set or a data type for your product with attributes/fields for values like the Stripe product ID, the amount to charge, and the product name to display to the user.
image