How to register image verification in Stripe Connect | Identity verification for child accounts | Node.js
Tags: node
Published: 2021-06-06 09:40:08

[Web media for tech lovers | off.tokyo](https://off.tokyo/blog/stripe-connect-img-add/)



I started to make [a service for skill-sharing](https://meee.work) in 2020, but it was completely neglected.




But I've recently started developing it again.




It seems that my passion for the market of person-to-person trading hasn't been crushed yet.




Well, that's not really the point...




A lot of code was stuck, and the Stripe area wasn't working anymore.




What I'm trying to do is a C2C service that allows you to verify a user's identity when transferring sales to their account.




I need to verify the identity of the user.




We need the address, the real name, the driver's license and so on.




In this article, we'll show you how to create an image of your driver's license.




## Create an image



[Create a file](https://stripe.com/docs/api/files/create)





```
const file = await stripe.files.create({
  purpose: 'dispute_evidence',
  file: {
    data: fp,
    name: 'file.jpg',
    type: 'application/octet-stream',
  },
});
```



First, we need to send an image file to the server, so we create an image like the one above.




It's like sending an image file, such as a driver's license, to an api, and then using the returned id, hitting another api to request identity authentication.




If you hit the api as above, the id will be returned in the response, so use this.


```

{
  "id": "file_19yVPOfwefwefwefwefweO",
  "object": "file",
```


We will use the id, so please save it in a variable somewhere.




## Register an identity.




[Update an account](https://stripe.com/docs/api/accounts/update#update_account-individual-verification-document)





This is the main topic of this article, so here's the actual code I wrote.





```
async function UpdateAccounts(
  stripe_user_id,
  HEAD_ID_STRIPE_IMG, 
  BACK_ID_STRIPE_IMG
) {
  try {
    const account = await stripe.accounts.update(
      stripe_id_get_edit_connect_user,
      {
        individual: {
          verification:{document:{front: HEAD_ID_STRIPE_IMG, back: BACK_ID_STRIPE_IMG } }, 
        },
      },
    );
    console.log("アカウント")
    console.log(account)
  } catch (err) { 
    console.log("エラー");
    console.log(err);
  }
}
```




Call the above function.




Pass the id of the image file you've just created and the Stripe Connect user's account id as arguments.




We won't be discussing Stripe Connect user accounts in this article.




So, since this is an individual transaction, we'll pass in the id of the image as a string, as described in the individual section.




By the way, this object can also contain an address and a name.




You can find out more about these parameters in the official documentation.




If you hit api in this state, there are only optional parameters in the api definition, so if the object is correct, the api should pass.




## Check with Stripe




Now, let's check it out on the Stripe dashboard.




As you can see in the image below, if the dentity document and identity document back are provided, then




I think that the id of the image is correctly sent to the Stripe api.




After that, you can wait for a while to see if your personal information is correctly authenticated or not.



![stripe.png](https://off.tokyo/wp-content/uploads/2021/06/stripe.png)


--

[web media for tech lovers | off.tokyo](https://off.tokyo/blog/stripe-connect-img-add/)