Progress Bar to show user credits left

I have an app wherein a user uses credits to use the app. The user presses a button, an API call is made (OpenAI API in this case), and the user’s credits are reduced. Is there a way I can use the default Progress bar by Bubble to show how many credits are left for a user? If yes, can someone guide me on how to do so?

Yes… you can use the progress bar to represent any percentage you like.

Thanks for your reply. All the tutorials I’ve seen use a custom state for the progress bar in use cases like a multi-step form. I have a workflow set up such that when a user presses a button and the API is called, credits are subtracted from the user’s account. What I would like to show a user in a progress bar is that how much percent credits are left after the credits are removed from the user’s account. I also have a data field for User Credits.
Could you please point me to a tutorial you may know about or tell me how to go about doing this here?

User clicks API call button → Makes API call → Animates in Progress Bar element → Saves result of that api call’s remaining credits to current user’s remaining credits number field → Pause action for 2 seconds → Animate out Progress bar element

Progress bar data source is [user's remaining credits field]/[user's max credits for the month field] * 100 :floor

Thank you so much!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.