Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chrishiestand/6497def7fbedcc8fcf19eb81aab88a86 to your computer and use it in GitHub Desktop.
Save chrishiestand/6497def7fbedcc8fcf19eb81aab88a86 to your computer and use it in GitHub Desktop.

Problem

How can I use the js client side api to satisfy the stripe custom connect requirement of "individual.verification.additional_document"?

Context

The js client is handling the file upload and account token creation. The token ID is passed to the server where the server-side stripe api is used to update the account. This works perfectly to verify the custom connect requirement: "individual.verification.document", but not "individual.verification.additional_document"

This is in stripe test mode and the file being uploaded is this: https://stripe.com/img/docs/connect/success.png

client side code - my ideal

Result: token creation fails with error

  const stripeData = {
    individual: {
      verification: {
        additional_document: {front: frontResult.id},
      },
    },

  const {token, error} = await stripe.createToken("account", stripeData);
  // ...
  sendToBackend(token)
};

Error

IntegrationError: Invalid value for token creation parameter: individual.verification.document should be a string or individual.verification.document should be an object. You specified individual.verification.document as undefined.

client side code - seems to be demanded by stripe js v3 api?

Result: token creation succeeeds, backend api call succeeds, but account requirement "individual.verification.additional_document" is not marked as verified by stripe

  const stripeData = {
    individual: {
      verification: {
        document: {front: frontResult.id},
      },
    },

  const {token, error} = await stripe.createToken("account", stripeData);
  // ...
  sendToBackend(token)
};

server side code snippet

  const account = await client.accounts.update(accountId, {account_token: tokenId});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment