Forum Academy Marketplace Showcase Pricing Features

Show user their Stripe Plan price?

Hi all,

I have set up my Stripe (subscription) payments and am able to show some payment data in my Bubble app, such as ‘Last payment made’, but how can I show the Price which the user just paid?

1

This is how I am currently requesting the info;

On a broader note, you may be wondering how I am able to show ‘Last payment made’. Well, in this fantastic step-by-step guide the author says add the following Fields.

  • Plan [Plan]
  • Last Payment Made [date]
  • Subscription End [date]
  • Stripe Subscription ID [text]
  • Stripe Subscription Status [text]
  • Stripe Cancel at End [text] , default = no

These all work and call the info from Stripe, but how did he know these fields were going to work? For example, if I add another field, such as;

  • Free Trial End [date]

I get no information back from Stripe. So, what info can I get back from Stripe and if you know the answer to that, how did you know?

I read the following on the Stripe API page

A subscription that is currently in a trial period is trialing and moves to active when the trial period is over.

But there is no link for trialing in the dropdown below;

To hammer home the point, why do the fields (with a check mark) work, and yet the one I created does not work?

Screenshot 2022-02-17 180641

Thanks for help guys!

1 Like

Hi Darren,

I’m glad you found the article helpful.
The situation is that since you are using the Stripe plugin, the fields which are returned are defined by the plugin author. There are many different pieces of data that are available about a customer and their subscription, but only a subset have been added by the plugin author.
The fields that they exposed are the ones that you see in the ‘current users’s stripe…’ part of the ui.
To get other fields there are two options:

  • Get Stripe to send the data via Webhooks, and received/process them via an Api Workflow

  • Query the Stripe API directly to get the data

I went the webhooks route and it worked well.
However, regarding the actual priceid, I stored that specifically in a bubble datatype I created to hold information about Plans. So as part of the subscription workflow, I just referenced that price, rather than getting that data back from Stripe. The price in bubble and the price in stripe should be the same, which is something you manage when setting up the product in the stripe ui.

one other thing, I’m pondering creating a course where I explain everything about integrating Stripe and Bubble. Not sure yet, but if enough interest I’ll pursue it.
ref https://twitter.com/MartyLindsay_NZ/status/1493782744605683718?s=20&t=ndcbnDX4Nt4RCmJ2L3dStA

Thank you Marty!

Yes, your article was very easy to follow and learn from, you have a great way of explaining things with enough detail whilst keeping it focused!

Thank you for explaining that the Stripe fields which are returned are defined by the plugin author, this makes sense and now I can stop spending hours reading through Stripe documentation trying to get it to work!

You are correct about the priceid, I may as well just store that as a bubble datatype. I did find another way to get the price (in case anyone needs it), using Current User's Get Stripe Invoices:last item's Total

When my User’s checkout I offer a free trial period so I think I should display something like:

Your free trial expires on xx/xx/2022 at which point you will will be billed £8

However, when a user checks out they are billed immediately (I see no free trial added to their plan) so I need to work out why that is? Then I guess I should get the info via Webhooks as you suggested.

Have you experienced any issues with Stripe’s free trial setup? I will contact Stripe’s help desk and update this page with any fixes.

There’s another awkward little problem which seems like it should have a simple solution.

I want to display the following Stripe data on my website:

Your next payment will be taken on Mar 17, 2022

If the subscription is cancelled then it should show:

Your plan will be cancelled on 17 March 2022

I am able to show the next payment using Current User's Stripe Customer subscription's Current period ending date.

To show the cancellation date I could use Current User's Stripe Subscription End but then we have a slightly contradictory result telling the user they will be charged AND cancelled.

Your next payment will be taken on Mar 17, 2022
Your plan will be cancelled on 17 March 2022

The solution would be to hide the ‘Your next payment’ info if the user has unsubscribed.

I tried to use something like When Current User's Stripe Subscription Status is ‘inactive’ Then don’t show, but this doesn’t work because Stripe doesn’t assign an ‘inactive’ status until the subscription has expired.

Do you know if Stripe assigns anything to a user who is active but subscription cancelled?

1 Like

When a customer has cancelled the auto renewal then their status does change to ‘canceled’

Note the spelling has one letter l

You can configure a webhook in stripe to send this and receive it using a backend api in bubble.

You can set the end of trial date as part of the subscribe a user to a plan

That’s great thank you. The reason I thought their status remained as ‘active’ was because my newly canceled user shows as ‘active’ in the Stripe dashboard. I will try the webhook suggestion, thanks!

canceled

I did try and set up a webhook for this. I created a ‘Stripe Trial End’ field in the User datatype but the backend workflow won’t give any options after the ‘=’ sign?

The issue is that Stripe collects the user’s payment immediately, I assumed they would not take money until the free trial (set within Stripe) had expired.

In order to keep issues separate I have created a separate page Applying a free trial to a Stripe plan. I have copied your comment over as a possible fix for the issue.

Did you initialize the endpoint?