StripeCheckoutCustomForm
Node Module to help you you creating custom Stripe CheckOut Form Without Writing Any JS Code.
How to install
Using NPM
npm install stripe-checkout-custom-form
If you got any error using Laravel Mix delete node_modules
folder and run npm install
and everything should work just perfect.
using Yarn (Recommended)
yarn add stripe-checkout-custom-form
How does it work
Include Stripe JS First
Application JS File
//The div id which the card element will be injected tovar cardElementID = 'card-element'//The form id which will contain the stripe checkout formvar formElementID = 'payment-form'//The name attribute of the card holder full name fieldvar fullNameInputName = 'card_holder_name'//Your stripe public keyvar stripeKey = 'pk_test_...' cardElementID formElementID fullNameInputName stripeKey
HTML File
Then in your form post action in the backend you will get a stripeToken
variable which you can use to create a customer or charge the card.
Notice: All JS must be loaded before the form loading.
That's it !
Please don't hesitate to create a pull request Or post an issue if found, Thanks.