Iframe Integration Code Reference (H5)
Overview
This document provides comprehensive guidance on handling codes returned by the AAI KYC iFrame integration. Codes are categorized into two types:
- Frontend-triggered codes: Require immediate client-side handling
- Backend-return codes: Require server-side verification via API
Code Reference Table
Code | Category | Trigger Condition | When It Occurs | Recommended Action | Implementation Priority |
|---|---|---|---|---|---|
| Success | KYC verification flow completed and submitted successfully | User completes all verification steps successfully | Redirect to success page or next step in your flow | Required |
| Frontend Triggered | Camera unavailable or inaccessible |
| Display error message | High Priority |
| Frontend Triggered | Browser not supported or compatibility issues |
| Display error message: "Your browser is not compatible. Please use Chrome, Safari, Firefox, or Edge (latest versions)." | High Priority |
| Frontend Triggered | The user clicked the "Reselect Region" prompt for a document from an unsupported region. |
| Redirect to region selection page | High Priority |
| Frontend Triggered | The user clicked the "Reselect Document" prompt for an unsupported document type. |
| Redirect to document type selection page or re-initialize iFrame with | High Priority |
Backend Return | The complete set of backend status codes for all KYC data submissions. |
| Call Get Result API to retrieve detailed verification status and reason | Required |
Integration Example
window.addEventListener('message', (event) => {
const { type, code } = event.data;
if (type === 'complete') {
switch (code) {
case 'SUCCESS':
console.log('Document Verification complete successfully.');
handleSuccess();
break;
// Frontend-triggered codes
case 'CAMERA_ISSUE': // It is only sent when the downgrade process is closed.
handleCameraIssue();
break;
case 'BROWSER_ISSUE': // It is only sent when the downgrade process is closed.
handleBrowserIssue();
break;
case 'RESELECT_REGION':
handleReselectRegion();
break;
case 'RESELECT_DOC_TYPE':
handleReselectDocType();
break;
// All other codes - Backend-proxied
default:
console.info('Refer to the corresponding {errorCode}:', code);
handleBackendCode(code, event.data.transactionId);
break;
}
}
if (type === 'copy') {
console.log(event.data.shortUrl);
}
});Updated about 17 hours ago
