listAllCustomers: function() { stripe.customers.list({ limit: 10 }, function(err, customers) { //async called }) }
listSubscriptions: function(customerid) { stripe.customers.listSubscriptions(customerid, function(err, subscriptions) { console.log(subscriptions); //async called }) },
getCustomer: function(customerid) { stripe.customers.retrieve( customerid, function(err, customer) { // asynchronously called } ); },
cancelSubscription: function(customerid, subscriptionid) { stripe.customers.cancelSubscription( customerid, subscriptionid, function(err, confirmation) { console.log(confirmation); //async called }) },
updateSubscription: function(customerid, subscriptionid) { stripe.customers.updateSubscription( customerid, subscriptionid, { plan: "free" }, function(err, subscription) { console.log(subscription); //async called }) },
createCustomer: function(cb) { var user = this; stripe.customers.create({ email: user.email, }, function(err, customer) { if (err) return cb(err); user.stripe.customerId = customer.id; user.save(function(err) { if (err) return cb(err); return cb(null); }); }); },