PHP code example of nexgenspin / coordinator

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

    

nexgenspin / coordinator example snippets






use NexGenSpin\Coordinator\NexGenSpinCoordinatorClient;

$client = NexGenSpinCoordinatorClient::staging(
    '019d4f70-2dfa-781a-9de6-39503e63c0f4',
    '302e020100300506032b65700422042033a9b1b71e0deb2e8354098106c9d349bac6f46ae486303b4cf974a94fc7a2fb'
);



use NexGenSpin\Coordinator\KeyLoader;
use NexGenSpin\Coordinator\NexGenSpinCoordinatorClient;

$pkcs8DerHex = KeyLoader::pkcs8DerHexFromPemFile(__DIR__ . '/operator.pem');

$client = NexGenSpinCoordinatorClient::staging(
    '019d4f70-2dfa-781a-9de6-39503e63c0f4',
    $pkcs8DerHex
);



use NexGenSpin\Coordinator\KeyLoader;
use NexGenSpin\Coordinator\NexGenSpinCoordinatorClient;

$pemPath = __DIR__ . '/operator.pem';
$pkcs8DerHex = KeyLoader::pkcs8DerHexFromPemFile($pemPath);

$client = NexGenSpinCoordinatorClient::staging(
    '019d4f70-2dfa-781a-9de6-39503e63c0f4',
    $pkcs8DerHex
);

$games = $client->games();
print_r($games['response']['json']);

$games = $client->games();
print_r($games['response']['json']);

$currencies = $client->currencies();
print_r($currencies['response']['json']);

$languages = $client->languages();
print_r($languages['response']['json']);

$demoSession = $client->createSession([
    // Game identifier from the games query
    'game' => ['id' => '019d2822-20ed-7212-95a9-def642d50ddf'],

    // Currency for all transactions within this session (immutable)
    'currency' => ['code' => 'USD'],

    // Preferred language (BCP 47)
    'languageTag' => 'en',

    // IP address of the customer — supports both IPv4 and IPv6 formats
    'ipAddress' => '203.0.113.42',
]);

print_r($demoSession['response']['json']);

$session = $client->createSession([
    // Session ID on the Operator's platform
    'id' => 'SESSION_ID_ON_OPERATOR_SIDE',

    // Game identifier from the games query
    'game' => ['id' => '019d2822-20ed-7212-95a9-def642d50ddf'],

    // Customer on the Operator's platform
    'customer' => [
        // Customer ID on the Operator's platform
        'id' => 'CUSTOMER_ID_ON_OPERATOR_SIDE',

        // Name is optional — displayed in the game interface, auto-generated if omitted
        'name' => 'John',

        // ISO 3166-1 alpha-2 country code
        'countryCode' => 'US',
    ],

    // Currency for all transactions within this session (immutable)
    'currency' => ['code' => 'USD'],

    // Preferred language (BCP 47)
    'languageTag' => 'en',

    // IP address of the customer — supports both IPv4 and IPv6 formats
    'ipAddress' => '203.0.113.42',
]);

print_r($session['response']['json']);