Skip to Content
Full-Stack React Projects - Second Edition
book

Full-Stack React Projects - Second Edition

by Shama Hoque
April 2020
Intermediate to advanced
716 pages
18h 55m
English
Packt Publishing
Content preview from Full-Stack React Projects - Second Edition

Updating an existing Stripe Customer

For an existing Stripe Customer in other words, where the current user already has a value stored for the stripe_customer field we will use the Stripe API to update a Stripe Customer, as follows.

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 has been 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 to allow users to ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Full-Stack React Projects

Full-Stack React Projects

Shama Hoque
React Native - The Practical Guide

React Native - The Practical Guide

Academind by Maximilian Schwarzmüller GmbH

Publisher Resources

ISBN: 9781839215414Supplemental Content