May 2018
Intermediate to advanced
470 pages
13h 54m
English
For an existing Stripe Customer, in other words, the current user has a value stored for the stripe_customer field, we will use the Stripe API to update a Stripe Customer.
mern-marketplace/server/controllers/user.controller.js:
myStripe.customers.update(req.profile.stripe_customer, { source: req.body.token }, (err, customer) => { if(err){ return res.status(400).send({ error: "Could not update charge details" }) } req.body.order.payment_id = customer.id next() })
Once the Stripe Customer is successfully updated, we will add the Customer ID to the order being created in the next() call.
Though not covered here, the Stripe Customer feature can be used further to allow users to store and update their credit ...
Read now
Unlock full access