Stripe Identity helps you confirm the identity of global users to prevent fraud, streamline risk operations, and increase trust and safety.
Capture IDs with a conversion-optimized verification flow
Verify authenticity of global ID documents
Match photo ID with selfies, and validate SSN
Access collected images, and extracted data from ID document
If you want to know more, please visit the Stripe Identity home page. Or, if you're ready to get started, you can check the docs here
In order to use Stripe Identity you first need to Activate your account and fill out your Stripe Identity application.
Verify your users identity documents
There are four ways to implement Identity:
Modal — show a document upload modal inside your website.
Redirect — send your users to Stripe to upload their identity documents.
iOS Beta — show a document upload sheet inside your app.
Without code — manually create verifications in Dashboard and share a link with your users.
In this case we are going to use ngx-stripe to trigger the modal window within our Angular App. We need to create a verificación session in the server and then use the client secret in the front to trigger open the modal. Is a very similar to the Checkout flow.
To see more details on a full example, please check the official Stripe Docs.
import { Component } from'@angular/core';import { HttpClient } from'@angular/common/http';import { switchMap } from'rxjs/operators';import { StripeService } from'ngx-stripe';@Component({ selector:'app-identity', templateUrl:'./identity.component.html'})exportclassIdentityComponent {constructor(private http:HttpClient,private stripeService:StripeService ) {}verify() {// Check the server.js tab to see an example implementationthis.https.post('/create-verification-session', {}).pipe(switchMap(session => {// Show the verification modal.returnthis.stripeService.verifyIdentity(session.clientSecret) }) ).subscribe(result => {// If `verifyIdentity` fails, you should display the localized// error message to your user using `error.message`.if (result.error) {alert(result.error.message); } }); }}
<button (click)="verify()">
VERIFY
</button>
// This example sets up an endpoint using the Express framework.// Watch this video to get started: https://youtu.be/rPR2aJ6XnAc.constexpress=require('express');constapp=express();conststripe=require('stripe')('***your secret key***');app.post('/create-verification-session',async (req, res) => {constverificationSession=awaitstripe.identity.verificationSessions.create({ type:'document', metadata: { user_id:'{{USER_ID}}', } });// Return only the client secret to the frontendres.json({ clientSecret:verificationSession.clientSecret });});app.listen(4242, () =>console.log(`Listening on port ${4242}!`));
Verify your users identity using redirect
As discuss in the previous section, there is an alternative flow using redirect instead of a modal window. In this case you don't need this library or to bootstrap Stripe in the front at all.
All you need is to create a Verification Session in the server and pass the redirect url to the front. From there, you can simply redirect the user to that url.
Again, to see more details on a full example, please check the official Stripe Docs.
import { Component, Inject } from'@angular/core';import { DOCUMENT } from'@angular/common';import { HttpClient } from'@angular/common/http';import { switchMap } from'rxjs/operators';@Component({ selector:'app-identity', templateUrl:'./identity.component.html'})exportclassIdentityComponent {constructor( @Inject(DOCUMENT) private document:Document,private http:HttpClient ) {}verify() {// Check the server.js tab to see an example implementationthis.https.post('/create-verification-session', {}).subscribe(session => {this.document.location.href =session.url; }); }}
<button (click)="verify()">
VERIFY
</button>
// This example sets up an endpoint using the Express framework.// Watch this video to get started: https://youtu.be/rPR2aJ6XnAc.constexpress=require('express');constapp=express();conststripe=require('stripe')('***your secret key***');app.post('/create-verification-session',async (req, res) => {constverificationSession=awaitstripe.identity.verificationSessions.create({ type:'document', metadata: { user_id:'{{USER_ID}}', } });// Return only the session URL to the frontendres.json({ url:verificationSession.url });});app.listen(4242, () =>console.log(`Listening on port ${4242}!`));