PHP code example of betnex / sdk

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

    

betnex / sdk example snippets




etnex\Betnex;

$api = new Betnex(
    'YOUR_API_KEY',
    [
        'headerName' => 'x-betnex-key'
    ]
);

$providers = $api->getProviders();

print_r($providers);

$api = new Betnex(
    'YOUR_API_KEY',
    [
        'headerName' => 'x-betnex-key',
        'timeout' => 10000,
        'retries' => 3,
        'debug' => true
    ]
);

$providers = $api->getProviders();

print_r($providers);

$games = $api->getGames('SPRIBE');

print_r($games);

$launch = $api->launchGame([
    'username' => 'testuser',
    'gameId' => 'a04d1f3eb8ccec8a4823bdf18e3f0e84',
    'money' => 1000,
    'platform' => 1,
    'currency' => 'INR',
    'home_url' => 'https://example.com',
    'lang' => 'en'
]);

print_r($launch);

use Betnex\Utils\VerifyCallback;

$callback = VerifyCallback::verify(
    $payload,
    $apiKey
);

print_r($callback);

$payload = [
    'bet_amount' => 100,
    'win_amount' => 0,
    'member_account' => 'testuser',
    'game_uid' => 'a04d1f3eb8ccec8a4823bdf18e3f0e84',
    'game_round' => '9356359715438476370',
    'serial_number' => '955fbea9-6cd0-356c-8302-7326fa647c6d',
    'currency_code' => 'INR',
    'api_key' => 'YOUR_API_KEY',
    'game_name' => 'AVIATOR',
    'game_provider' => 'SPRIBE'
];

Array
(
    [valid] => true
    [bet_amount] => 100
    [win_amount] => 0
    [member_account] => testuser
    ...
)

use Betnex\Utils\CalculateBalance;

$newBalance = CalculateBalance::calculate(
    1000,
    100,
    50
);

echo $newBalance;

use Betnex\Utils\CallbackResponse;

$response = CallbackResponse::create([
    'success' => true,
    'handle' => true,
    'money' => 900,
    'msg' => 'Callback processed successfully'
]);

print_r($response);

try {

    $providers = $api->getProviders();

} catch (\Throwable $e) {

    echo $e->getMessage();
}

$api = new Betnex(
    $apiKey,
    [
        'debug' => true
    ]
);
text
SDK Version: 1.0.3