PHP code example of smartbuy / api

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

    

smartbuy / api example snippets


$api = new Smartbuy\Api\Api($accessToken);
$api->init(); 


$products = [
    [
        'title' => 'Product #1',
        'price' => 10,
        'quantity' => 1
    ],
    [
        'title' => 'Product #2',
        'price' => 4,
        'quantity' => 2,
        'rate' => 'SB1'
    ]
];

$api = new Smartbuy\Api\Api($accessToken);
$api->orderRegister($orderUniqueNumber, $products);

$api = new Smartbuy\Api\Api($accessToken);
$api->orderCancel($orderUniqueNumber);

$api = new Smartbuy\Api\Api($accessToken);
$api->orderDelete($orderUniqueNumber);

$api = new Smartbuy\Api\Api($accessToken);
$api->registerOrder($orderUniqueNumber, $fullAmount, $rateId); // RateId is optional

php composer.phar