#Satyra1
1 messages · Page 1 of 1 (latest)
Hi there!
while i am trying to const file: Express.Multer.File = req.file;
try {
if (!file) {
return res.json({
error: 'No file to validate bank account provided',
});
} else {
console.log({ file });
const fileContent: string = file.buffer.toString('base64');
const date = new Date();
console.log({
purpose: 'identity_document',
file: {
data: fileContent,
name: `${date.getDate()}`,
type: file.mimetype,
},
});
const fileStripe = await stripe.files.create({
purpose: 'identity_document',
file: {
data: fileContent,
name: `${date.getDate()}`,
type: file.mimetype,
},
});
console.log({ fileStripe });
return res.json({
purpose: 'identity_document',
file: {
data: fileContent,
name: `${date.getDate()}`,
type: file.mimetype,
},
});
}
} catch (error: any) {
console.log({ e: error.message });
return res.json({
error: error.message,
});
}
Can you share the request ID (req_xxx)? Here's how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
req_c7GyAL1faA3Aq3
Looks like there's an issue with the format of the file you are trying to send, as mentioned in the error message you shared
We don't currently support file type: application/octet-stream. Try uploading a file with one of the following mimetypes: application/pdf, image/jpeg, image/png
You can see examples of how to send files with Stripe here: https://stripe.com/docs/file-upload
Buf file that I'm sending is in JPG or png file
Can you try using the same code shown here? https://stripe.com/docs/file-upload
I'm not familiar with multer, sorry. So not sure how to make that work.
with multer i am getting buffered file
then i am using this buffer to get base64 string
after this everything is the same
Are you using the same code for stripe.files.create then?
yeah