Ad

How To Create Token For Stripe With Nodejs

- 1 answer

I can use load-stripe to generate a token on the front-end reactjs.

Now I need to do same thing on the backend nodejs. The user will pass accountNumbercvv and other information to the backend then how can I create a token using it?

Any help would be much appreciated Thank you!!!

Ad

Answer

NPM package stripe-node

var stripe = require("stripe")("sk_test_4eC39HqLyjWDarjtT1zdp7dc");

stripe.tokens.create({
  card: {
    "number": '4242424242424242',
    "exp_month": 12,
    "exp_year": 2019,
    "cvc": '123'
  }
}, function(err, token) {
  // asynchronously called
});

For more info: Stripe Documentation

Ad
source: stackoverflow.com
Ad