Exemple #1
0
 listAllCustomers: function() {
   stripe.customers.list({
     limit: 10
   }, function(err, customers) {
     //async called
   })
 }
Exemple #2
0
 listSubscriptions: function(customerid) {
   stripe.customers.listSubscriptions(customerid,
     function(err, subscriptions) {
       console.log(subscriptions);
       //async called
     })
 },
Exemple #3
0
 getCustomer: function(customerid) {
   stripe.customers.retrieve(
     customerid,
     function(err, customer) {
       // asynchronously called
     }
   );
 },
Exemple #4
0
 cancelSubscription: function(customerid, subscriptionid) {
   stripe.customers.cancelSubscription(
     customerid,
     subscriptionid,
     function(err, confirmation) {
       console.log(confirmation);
       //async called
     })
 },
Exemple #5
0
 updateSubscription: function(customerid, subscriptionid) {
   stripe.customers.updateSubscription(
     customerid,
     subscriptionid, {
       plan: "free"
     },
     function(err, subscription) {
       console.log(subscription);
       //async called
     })
 },
Exemple #6
0
 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);
     });
   });
 },