Identity
The easiest way to verify identities
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.
identity.component.ts
identity.component.html
server.js
1
import { Component } from '@angular/core';
2
import { HttpClient } from '@angular/common/http';
3
import { switchMap } from 'rxjs/operators';
4
5
import { StripeService } from 'ngx-stripe';
6
7
@Component({
8
selector: 'app-identity',
9
templateUrl: './identity.component.html'
10
})
11
export class IdentityComponent {
12
constructor(
13
private http: HttpClient,
14
private stripeService: StripeService
15
) {}
16
17
verify() {
18
// Check the server.js tab to see an example implementation
19
this.https.post('/create-verification-session', {})
20
.pipe(
21
switchMap(session => {
22
// Show the verification modal.
23
return this.stripeService.verifyIdentity(session.clientSecret)
24
})
25
)
26
.subscribe(result => {
27
// If `verifyIdentity` fails, you should display the localized
28
// error message to your user using `error.message`.
29
if (result.error) {
30
alert(result.error.message);
31
}
32
});
33
}
34
}
Copied!
1
<button (click)="verify()">
2
VERIFY
3
</button>
Copied!
1
// This example sets up an endpoint using the Express framework.
2
// Watch this video to get started: https://youtu.be/rPR2aJ6XnAc.
3
4
const express = require('express');
5
const app = express();
6
const stripe = require('stripe')('***your secret key***');
7
8
app.post('/create-verification-session', async (req, res) => {
9
const verificationSession = await stripe.identity.verificationSessions.create({
10
type: 'document',
11
metadata: {
12
user_id: '{{USER_ID}}',
13
}
14
});
15
16
// Return only the client secret to the frontend
17
res.json({ clientSecret: verificationSession.clientSecret });
18
});
19
20
app.listen(4242, () => console.log(`Listening on port ${4242}!`));
Copied!

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.
identity.component.ts
identity.component.html
server.js
1
import { Component, Inject } from '@angular/core';
2
import { DOCUMENT } from '@angular/common';
3
import { HttpClient } from '@angular/common/http';
4
import { switchMap } from 'rxjs/operators';
5
6
@Component({
7
selector: 'app-identity',
8
templateUrl: './identity.component.html'
9
})
10
export class IdentityComponent {
11
constructor(
12
@Inject(DOCUMENT) private document: Document,
13
private http: HttpClient
14
) {}
15
16
verify() {
17
// Check the server.js tab to see an example implementation
18
this.https.post('/create-verification-session', {})
19
.subscribe(session => {
20
this.document.location.href = session.url;
21
});
22
}
23
}
Copied!
1
<button (click)="verify()">
2
VERIFY
3
</button>
Copied!
1
// This example sets up an endpoint using the Express framework.
2
// Watch this video to get started: https://youtu.be/rPR2aJ6XnAc.
3
4
const express = require('express');
5
const app = express();
6
const stripe = require('stripe')('***your secret key***');
7
8
app.post('/create-verification-session', async (req, res) => {
9
const verificationSession = await stripe.identity.verificationSessions.create({
10
type: 'document',
11
metadata: {
12
user_id: '{{USER_ID}}',
13
}
14
});
15
16
// Return only the session URL to the frontend
17
res.json({ url: verificationSession.url });
18
});
19
20
app.listen(4242, () => console.log(`Listening on port ${4242}!`));
Copied!
Last modified 3mo ago