You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tabulardata edited this page Oct 25, 2013
·
3 revisions
Alongside the version 2 release we added support for promises. Every resource method now returns a Promises/A+ compliant promise in addition to supporting the conventional callback:
Here's an example of creating a customer and then a new charge for that customer:
stripe.customers.create({email: 'foo-customer@example.com'}).then(function(customer){returnstripe.charges.create({amount: 1600,currency: 'usd',customer: customer.id});}).then(function(charge){// New charge created on a new customer},function(err){// Deal with an error});