Auto AML Check with Onfido API

Wendy
Wendy
Jul 20 · 1 min read
const axios = require('axios')

module.exports.amlChecked = createApplicant

const onfidoKey = 'onfidoKey'// onfido API key

const inputUserData = {
first_name: 'firstName'
last_name: 'lastName'
dob: 'dateofBirth'
country: 'country'
addresses: 'address'
}

async function createApplicant (user) {
const res = await api.post('/applicants', inputUserData)
const data = await createCheck(res.data.id)
return data
}

async function createCheck (applicantId) {
const { data } = await api.post(/applicants/${applicantId}/checks,
{
'type': 'express',
'reports': [
{
'name': 'identity',
'variant': 'kyc'
},
{
'name': 'watchlist',
'variant': 'full'
}]
}
)

const output = {
url: data.download_uri,
reports: data.reports
}
return output
}
Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade