PHP code example of assoconnect / smoney-client

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

    

assoconnect / smoney-client example snippets


$guzzle = GuzzleHttp\Client();
$client = new AssoConnect\SMoney\Client('YOUR S-MONEY ENDPOINT', 'YOUR S-MONEY TOKEN', $guzzle);

// Create a new User
$user = new AssoConnect\SMoney\Object\User([
    'appUserId' => 'appuserid-' . uniqid(),
    'type' => AssoConnect\SMoney\Object\User::TYPE_PROFESSIONAL_CLIENT,
    'profile' => new AssoConnect\SMoney\Object\UserProfile([
        'civility' => UserProfile::CIVILITY_MR,
        'firstname' => 'Test',
        'lastname' => 'McTestington',
        'birthdate' => new DateTime(),
        'address' => new AssoConnect\SMoney\Object\Address([
            'street' => 'rue du Test',
            'zipcode' => '75002',
            'city' => 'TestVille',
            'country' => 'FR',
        ]),
        'email' => 'test-' . uniqid() . '@test.com',
    ]),
    'company' => new AssoConnect\SMoney\Object\Company([
        'name' => 'CompanyName',
        'siret' => '123456789',
        'nafCode' => '4741Z',
    ])
]);

$userManager = new AssoConnect\SMoney\Manager\UserManager($client);
$userManager->createUser($userPro)->id; // S-Money's id of this newly created user