npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@adamvr/feathers-stripe

v0.3.3

Published

A Feathers service for Stripe

Downloads

23

Readme

feathers-stripe

Greenkeeper badge

Build Status Code Climate Test Coverage Dependency Status Download Status Slack Status

A Feathers service for Stripe

This is still a work in progress and is not ready for production. Pull requests welcome! :smile:

Installation

npm install feathers-stripe --save

Documentation

Please refer to the Stripe API Docs and the stripe-node docs for options that can be passed. Feathers service methods map to the following Stripe methods:

  • Feathers find -> Stripe list
  • Feathers get -> Stripe retrieve
  • Feathers create -> Stripe create
  • Feathers patch -> Stripe update (in most cases). Some special cases in include paying an invoice or an order when you pass {pay: true} as part of hook.data.
  • Feathers update -> Stripe update
  • Feathers remove -> Stripe del (except in the case of transfers where we create a reversal)

If a method is not supported by Stripe for a given resource it is not support here as well.

Available Services

The following services are supported and map to the appropriate Stripe resource:

  • account
  • bankAccount
  • balance
  • card
  • charge
  • coupon
  • customer
  • customerSubscription
  • dispute
  • event
  • invoiceItem
  • invoice
  • order
  • plan
  • product
  • recipient
  • refund
  • sku
  • subscription
  • token
  • transaction
  • transfer
  • transferReversal

They are all referenced by stripe.<resource> and can be used like so:

var stripe = require('feathers-stripe');
app.use('/stripe/charges', stripe.charge({ secretKey: 'your secret stripe key' }));

Webhooks

Coming Soon!

Connect

Coming soon!

Currently Unsupported Resources

The following are not fully supported. If you wish to add support pull requests are very welcome.

  • applePayDomains
  • charge meta data
  • customer metadata
  • recipient metadata
  • transfer metadata
  • bank account verification
  • threeDSecure
  • bitcoinReceivers

Pagination is also not currently supported. You can limit results for finds but you need to handle pagination yourself.

Security

This is pretty important! Since this connects to your Stripe account you want to make sure that you don't expose these endpoints via your app unless the user has the appropriate permissions. You can prevent any external access by doing this:

var hooks = require('feathers-hooks');

app.service('/stripe/charges').before({
  all: [hooks.disable('external')]
});

To learn what that actually did you can read about some of the built-in Feathers hooks and about securing your Feathers app.

Complete Example

Here's an example of a Feathers server that uses feathers-authentication for local auth. It includes a users service that uses feathers-mongoose. Note that it does NOT implement any authorization.

var feathers = require('feathers');
var rest = require('feathers-rest');
var socketio = require('feathers-socketio');
var hooks = require('feathers-hooks');
var bodyParser = require('body-parser');
var errorHandler = require('feathers-errors/handler');
var stripe = require('feather-stripe');

// Initialize the application
var app = feathers()
  .configure(rest())
  .configure(socketio())
  .configure(hooks())
  // Needed for parsing bodies (login)
  .use(bodyParser.json())
  .use(bodyParser.urlencoded({ extended: true }))
  // A simple Message service that we can used for testing
  .use('/stripe/charges', stripe.charge({ secretKey: 'your secret stripe key' }))
  .use('/', feathers.static(__dirname + '/public'))
  .use(errorHandler({ html: false }));


function validateCharge() {
  return function(hook) {
    console.log('Validating charge code goes here');
  };
}


var chargeService = app.service('stripe/charges');

chargeService.before({
  create: [validateCharge()]
});

var Charge = {
  amount: 400,
  currency: "cad",
  source: "tok_87rau6axWXeqLq", // obtained with Stripe.js
  description: "Charge for [email protected]"
};

chargeService.create(Charge).then(result => {
  console.log('Charge created', result);
}).catch(error => {
  console.log('Error creating charge', error);
});

app.listen(3030);

console.log('Feathers authentication app started on 127.0.0.1:3030');

Changelog

0.3.0

  • Updating cards service to use the appropriate methods
  • Updating stripe-node dependency
  • Adding the majority of the services
  • Adding support for $limit for find queries
  • Updating documentation and adding some more tests

0.2.0

  • Adding some more resources

0.1.0

  • Initial release

License

Copyright (c) 2015

Licensed under the MIT license.