'upload document file in stripe payment with React
According to the Stripe API for verification document in front I can see that creating a file in Javascript isn't available, and I want to create a file verification ID on the client side using React/Javascript.
I successfully created a bank account but when I try to upload an identity verification file through my React client interface with method stripe.files.create does not work and returns Cannot read property 'create' of undefined knowing that stripe.createToken works so stripe is well integrated into my application.
Note that I interact with stripe from client side developed with React.
stripeVerification = async () => {
const formdata = new FormData();
formdata.append('file', this.state.picture[0], 'picture');
await this.props.stripe.files
.create({
purpose: 'identity_document',
file: {
data: formdata,
},
})
.then(response => console.log(response));
};
Solution 1:[1]
You can upload a file client-side using the approach documented in the "Handling a file upload" section of Stripe's Connect documentation.
When a user needs to provide Stripe with a scan of an identity document (for example, a passport), you can also do this through an account token. However, the JavaScript required is a bit more complicated as the file must be sent to Stripe as part of an XHR request.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
