April 2020
Intermediate to advanced
716 pages
18h 55m
English
When a seller updates an order by processing the product that was ordered in their shop, the application will create a charge on behalf of the seller on the customer's credit card for the cost of the product ordered.
To implement this, we will update the user.controller.js file with a createCharge controller method that will use Stripe's create a charge API and needs the seller's Stripe account ID, along with the buyer's Stripe Customer ID. The createCharge controller method will be defined as follows.
mern-marketplace/server/controllers/user.controller.js:
const createCharge = (req, res, next) => { if(!req.profile.stripe_seller){ return res.status('400').json({ error: "Please connect your ...Read now
Unlock full access