Payments per minute

Hey, Im working on a project where i need to set up charging money depending on time spent on certain screen, but that payments should be before getting on that screen. Is it possible to make repeat charges, example, that stripe is taking $1 every minute up until user leaves that screen

Hey there @ZexKar99

This is not possible currently. You cannot process payments without the user clicking a payment button within the stripe components.

Here is what you CAN do.

Drag in 2 Input components onto the same screen. Name the first one “Time spent” and the second one “Time spent +1”.

Set the default value on the first input “Time Spent” to 0. On the “Time Spent +1” set a default value of “Custom Formula”. Inside the custom formula, add “other components > time spent input” and then also put “+1”.

Add PragmaFlow’s “Timer Action” component (PragmaFlow Adalo Toolkit) and drop that into the screen.

Set the 2nd value of milliseconds to 60000 milliseconds. Set the action to “Change Input Value > Time Spent” to value “Other Components > Time Spent +1 Input”. This will update the “Time Spent” input to add 1 minute every minute that passes.

I’m assuming you have a button that has the user leave the page when they are done.

Add a collection called “payments” with 3 parameters:

  1. Amount (number parameter)
  2. Minute Rate (number parameter)
  3. User relationship (one to many, users can have many payments, payments belong to one user)
  4. Paid (true/false parameter)

On your button, set an action to create a new “Payment” record. Set the amount to “Other components > Time Spent Input” and the user to logged-in user. Set the “minute rate” to whatever you want to charge per minute. Leave paid as “False”.

Link to a new screen and call it payment.

Add your stripe component and set the payment amount to “Custom Formula”. Inside the custom formula insert “Current Payment > Amount” multiplied by “Current Payment > Minute Rate”.

Then, the user can pay for the amount calculated by the minute from the previous page.

Upon successful payment, update the current payment to “Paid > True”.

This is the closest way to do it for now.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.