smartbuy / api
There is no license information available for the latest version (1.1.3) of this package.
SmartBuy api library
1.1.3
2018-07-23 15:25 UTC
Requires
- php: >=5.3.0
- ext-json: *
- lib-curl: *
README
A PHP wrapper around the SmartBuy API
Install
Install http://getcomposer.org/ and run the following command:
php composer.phar require smartbuy/api
Examples
Methods
There are 2 common methods to communicate with api:
Checks if have query parameter with affiliate ID and sets cookie
$api = new Smartbuy\Api\Api($accessToken); $api->init();
Register new order
$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);
Cancel existing order
$api = new Smartbuy\Api\Api($accessToken); $api->orderCancel($orderUniqueNumber);
Delete existing order
$api = new Smartbuy\Api\Api($accessToken); $api->orderDelete($orderUniqueNumber);
DEPRECATED Register order (Executes only if have detected affiliate ID)
$api = new Smartbuy\Api\Api($accessToken); $api->registerOrder($orderUniqueNumber, $fullAmount, $rateId); // RateId is optional