Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 1.16 KB

README.md

File metadata and controls

42 lines (32 loc) · 1.16 KB

sails-service-stripe

TravisCI Coverage Status

Service for Sails framework for Stripe payment features.

Stripe Node documentation (docs)

Getting Started

Install this module.

npm install sails-service-stripe

Then require it in your service and create payment instance.

// api/services/StripeService.js
import StripeService from 'sails-service-stripe';

export default StripeService('stripe', {
  apiKey: '<STRIPE_API_KEY>'
});

// api/controllers/PaymentController.js
export default {
  checkout: function(req, res) {
    StripeService
      .checkout({
        amount: req.param('amount'),
        cardNumber: req.param('cardNumber'),
        expMonth: req.param('expMonth'),
        expYear: req.param('expYear'),
        cvv: req.param('cvv')
      })
      .then(res.ok)
      .catch(res.negotiate);
  }
};