Skip to content

Instantly share code, notes, and snippets.

@thejsj
Created August 25, 2016 20:44
Show Gist options
  • Save thejsj/8b2fc4e1c6b435deb6c0bf49216927bd to your computer and use it in GitHub Desktop.
Save thejsj/8b2fc4e1c6b435deb6c0bf49216927bd to your computer and use it in GitHub Desktop.
Stripe Node Shortcuts
require('loadenv')()
const stripe = require('stripe')(process.env.STRIPE_API_KEY)
var token1, token2
stripe.tokens.create({ card: { "number": '4242424242424242', "exp_month": 12, "exp_year": 2017, "cvc": '123' }}).then(x => token1 = x)
stripe.tokens.create({ card: { "number": '4242424242424242', "exp_month": 1, "exp_year": 2020, "cvc": '456' }}).then(x => token2 = x)
var deleteSingleCustomer = (c) => stripe.customers.del(c.id)
var deleteAllCustomers = () => stripe.customers.list({ limit: 100 }).then(cs => Promise.all(cs.data.map(deleteSingleCustomer)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment