Implementing purchasing logic in Webflow, purchasing "minutes"

I am building a website which offers a transcription service where users are able to buy “minutes” of transcription.

The idea is that the user purchase an amount of minutes, the website charges them, somewhere I register the total numbers of minutes that each user has (maybe in a field in the users) and when the users consumes them, I can reduce these minutes from the user’s tab.

I am not sure how to implement this logic. So far I am thinking on getting out the amount of minutes each user has purchased when they do it (not sure how to get that info) and then using some database I can account for that, maybe even adding it to the CMS or to some user field using the API.

Any help would be appreciated.

You can add the number to an user field if you use webflow memberships Update User (webflow.com) and lower down that number when they use it

I use webflow membership. I imagine to do what you say I need to use the webflow API, or is it there other way?

You should use Webflow API

Hey Manuel,

You’ve got a number of problems here to solve;

  • Storing minutes remaining per user
  • Tracking top-up purchases, and associating that with a user
  • Logging the usage history, and account legder of +/- minutes transactions
  • Possibly displaying that usage history to a user

If you’re OK just displaying the that number Pietro’s suggestion to store it in a custom user field is a good one, however currently I think it can only bound to an editable input field on the User Account screen, which means your users (1) can ONLY see the number there, and (2) they can edit it, by default.

To overcome that, you can hide that editable field, and then write some script to take the contents of that field and display the number as non-editable text.

You can edit / update the values in those custom fields in the designer, so, so far, you don’t need the API for anything to accomplish this.

If you want to display a ledger, and a summary total, the approach the easiest approach I’ve found on internal sites is to create a Google Sheet for each user to track their info, and then store that readonly sheet URL in the user custom field.

Then, you can pull the contents of that sheet ( or a summary tab, and display it as a table, along with that total amount, and no one can edit the sheet data or minutes remaining except you.

That gets you about 90% of the way there, with the obvious gap being that you have to watch for new orders, and manually add those top-up purchases into the right spreadsheet, for the right person.

These are the Webflow features you want in order for this to be better integrated, so keep an eye out for them in coming months. Hopefully we’ll see them emerging;

  • The ability for ECommerce to capture the currently-logged-in UserID on a purchase.
  • The ability to easily retrieve User custom field data with script
  • The ability to bind User custom field data to element in the same way you can do CMS binding, so that you can e.g. have a readonly “Minutes remaining” appear at the top of every page when a user is logged in.
1 Like

Thanks a lot for the answer and the suggestions, Michael! It’s a good remark the fact that the user’s field can be edited by the users.

What you mention is a good manual approach, but I will try to automate the whole thing using the Webflow API, if there is no tool to track this automatically.

related to this logic, I wrote the following question to solve the first problem: users upload the file and need to register the user id…

Gosh, that’ll be hard as purchasing logic in Webflow.

Better to use Memberstack for this, you can do more complex things with it. Here are some screencasts that walk through a few examples:

Hope that helps!

Thanks Cris! Memberstack is an option, but I think I will try first with FireBase, as it has a free way of doing it.