PHP code example of izichangepay / sdk

1. Go to this page and download the library: Download izichangepay/sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

izichangepay / sdk example snippets



use Izichangepay\Client;
use Izichangepay\Http;

$izipay = new Client(getenv('IZIPAY_API_KEY'));
// Sandbox: new Client(getenv('IZIPAY_API_KEY'), Http::SANDBOX_BASE_URL);

$intent = $izipay->paymentIntents->create([
    'requestedCurrencyType' => 'fiat',
    'currencyRequested'     => 'XOF',
    'amountRequested'       => '10000',
    'acceptedCoins'         => ['USDT.TRC20'],
]);
echo $intent['paymentUrl'];

foreach ($izipay->paymentIntents->iterate(['limit' => 50]) as $intent) {
    echo $intent['id'], PHP_EOL;
}


use Izichangepay\Webhooks;
use Izichangepay\WebhookException;

$rawBody = file_get_contents('php://input'); // raw body, not a parsed array
try {
    $event = Webhooks::validate(
        $rawBody,
        $_SERVER['HTTP_X_IZIPAY_SIGNATURE'] ?? null,
        getenv('IZIPAY_WEBHOOK_SECRET')
    );
    // handle $event['type'] / $event['data']
    http_response_code(200);
} catch (WebhookException $e) {
    http_response_code(400); // reject: $e->reason
}