Passer au contenu principal

Installation

composer require txcloud/txcloud-php

Demarrage Rapide

<?php
require_once 'vendor/autoload.php';

use TXCloud\TXCloud;

$txcloud = new TXCloud(getenv('TXCLOUD_API_KEY'));

$verification = $txcloud->identity->verify([
    'document_front' => $documentBase64,
    'country' => 'MA',
    'document_type' => 'national_id'
]);

echo "Statut: " . $verification->status;

Configuration

$txcloud = new TXCloud(
    apiKey: getenv('TXCLOUD_API_KEY'),
    environment: 'production',
    timeout: 30
);

Gestion des Erreurs

use TXCloud\Exceptions\ValidationException;
use TXCloud\Exceptions\RateLimitException;

try {
    $result = $txcloud->identity->verify([...]);
} catch (ValidationException $e) {
    echo "Validation echouee: " . $e->getMessage();
} catch (RateLimitException $e) {
    echo "Limite atteinte, reessayer apres: " . $e->getRetryAfter();
}