smartbuy / api
SmartBuy api library
Installs: 20
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/smartbuy/api
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