A Laravel package that provides ShuftiPro integration for the Asciisd KYC Core package. Features automatic webhook handling, provider-specific status mapping, and zero-config infrastructure routes.
- Package: asciisd/kyc-shuftipro
- Latest Version: v1.0.0
- PHP Requirements: ^8.2
- Laravel Requirements: ^12.0
- License: MIT
- π Zero-Config Setup: Automatic webhook routes - no manual configuration needed!
- π― Smart Status Mapping: ShuftiPro-specific event mapping to standardized KYC statuses
- π Complete Integration: Full API integration with ShuftiPro services
- π£οΈ Journey Support: Support for both IDV journeys and direct API verification
- π Document Management: Automatic document download and storage
- π Secure Webhooks: Signature validation and comprehensive logging
- πΌοΈ Image Processing: Support for document images, selfies, and verification videos
- π Duplicate Detection: Built-in duplicate account detection
- π Comprehensive Logging: Detailed logging for debugging and monitoring
- β‘ Auto-Infrastructure: Webhook endpoints automatically registered by KYC Core
composer require asciisd/kyc-shuftiproPublish the configuration file:
php artisan vendor:publish --tag=shuftipro-configAdd these variables to your .env file:
# ShuftiPro API Configuration
SHUFTIPRO_CLIENT_ID=your_client_id
SHUFTIPRO_SECRET_KEY=your_secret_key
SHUFTIPRO_BASE_URL=https://api.shuftipro.com
# ShuftiPro Webhook Configuration
SHUFTIPRO_WEBHOOK_SECRET=your_webhook_secret
SHUFTIPRO_CALLBACK_URL=https://yourdomain.com/webhooks/kyc/callback
SHUFTIPRO_REDIRECT_URL=https://yourdomain.com/kyc/complete
# ShuftiPro Journey Configuration
SHUFTIPRO_DEFAULT_JOURNEY_ID=your_journey_id
# ShuftiPro Logging
SHUFTIPRO_LOGGING_ENABLED=true
SHUFTIPRO_LOG_CHANNEL=dailyuse Asciisd\KycCore\Facades\Kyc;
use Asciisd\KycCore\DTOs\KycVerificationRequest;
// Create a simple verification
$response = Kyc::createSimpleVerification($user, [
'country' => 'US',
'language' => 'en'
]);
// Create a full verification request
$request = new KycVerificationRequest(
email: 'user@example.com',
country: 'US',
language: 'en',
journeyId: 'your_journey_id'
);
$response = Kyc::createVerification($user, $request);// Use a specific journey ID
$request = new KycVerificationRequest(
email: 'user@example.com',
journeyId: 'your_custom_journey_id',
allowedCountries: ['US', 'CA', 'GB'],
deniedCountries: ['IR', 'KP']
);
$response = Kyc::createVerification($user, $request);NEW! Webhooks are now handled automatically - no manual route setup required!
The KYC Core package automatically registers these routes:
POST /api/kyc/webhook // β
Use this URL in ShuftiPro dashboard
POST /api/kyc/webhook/callback // β
Alternative webhook endpoint
GET /api/kyc/verification/complete // β
Verification completion callbackSimply configure your ShuftiPro webhook URL to:
SHUFTIPRO_CALLBACK_URL=https://yourdomain.com/api/kyc/webhook- β Zero Setup - Works immediately after installation
- β Automatic Processing - Webhooks processed with proper status mapping
- β Secure - Built-in signature validation
- β Logged - Comprehensive logging for debugging
- β Consistent - Same behavior across all applications
If you need custom webhook handling:
// Optional: Custom webhook processing
$response = Kyc::processWebhook($request->all(), $request->headers->all());
if ($response->isSuccessful()) {
// Custom logic after successful verification
}// Download documents for a user
$documents = Kyc::downloadDocuments($user, $reference);
// The documents are automatically stored in your configured storage disk// config/shuftipro.php
'api' => [
'client_id' => env('SHUFTIPRO_CLIENT_ID'),
'secret_key' => env('SHUFTIPRO_SECRET_KEY'),
'base_url' => env('SHUFTIPRO_BASE_URL', 'https://api.shuftipro.com'),
'timeout' => env('SHUFTIPRO_TIMEOUT', 30),
],'webhook' => [
'secret_key' => env('SHUFTIPRO_WEBHOOK_SECRET'),
'callback_url' => env('SHUFTIPRO_CALLBACK_URL'),
'redirect_url' => env('SHUFTIPRO_REDIRECT_URL'),
'signature_validation' => env('SHUFTIPRO_WEBHOOK_SIGNATURE_VALIDATION', true),
],'documents' => [
'auto_download' => env('SHUFTIPRO_AUTO_DOWNLOAD_DOCUMENTS', true),
'storage_disk' => env('SHUFTIPRO_DOCUMENT_STORAGE_DISK', 's3'),
'storage_path' => env('SHUFTIPRO_DOCUMENT_STORAGE_PATH', 'shuftipro/documents'),
'allowed_types' => ['jpg', 'jpeg', 'png', 'pdf', 'mp4'],
'max_file_size' => env('SHUFTIPRO_MAX_FILE_SIZE', 10485760), // 10MB
],- Identity documents (passport, driver's license, national ID)
- Address verification documents
- Selfie verification
- Video verification
- Verification reports
- IDV Journey verification
- Direct API verification
- Custom journey configurations
- Country-specific verification rules
- Webhook signature validation
- Secure document storage
- Duplicate account detection
- Comprehensive audit logging
The package fires standard KYC events that you can listen to:
use Asciisd\KycCore\Events\VerificationStarted;
use Asciisd\KycCore\Events\VerificationCompleted;
use Asciisd\KycCore\Events\VerificationFailed;
Event::listen(VerificationCompleted::class, function ($event) {
// Handle successful verification
Log::info('ShuftiPro verification completed for user: ' . $event->user->id);
});The package includes comprehensive error handling:
use Asciisd\KycShuftiPro\Exceptions\ShuftiProException;
try {
$response = Kyc::createVerification($user, $request);
} catch (ShuftiProException $e) {
// Handle ShuftiPro-specific errors
Log::error('ShuftiPro error: ' . $e->getMessage());
}composer testThe driver automatically maps ShuftiPro events to standardized KYC statuses:
// ShuftiPro Event β KYC Status
'request.pending' β RequestPending
'verification.pending' β InProgress
'verification.in_progress' β InProgress
'verification.review_pending' β ReviewPending
'verification.completed' β Completed
'verification.approved' β Completed
'verification.accepted' β VerificationCompleted
'verification.failed' β VerificationFailed
'verification.declined' β Rejected
'verification.cancelled' β VerificationCancelled
'request.timeout' β RequestTimeout- β Automatic Mapping - No manual status handling required
- β Standardized - Consistent status across all KYC providers
- β Provider-Specific - Handles ShuftiPro's unique event names
- β Extensible - Easy to add new event mappings
createVerification(Model $user, KycVerificationRequest $request): KycVerificationResponsecreateSimpleVerification(Model $user, array $options = []): KycVerificationResponseretrieveVerification(string $reference): KycVerificationResponseprocessWebhook(array $payload, array $headers = []): KycVerificationResponsedownloadDocuments(Model $user, string $reference): arrayvalidateWebhookSignature(array $payload, array $headers): bool
The package returns comprehensive verification data including:
- Verification status and results
- Extracted document data
- Document image URLs
- Verification video URLs
- Duplicate detection results
- Decline reasons (if applicable)
Please see CONTRIBUTING.md for details.
The MIT License (MIT). Please see License File for more information.