How to do it...

Let's perform the following steps to add a Stripe powered credit card donation form to our Angular web application:

  1. First, we'll need to update our /middleware/stripe.js middleware to change the way we identify customers to rely on parameters from Stripe's form submission. We will also need to add a new method to create a charge within Stripe for the amount of money that will be displayed on our donation form:
...var self = module.exports = {  ...  createCustomer: function(req, res, next) {    return stripe.customers.create({      email: req.body.stripeEmail,      source: req.body.stripeToken    }).then(function(customer) {      res.stripe = { customer: customer };      next();    }).catch(function(error) {      return self.errorHandler(error)(req, res);

Get MEAN Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.