Is it possible in stripe payment,
First we will validate credit card using stripe, then we generate token and create customers. we will save token instead of credit card information in database and later we will make payments from customers on basis of token or customer instead of credit card information.
In javscript file how do we handle stripeResponseHandler
and function stripeResponseHandler(status, response)
?
because we have already generate token using
Stripe.createToken({ number: cardNumber, cvc: cardCVC, exp_month: $('#expiration-month').val(), exp_year: $('#expiration-year').val() }, stripeResponseHandler);
in payment step how we call stripeResponseHandler?
Please understand the requirement
1- Save the Token by verifying credit card information, in this case no payment is involve. amount/price will zero(0).
2- Save this Token in your database, but this token is use once not many time.If use this Token later it will not work.
3- Create customer will create a customer at stripe.com and we can also save in our database but the reason is that we will not recharge from our site , we have to login at stripe.com and recharge from that site. when we recharge from that site , we are unable to save records of that in our database.Also at time of creating customer, we have to create a recharge for latter . we also need credit card again if we use this client. so this is the main issue.
4- we can make own function stripeResponseHandler , because through stripeResponseHandler verification of cards can be done at stripe.js at stripe server.
Saving credit card details for later Be certain to store the customer ID on your side for later use. You can subsequently charge that customer by passing the customer ID—instead of a card representation—in the charge request. Charges using saved card details can be customized in the same ways as one-time charges.
You can use previously saved card details to charge customers later. For one-time use, create a PaymentIntent and attach the saved payment method. You can't reuse an attached payment method unless you collect payment details again by either saving a card from a PaymentIntent or reading a reusable card.
Tokens are created using Stripe. js or one of the mobile client libraries. The process is effectively the same as tokenizing payment details or external accounts. Your user's information is sent directly to Stripe and exchanged for a token that can be used in create and update API calls.
Instead of saving the token itself, I recommend creating a customer and saving your customer ID. You can then charge your customer at any time in the future. See our documentation on saving card details for later.
In javscript file how we handle stripeResponseHandler and function stripeResponseHandler(status, response).
You will need to create a function and pass it as your stripeResponseHandler
when calling createToken
. All this function needs to do is insert your token into your form and submit it. There's a simple example of that here: https://gist.github.com/boucher/1750375
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With