Stripe subscription

Hi everyone ! Anyone has already set up a subscription with stripe and bubble ? So, this is what I did :
1 Created a subscription product in my stripe account
2 Entered my test api key into bubble (so I can see my product into bubble)
3 Created a button on the home page and creating a workflow for subscribe the current user. Until there, no problem

My question is: How can I check if the user subscription is still available ? I think I have to subscribe the user with the button below, and create a variable “payment statut” and set it to “payment statut = valid”, so for 3à days, the user will have access to the platform, but if he doesn’t pay anymore, I want to change the variable payment statut, so in the dashbord of the user, I want to have a cancel button and change the variable only at the end of the subscription and the other way it’s if I cannot charge the credit card of the user (for the next 30 days). So, is my approach correct or I’m missing something? Thank you guys

1 Like

There is an easier way.

Do conditionals and check:

Current Users > Stripe Subscription > Status > is > “active”

I believe that should do what you want. There are other ways to do the same thing. This is just one suggestion.

Want to learn more?

www.nocodeminute.com

Presenting

Hope that helps! :blush:

Hi @J805, thank for your answer ! Yes I think your solution works ! And I would like to automatically change this status if the payment doesnt work or if the user cancel the subscription. I heard about webhooks but never used it.

It actually does that automatically. You can test it out by canceling the subscription in stripe and then returning to your app. On page load you can have a workflow, when it is not “active” then send them to your index page. Or something like that.

1 Like

Okay. I will try it! Thank you

1 Like

No problem! :blush:

Hi J805,
Is there an equivalent for checking for ‘active’ on iTunes iOS subscriptions or GooglePlay?

Hey @c.knight55 That is a good question. How are you subscribing the user to iTunes or Google Play?

I’m using BDK’s native wrapper. But honestly, I’ve asked this same question everywhere I can think of, including Apple Dev Support. They had no straight answer. With Stripe you can see that status is an available option, but I don’t see it in either iOS or Android connections.

Have you asked @gaurav yet?

He’s working on some other issues I’m having (getting a purchase_fail message from google when online it shows payment accepted). I have asked him about how to confirm the ongoing status on iOS and Android, but got no reply from him about it. Not sure if it’s because there isn’t an answer.

Yeah, I am looking at his documentation, there should be a way to confirm that:

Documentation: https://www.notion.so/BDK-Native-Plugin-Documentation-f39872f62d84489594aea28e46185947#f7d97bfca3a0419ab4b4f40c036539ac

Receiving purchase related information

  1. Place the ‘BN - In app (Android)’ element on the page
  • You can place any number of these elements. Try a 1x1 size so that it doesn’t mess with your design.
  • The element needs to be visible to work as per bubble’s requirements. If the element is within groups, make sure the groups are not hidden either.
  1. When the native process is complete, the element fields such as Purchase information, Error information and Purchase receipts will be populated
  2. The relevant element actions ‘In-app purchase successful’, ‘In-app purchase failed’ and ‘In-app receipts received’ also get triggered when the native process is complete
  3. Set up your bubble app to keep track of users’ purchases using
    • We strongly recommend that you also store the output information (especially the receipts) in your database for each purchase

When I asked Apple Dev Support, they referred me to monthly reports, but I didn’t understand enough of it to sort it.

I think @gaurav will be your best resource here. His wrapper should allow you to have access to that information somehow.

I think this is the key. Then you can access the data.

Right. That tells you the initial payment was successful, but there doesn’t seem to be a field on their end that you can interrogate to know on an ongoing basis that the member didn’t cancel or that their payment didn’t fail.

With Stripe, I don’t even worry about the date the monthly payment end. They’re active until they’re not, so I base my ‘Premium’ status field on their status field.

Yeah, that makes sense. Maybe this would be a better resource?

Resource: https://medium.com/@jessesahli3/ios-renewable-subscriptions-overview-stripe-vs-in-app-purchases-4fdb02bec0da

IAP: After purchasing a subscription you will have to ask the system for a receipt. This receipt is encrypted binary data. You can send this data to your server which should store it and associate it with the user (it will essentially act as a token). This receipt can be sent to Apple’s servers at any time and Apple will return the most up-to-date decrypted JSON about the state of the user’s subscription. You can update your users subscription related state based on this returned JSON. Apple also recently started offering webhooks (called status update notifications) so you could be notified about certain events (not as robust as Stripe’s webhooks).

That’s really interesting. And is simple in theory. Just send the receipt back.

I wonder how to implement it within BDK’s and Bubble’s environments?

Oh! so you just trigger the Verify Receipt workflow again and it verifies again.

1 Like

That makes sense to me. :+1:

Today’s a good day. Thx J

1 Like