PHP code example of supershipvn / supership-sdk-php
1. Go to this page and download the library: Download supershipvn/supership-sdk-php 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/ */
supershipvn / supership-sdk-php example snippets
use SuperShip\SuperShipClient;
$supership = new SuperShipClient('YOUR_API_TOKEN');
$params = [
'pickup_phone' => '0989999999',
'pickup_address' => '45 Nguyễn Chí Thanh',
'pickup_commune' => 'Phường Ngọc Khánh',
'pickup_district' => 'Quận Ba Đình',
'pickup_province' => 'Thành phố Hà Nội',
'name' => 'Trương Thế Ngọc',
'phone' => '0945900350',
'email' => null,
'address' => '35 Trương Định',
'province' => 'Thành phố Hồ Chí Minh',
'district' => 'Quận 3',
'commune' => 'Phường 6',
'amount' => '220000',
'value' => null,
'weight' => '200',
'payer' => '1',
'service' => '1',
'config' => '1',
'soc' => 'KAN7453535',
'note' => 'Giao giờ hành chính',
'product_type' => '2',
'products' => [
[
'sku' => 'P899234',
'name' => 'Tên Sản Phẩm 1',
'price' => 200000,
'weight' => 200,
'quantity' => 1,
],
[
'sku' => 'P899789',
'name' => 'Tên Sản Phẩm 2',
'price' => 250000,
'weight' => 300,
'quantity' => 2,
],
]
];
$supership->createOrder($params);
$order = $supership->createOrder($params);
echo $order['results']['code'];
$supershipOrderCode = 'SUPERSHIP_ORDER_CODE';
$supership->getOrderInfo($supershipOrderCode);
$supership->getOrderStatuses();
$params = [
'code' => [
'SUPERSHIP_ORDER_CODE_1',
'SUPERSHIP_ORDER_CODE_2'
]
];
$supership->createPrintToken($params);
$printToken = '49ef6620-423e-11e9-b019-b71407a43f47';
$labelSize = 'K46';
$supership->getPrintLink($printToken, $labelSize);
$supership->getWarehouses();
$params = [
'name' => 'Kho HBT',
'phone' => '0989999888',
'contact' => 'Trần Cao Cường',
'address' => '47 Lê Lợi',
'province' => 'Thành phố Hồ Chí Minh',
'district' => 'Quận Tân Bình',
'district' => 'Phường 13',
'primary' => '1'
];
$supership->createWarehouse($params);
$params = [
'code' => 'WLKGT07050',
'name' => 'Kho Hai Bà Trưng',
'phone' => '0989999888',
'contact' => 'Dương Mạnh Quân'
];
$supership->editWarehouse($params);
$supership->getWebhooks();
$partnerUrl = 'https://example.com/listen/supership';
$supership->registerWebhook($partnerUrl);
$params = [
'project' => 'HMN Store',
'name' => 'Hoàng Mạnh Nam',
'phone' => '0989998888',
'email' => '[email protected] ',
'password' => '323423',
'partner' => 'lPxLuxfiTotCyZ1ZnQjMepUL24HLd05ybNBhVGFN'
];
$supership->createUser($params);
$params = [
'client_id' => 'AZN6QUo40w',
'client_secret' => 'C4fFVeFPkISEDQ8acNo9oSHUd8yIGuvoLWJdX9zY',
'username' => '[email protected] ',
'password' => '323423',
'partner' => 'lPxLuxfiTotCyZ1ZnQjMepUL24HLd05ybNBhVGFN'
];
$supership->retrieveToken($params);
$supership->getProvinces();
$provinceCode = '79';
$supership->getDistricts($provinceCode);
$districtCode = '777';
$supership->getCommunes($districtCode);
bash
composer