PHP code example of shippodeveloper / shippo-sdk-php-client

1. Go to this page and download the library: Download shippodeveloper/shippo-sdk-php-client 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/ */

    

shippodeveloper / shippo-sdk-php-client example snippets


$config = new \ShippoSDK\Config([
    'access_token' => 'your access token',
    'base_uri' => 'https://apix.shippo.vn', // or https://sandbox-apix.shippo.vn for sandbox mode
]);
$client = new \ShippoSDK\Client($config);

$deliveryOrderEP = new \ShippoSDK\Endpoints\DeliveryOrderEndpoint($client);
$param = [
    'pickupAddressId' => 100022031,
    'services' => [
        'insurance' => [
            'amount' => 1000000, //bảo hiểm với số tiền 1 triệu đồng
        ]
    ],
    'goods' => [],
    'chargeType' => 'SENDER',
    'deliveryPackage' => 'STC',
    'merchantOrderCode' => 'MOC_0001',
    'merchantPrivateNote' => 'Freddie Mercury is gay',
    'code' => '380000',
    'deliveryNote' => '',
    'receiverPhone' => '0380987654',
    'receiverName' => 'Brian May',
    'deliverDetailAddress' => 'Fist Aid 1985',
    'deliverLocationId' => 18, //Ba Đình
    'pickupNote' => 'Đến gọi cho Mary Austin'
];
$order = $deliveryOrderEP->create($param);