Verification Events#
CasaPay sends webhook events to notify your application about changes to verification sessions and reports.
Event Types#
| Event | Description |
|---|---|
verification_session.created | A new verification session was created |
verification_session.pending | The applicant has started the verification flow |
verification_session.processing | Verification data is being processed |
verification_session.completed | All verification checks are complete |
verification_session.expired | The session expired before completion |
verification_session.failed | The verification session failed |
verification_report.ready | The full verification report is available |
document_upload.processed | A document upload has been processed |
document_upload.rejected | A document was rejected (e.g., fraud detected) |
identity_check.passed | An identity check passed |
identity_check.failed | An identity check failed |
Event Object#
{
"id": "evt_1a2b3c4d",
"object": "event",
"type": "verification_session.completed",
"data": {
"object": {
"id": "vs_1a2b3c4d5e6f",
"object": "verification_session",
"status": "completed",
"applicant": {
"first_name": "Jane",
"last_name": "Doe",
"email": "jane.doe@example.com"
},
"report": "vr_9z8y7x6w5v",
"products": ["identity", "income", "credit", "cash_flow"]
}
},
"created": 1706140800,
"livemode": false
}Handling Verification Events#
app.post('/webhooks/casapay', async (req, res) => {
const event = req.body;
switch (event.type) {
case 'verification_session.completed':
const session = event.data.object;
const report = await casapay.verificationReports.retrieve(session.report);
await processVerificationResult(session, report);
break;
case 'verification_session.expired':
await sendReminderEmail(event.data.object.applicant.email);
break;
case 'document_upload.rejected':
await requestNewDocument(event.data.object);
break;
}
res.status(200).send();
});