stripe-errback

1.0.2 • Public • Published

stripe-errback Build Status

Wrap Stripe.js async methods to use node-style callbacks

Install

$ npm install --save stripe-errback

Usage

var stripeErrback = require('stripe-errback')
 
var stripe = stripeErrback(window.Stripe)
 
stripe.card.createToken(data, params, function (err, data) {
  if (err) { /* console.error(err) */ }
  else { /* token = data.id... */ }
})

API

stripeErrback(Stripe) -> object

Wraps window.Stripe to call a Node-style callback (function (err, data)) with results instead of using Stripe's function (status, response) functions.

Stripe

Required
Type: function

The Stripe.js browser library (window.Stripe).

The returned object wraps the following methods in addition to exposing utility methods:

This configuration is exposed as stripeErrback.methods with {async, sync} containing arrays of dot property paths.

License

MIT © Ben Drucker

Package Sidebar

Install

npm i stripe-errback

Weekly Downloads

369

Version

1.0.2

License

MIT

Last publish

Collaborators

  • bendrucker