嗨,我已经将http转换为https一切都很好。但在条纹支付时,我得到的图像链接,我打开它在 chrome 打开罚款,但我的条纹说,错误获取资源。让我来看看代码和错误
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 });
});
这是在stripe上生成的链接,它将在chrome上打开
https://localhost:8000/uploads/logo.png
1条答案
按热度按时间laximzn51#
success_url
无法指向您的本地主机,因为Stripe服务器不知道如何访问您的当前设备(“本地主机”)。有一些工具可以用来测试您与Stripe的集成,请参阅此线程中的评论:Is it possible to set localhost as a Stripe webhook URL?