Payment and Database

Hello I already have in my Bubble.io app the ability for users to log in and is this app connected to stripe (webhook - so that during stripe checkout session and successful payment to data (app data) is sent paymentintentID and status). How do I make it so that the user after logging in (or signing up) and then successful payment can use my service only once, i.e. click on the “submit” button? To use the second time he will have to make the payment again. It is also important that if also other users made a payment did not affect the payment status of this one logged user. It is supposed to be like this: if there is a payment by a logged-in user, then there is an opportunity to use the “submit” button, and if already pressed, this opportunity disappears until that user makes another payment. Whether there are also other payments by other users in the database should not affect the status of this one. I don’t know how to link payment to the specific user. I would be grateful for your help!

Hi @olek.lukianczuk :wave:

You can create a DATATYPE called “Payments” with 3 columns:

  • User (Type = User) → To save the buyer;
  • Stripe ID (Type = text) → So you can have a better control of the payment linked to this entry;
  • Used (Type = Yes/No) → Will store the info if the user already use this credit or no;

Every time you receive a confirmation from Stripe, create a new Payment like:

  • User = Rafael
  • Strupe ID = 12312312313
  • Used = No

When your user try to click the button you can check how many entries in your database he have with the field “Used = No”.

Do a Search for Paymments Where:

  • User = Current User
  • Used = No

If Do a Search for Payments:first Item is not empty then it meens that your user still have credits to click the button. Because Bubble found at least one payment not used.

After he clicks the button you can make a change in Do a Search for Payments:first Item , changint the Used from No to Yes

Make sense?

1 Like

Thank you for your help!