1.0.2 • Published 8 years ago

stripe-errback v1.0.2

Weekly downloads
1,341
License
MIT
Repository
github
Last release
8 years ago

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