Reputation: 557
I'm creating a site where a user will be allowed to upload a file once they make a payment: example: Basic Plan for $9.99 or Enterprise Plan $20.99
when a user chooses a plan they will then be prompted to upload a file.
I'm looking for some direction on what the best way to go about doing this is, any suggestions as far as plugins, or the best process to do something like this.
I will be using stripe's API , what do you think is the best workflow, I already know how to use stripes API with laravel , my concern is how to make the user pay , then allow the user to upload once and only if payment is received.
What should by database table look like? What should the process look like for the user.
I was thinking 1.User creates an account 2.User confirms email then is redirected to choose plan page, user chooses plan 3.User makes payment, then is redirected to an upload page. 4.User uploads file.
any ideas, or maybe a better solution?
This is not your typical e-commerce site with a whole bunch of products where you choose something then pay.
This site will require a user to make payment in order to allow them to upload one file to the platform.
any direction with as much detail would be greatly appreciated.
of course I'm building this system on laravel.
Upvotes: 1
Views: 257
Reputation: 1219
Honestly, your plan is solid.
For your file uploads table I would suggest making use of Morph relationships. This will allow you to to have one table for many different file uploads, as you will have 2 columns a itemable_type
and itemable_id
the type is your model and the id your record id. to get these columns add this to your migration $table->morphs('itemable');
Laravel will make them for you.
using a trait for your file uploads would be a good idea as well as you can call it up and pass it parameters with a single line whereever you need it, or call it with some complex logic.
Upvotes: 2