Ultimate Guide to Stripe Integration with Node Js

Posted By Arun Kataria | 26-Jul-2018

Stripe is a 3rd party payment arrangement, that makes it conceivable to acknowledge Mastercard and plastic installments in your webshop. It's safe and brisk - you can nearly process installments promptly. Stripe is an innovative organization. Its product enables people and organizations to get installments over the Internet. Stripe gives the specialized, misrepresentation aversion, and managing an accounting framework required to work on-line installment frameworks. 

Stripe is a quick, simple, and secure approach to acknowledge charge card installments on the web. In the wake of interfacing your Stripe account, you can turn on your Store and begin offering. Installments go straightforwardly into your Stripe Account and are then moved into the Bank Account you set up with Stripe on a moving premise. 

You needn't bother with any archives, All they require is a legitimate Mastercard or platinum card with the Visa or Mastercard logo. The Stripe Node library gives helpful access to the Stripe API from applications written in server-side JavaScript. It would be ideal if you remember that this bundle is for use with server-side Node that utilizations Stripe mystery keys. To keep up PCI consistence, tokenization of Mastercard data ought to dependably be finished with Stripe.js on the customer side. This bundle ought not be utilized for that reason.

To integrate it with node-js we can use stripe-node library.

1) Create a Stripe account.
2) Install package: 

npm install stripe --save

3) package should be arranged with your record's mystery enter which is accessible in your Stripe Dashboard. Require it with the key's esteem:

var stripe = require('stripe')('sk_test_...');

var customer = await stripe.customers.create(
  { email: 'customer@example.com' }
);

4) By using Promises:

// Create a new customer and then a new charge for that customer:
stripe.customers.create({
  email: 'foo-customer@example.com'
}).then(function(customer){
  return stripe.customers.createSource(customer.id, {
    source: 'tok_visa'
  });
}).then(function(source) {
  return stripe.charges.create({
    amount: 1600,
    currency: 'usd',
    customer: source.customer
  });
}).then(function(charge) {
  // New charge created on a new customer
}).catch(function(err) {
  // Deal with an error
});

5) To retrieve a balance of a connected account.

stripe.balance.retrieve({
  stripe_account: 'acct_foo'
}).then(function(balance) {
  // The balance object for the connected account
}).catch(function(err) {
  // Error
});

 

Request for Proposal

Recaptcha is required.

Sending message..