Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

159
Views
how to make a payment gateway for cart with multiple items in react

I am using razorpay api as a payment gateway for my shopping website and I am stuck at creating multiple orders

it works perfectly fine when I order single product but when I try to checkout from cart where there are multiple product added, I get stuck about what to do for amount and description field because it sends array of product while its send single product when its ordered directly.

app.post("/payment", async (req, res) => {
  try {
    const { product } = req.body;
    console.log("product");
    const amount = product.price * 100;
    const currency = "INR";
    const receipt = product.id;
    const notes = { desc: product.desc };

    instance.orders.create({ amount, currency, receipt, notes }),
      (err, order) => {
        if (error) {
          return res.status(500).json({ err });
        }
        return res.status(200).json({ order });
      };
  } catch (err) {
    console.log(err);
  }
  res.json(res);
});

when I order directly

{
 b_name: "siyaram",
 id: 9,
 p_color: "white",
 p_img: {type: 'Buffer', data: Array(5771)},
 p_name: "kurta",
 p_price: 1000,
 p_size: "s m l"
}

when I order from cart

[
 {
  b_name: "raymond,
  id: 9,
  p_color: "yellow",
  p_img: {type: 'Buffer', data: Array(5771)},
  p_name: "kurta",
  p_price: 1000,
  p_size: "s m l"
 },
 {
  b_name: "peter England",
  id: 9,
  p_color: "red",
  p_img: {type: 'Buffer', data: Array(5771)},
  p_name: "kurta",
  p_price: 1300,
  p_size: "s m l"
 }
]

this throws an error cause here I have multiple product.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!