此包最新版本(1.1.3)没有可用的许可证信息。

SmartBuy API 库

1.1.3 2018-07-23 15:25 UTC

This package is not auto-updated.

Last update: 2024-09-29 05:34:58 UTC


README

SmartBuy API 的 PHP 包装器

安装

安装 https://getcomposer.org.cn/ 并运行以下命令

php composer.phar require smartbuy/api

示例

方法

与api通信有2种常见方法

检查是否存在带有联盟ID的查询参数并设置cookie

$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);

已弃用 注册订单(仅在检测到联盟ID时执行)

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