yc-hwc/php-shopee

PHP shopee v2 SDK

1.0.2 2022-05-22 08:29 UTC

This package is auto-updated.

Last update: 2024-06-10 10:43:19 UTC


README

php shopee v2 SDK

安装教程

composer require yc-hwc/php-shopee

用法

配置

    $config = [
        'shopeeUrl'   => 'https://partner.test-stable.shopeemobile.com',
        'partnerId'   => '',
        'partnerKey'  => '',
        'accessToken' => '',
        'shopId'      => '',
    ];
    
    $shopeeSDK = \PHPShopee\ShopeeSDK::config($config);

店铺授权

    $config = [
        'shopeeUrl'  => 'https://partner.test-stable.shopeemobile.com',
        'partnerId'  => 'xxxxxxx',
        'partnerKey' => 'xxxxxxxxxxxxxx',
    ];

    $shopeeSDK = \PHPShopee\ShopeeSDK::config($config);
    $fullUrl = $shopeeSDK->shopAuth()
        ->api('auth_partner')
        ->withQueryString([
            'redirect' => 'https://www.baidu.com/',
        ])
        ->fullUrl();

    return redirect($fullUrl);  

generate first mile tracking number

    $config = [
        'shopeeUrl'   => 'https://partner.test-stable.shopeemobile.com',
        'partnerId'   => '',
        'partnerKey'  => '',
        'accessToken' => '',
        'shopId'      => '',
    ];
    
    $params = [
        'declare_date' => '',
        'quantity'     => 1,
        'seller_info' => [
            'name'    => "tom",
            'address' => "xxxxxxx",
            'region'  => "CN",
            'zipcode' => "1xxxx15",
            'phone'   => "186xxxxxx49"
        ]
    ]
    
    $shopeeSDK = \PHPShopee\ShopeeSDK::config($config);
    $response = $shopeeSDK->firstMile
    ->api('generate_firstMile_tracking_number')
    ->withBody($params)
    ->post();
    
    print_r($response);