我正在尝试upload an identity document从URL图像剥离。 但是,我又回来了这个错误...
Error: We don't currently support that file type. Try uploading a file with one of the following mimetypes: image/jpeg, image/png
这是我的代码...
stripe.fileUploads.create({
purpose: 'identity_document',
file: {
data: "https://firebasestorage.googleapis.com/v0/b/laundry-llama.appspot.com/o/SudsterIDs%2FtZehZpG4wiTC7WArdaeaVsZGxuA3%2FIDBack?alt=media&token=e5c045b2-9bab-43a5-92ab-d19105dad954",
name: 'FileName',
type: 'image/jpeg'
}
}, {
stripe_account: "acct_0000000000"
})
任何想法我做错了什么?在文档示例中,它使用本地文件而不是URL。
答案 0 :(得分:2)
这正是问题所在;它必须是原始文件数据本身,而不是url。我建议您自己请求该文件,存储其数据,然后将其发送到条带。这应该是一个很好的起点:readFileSync from an URL for Twitter media - node.js
答案 1 :(得分:1)
let fp = fs.readFileSync("./public/images/fileUploadDoc.png");
let docUpload = await stripe.fileUploads.create({
file: {
data: fp,
name: "fileUploadDoc.png",
type: "application/octet-stream",
},
purpose: "identity_document",
});
还要检查文件类型。谢谢。