0

Hii i have converted http to https everythings fine. But on stripe payment when i get the link of image that i open it on chrome it opens fine but my stripe says that error fetching resource.Let me show the code and error

userDashboard.post("/payment", async (req, res) => {
    const name = "samsung";
    const image =
      "https://wallsdesk.com/wp-content/uploads/2018/03/Pictures-of-lynx.jpg";
    const id = 2456;
    const amount = 100;
  
    const { product } = req.body;
    console.log(product.image)
    const session = await stripe.checkout.sessions.create({
      payment_method_types: ["card"],
      line_items: [
        {
          price_data: {
            currency: "pkr",
            product_data: {
              name: product.name,
              images: [product.image],
            },
            unit_amount: product.amount * 100,
          },
          quantity: product.quantity, 
          // id:product.id
        },
      ],
      mode: "payment",
      success_url: `${YOUR_DOMAIN}/success`,
      cancel_url: `${YOUR_DOMAIN}/cancel`,
    });
  
    res.json({ id: session.id });
  });

This is the link that is generated on for stripe and it opens on chrome

https://localhost:8000/uploads/logo.png

This is the error that stripe didnt get resource

1 Answers1

0

The success_url cannot point to your localhost as the Stripe server doesn't know how to access your current device (the "localhost").

There are a few tools you can use in order to test your integration with Stripe, see comments in this thread: Is it possible to set localhost as a Stripe webhook URL?

TBA
  • 601
  • 5
  • 6