I'm trying to figure out how to accept credit card using stripe in a single charge that is entered within the forms input field.
Example: user1 logged in and creates a post, entered $20 in a field and clicks submit. The post gets created and $20 gets charged to his card. User2 does the same but puts $45 and enters his credit card and submits the form.
I've got the following done; - devise setup - roles - stripe gem installed and account setup
I haven't found an example that would explain a single charge to stripe, everything is subscription based.
I'm new to this, so I'm trying to mimic the subscription examples but without success.
Here is how I am executing a single charge using Stripe and the ActiveMerchant gem.
You need to use Stripe.js in order to get a token, then pass that token string instead of credit card object.
For testing purposes, you can go to https://stripe.com/docs/stripe-js and obtain a token from the form like in this image:![enter image description here](https://i.stack.imgur.com/R4Ela.png)
How to use it in rails console: