Direct URL Integration
This guide covers integrating Advance.AI Web SDK using direct URL redirection - the simplest integration method.
Why Choose URL Integration?
✅ Simplest Implementation: Just redirect to a URL
✅ No Iframe Restrictions: Bypass iframe-related browser limitations
✅ Works Everywhere: Compatible with all browsers and webviews
✅ Mobile-Friendly: Perfect for mobile apps and deep links
✅ Quick MVP: Get started in minutes
How It Works
┌──────────────┐
│ Your App │
└──────┬───────┘
│
│ 1. User clicks "Verify"
│
▼
┌──────────────────┐
│ Your Backend │ Call generateUrl API
└──────┬───────────┘
│
│ 2. Get verification URL
│
▼
┌──────────────┐
│ Your App │ Redirect to URL
└──────┬───────┘
│
│ 3. window.location.href = url
│
▼
┌─────────────────────┐
│ AAI Verification │ User completes verification
│ (new page/tab) │
└──────┬──────────────┘
│
│ 4. Verification complete
│
▼
┌──────────────────┐
│ Your Redirect │ Handle callback with results
│ URL (your app) │
└──────────────────┘
How To Integrate
1. Open URL in WebView
After calling the Generate URL API with the required parameters including returnUrl and failReturnUrl,there will be a url in the response body.
Then App needs to open the URL in WebView.
returnUrl and failReturnUrl can be standard web URLs such as https://... or custom app schemes such as myapp://.... If you use a custom scheme, register it in your app before going live. For the full validation rules and callbackUrl restrictions, refer to Redirect URL Requirements.
returnUrl and failReturnUrl can be standard web URLs such as https://... or custom app schemes such as myapp://.... If you use a custom scheme, register it in your app before going live. For the full validation rules and callbackUrl restrictions, refer to Redirect URL Requirements.
2. Give Camera Permission
Refer to Camera Permission (H5)
3. Handle Redirect Url
The verification flow will redirect users to one of two URLs based on the result:
Both redirect targets can be web URLs or app deep links, as long as your client application can handle them directly.
Both redirect targets can be web URLs or app deep links, as long as your client application can handle them directly.
Under Review Case: returnUrl
returnUrlWhen it happens:
- User successfully submitted all required materials and under review
Important Recommendation: We strongly advise against relying solely on the returnUrl to determine the final KYC result. This URL signifies that the submission process is complete and under review. We may add new parameters to this URL in the future to provide more granular state updates (e.g.,submissionStatus = SUBMITTED). Client systems should be designed to handle these potential future enhancements.
Failure Case: failReturnUrl
failReturnUrlWhen it happens:
- User did not complete submission
- submission completed but verification failed (LIVENESS_ATTACK,POOR_FACE)
URL Format:
https://yourapp.com/kyc/failed?errorCode=CAMERA_ISSUE
App deep link example:
myapp://kyc/failed?errorCode=CAMERA_ISSUEApp deep link example:
myapp://kyc/failed?errorCode=CAMERA_ISSUEerrorCode | Description | Node |
|---|---|---|
NOT_SUPPORT | Not supported due to compatibility issues | COMMON |
CAMERA_ISSUE | Camera issue error | COMMON |
IAM_FAILED | User submits after leaving page open for over 1 hour | COMMON |
ERROR | System error, backend processing exception or network issue | COMMON |
DOCUMENT_AUTO_SCAN_TRY_COUNT_EXCEED | Document auto-scan try count exceeded the limit | DOCUMENT |
DOCUMENT_MANUAL_TRY_COUNT_EXCEED | Document manual photo try count exceeded the limit | DOCUMENT |
DOCUMENT_GALLERY_TRY_COUNT_EXCEED | Gallery upload retry count exceeded | DOCUMENT |
RESELECT_DOC_TYPE | User clicked to reselect document type | DOCUMENT |
RESELECT_REGION | User clicked to reselect region | DOCUMENT |
NO_SUPPORTED_CARD | The card type detected from the document image is not supported. | DOCUMENT |
NO_SUPPORTED_CARD_CUSTOMIZED | The card type is known but not supported currently. maybe support in the future. | DOCUMENT |
LIVENESS_TRY_COUNT_EXCEED | Liveness detection try count exceeded the limit | FACE |
LIVENESS_ATTACK | The liveness detection result < 50.0. whenignoreFailWhenJump set to true, will jump to returnUrl instead. | FACE |
SIMILARITY_FAILED | The faceSimilarityScore < 70.0. | FACE |
FACE_QUALITY_TOO_POOR | Face image quality too low (blurry, insufficient lighting, or wrong angle) | FACE |
Troubleshooting
Issue: Callback Not Received
Solution: Check redirectUrl is correct and accessible
Issue: URL Expired
Solution: Generate new URL(1 hour lifecycle)
Updated 20 days ago
