Connect the Billing Form

Is there a way to pass a “number of notes to store” value into the billing form from a separate input? I would like the user to be able to select a few options on the Settings page, then have a modal open up with the billing form pre-populated with the number of notes to store.

I’ve got the modal working fine, but I can’t figure out how to pass the calculated number of notes to store (based on the user’s selections) into the billing form itself.

If you are using a Modal, you can add a callback for onHide and call that with the calculated values.

1 Like

Hey, thanks for the great tut!

Any suggestions on how to structure the following:

  • Actually check number of notes that user has “paid” for
  • Prevent user from creating new notes beyond this amount of storage, and prompt them to buy more
  • Display current number of purchased notes on Settings page, allow them to buy incremental notes, and then update the number?

Ty!!

1 Like

Thanks! There are a couple of ways to do these.

First, store the amount of notes purchased in a table.

When you load the list of notes, also return the amount they’ve purchased. So you can either disable the button to add a new note or throw an error. And in the create function check if they are going over the limit.

When loading the settings page, load the amount they’ve purchased currently and the amount of notes they’ve created so far. And maybe add a +/- control to allow them to add or remove from the their limit. Make appropriate checks here to make sure they don’t go below the number of notes they already have. For the billing function, check if they are purchasing less than the number of notes they’ve already created also.

In general, the frontend does checks to make the interface more user friendly. And the backend does the checks to make sure it’s not allowing invalid actions.

1 Like

Am I correct in assuming that in this section/Tutorial the payment is just for practice? It seems “optional” in the sense that none of our backend logic tries to check for the # of notes paid for.

Yeah it’s just trying to show a Stripe integration.