Let's perform the following steps to add a Stripe powered credit card donation form to our Angular web application:
- 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);