简体   繁体   English

结账条纹上的空图片

[英]Empty picture on checkout stripe

I have implemented the stripe checkout using node.js我已经使用 node.js 实现了条带结帐

product.photo is https://test.s3.amazonaws.com/2213131 product.photohttps://test.s3.amazonaws.com/2213131

const session = await stripe.checkout.sessions.create({
  payment_method_types: ["card"],
  line_items: [{
    name: product.title,
    description: product.description,
    images: [product.photo],
    amount: product.price * 100,
    currency: "usd",
    quantity: 1
  }],
  success_url: "http://localhost:3000/success?session_id={CHECKOUT_SESSION_ID}",
  cancel_url: "http://localhost:3000/cancel"
});

For some reason, the picture is always empty由于某种原因,图片总是空的

在此处输入图片说明

Other data is fine其他数据没问题

I had the same issue.我遇到过同样的问题。 Please make sure to use the correct "content-type" for your images when storing to S3.存储到 S3 时,请确保为您的图像使用正确的“内容类型”。 That should fix it.那应该解决它。 Check that your browser does not download image as attachment, rather shows image in browser.检查您的浏览器是否没有将图像下载为附件,而是在浏览器中显示图像。

Similar to Sumit Datta , it was the content-type metadata on S3 that was causing this issue.Sumit Datta类似,导致此问题的是 S3 上的内容类型元数据。 Make sure you use image/jpeg or image/png as the content-type, else Stripe's CDN won't be able to cache your images!确保您使用image/jpegimage/png作为内容类型,否则 Stripe 的 CDN 将无法缓存您的图像!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM