PHP code example of directaff / php-sdk

1. Go to this page and download the library: Download directaff/php-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/ */

    

directaff / php-sdk example snippets


use DirectAff\DirectAff;
$directAff = new DirectAff();
$directAff->setBaseUrl('YOUR_API_BASE_URL')
          ->setSecretApiKey('YOUR_SECRET_API_KEY')
          ->setBrandId(YOUR_BRAND_ID);

$response = $directAff->register([
    'clickId' => 'exampleClickId',
    'identification' => 'exampleUsername', // it can be username or email or phone, userId
    'registration_date' => '2023-01-01 00:00:00'
]);

$response = $directAff->registerThroughPromoCode([
    'promoCode' => 'examplePromoCode',
    'identification' => 'exampleUsername', // it can be username or email or phone, userId
    'ipAddress' => '127.0.0.1',
    'userAgent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)',
    'registration_date' => '2023-01-01 00:00:00'
]);

$response = $directAff->deposit([
    'clickId' => 'exampleClickId',
    'amount' => 100,
    'currency' => 'USD',
    'depositId' => '12345',
    'transactionDate' => '2023-01-01 00:00:00'
]);

$response = $directAff->withdraw([
    'clickId' => 'exampleClickId',
    'currency' => 'USD',
    'withdrawId' => '12345',
    'transactionDate' => '2023-01-01 00:00:00'
]);

$response = $directAff->chargeback([
    'clickId' => 'exampleClickId',
    'currency' => 'USD',
    'chargebackId' => '12345',
    'transactionDate' => '2023-01-01 00:00:00'
]);

$response = $directAff->bonusAdded([
    'clickId' => 'exampleClickId',
    'currency' => 'USD',
    'bonusId' => '12345',
    'transactionDate' => '2023-01-01 00:00:00'
]);

$response = $directAff->bonusRemoved([
    'clickId' => 'exampleClickId',
    'currency' => 'USD',
    'bonusId' => '12345',
    'transactionDate' => '2023-01-01 00:00:00'
]);

$response = $directAff->betWin([
    'clickId' => 'exampleClickId',
    'currency' => 'USD',
    'betAmount' => '125.10',
    'winAmount' => '104.25'
]);
bash
composer