1.1.0 • Published 7 years ago

sails-service-stripe v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

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);
  }
};