zvps/ebay-sell-logistics-php-client

注意:这是一个(限量发布)API,仅向由业务部门批准的选定的开发者提供。物流API资源提供以下功能:shipping_quote – 将一组实时运费或报价合并成一个列表,您可以从中选择一个运费来运输包裹

dev-main 2021-07-30 16:32 UTC

This package is auto-updated.

Last update: 2024-09-29 05:43:14 UTC


README

注意:这是一个(限量发布)API,仅向由业务部门批准的选定的开发者提供。物流API资源提供以下功能:shipping_quote – 将一组实时运费或报价合并成一个列表,您可以从中选择一个运费来运输包裹。shipment – 为选定的运费创建一个“货物运输”订单。调用createShippingQuote以获取实时运费列表。返回的运费都适用于特定的时间窗口,并且所有报价价格都是通过eBay协商的。选择一个实时运费,并使用其关联的rateId,通过调用createFromShippingQuote创建一个“货物运输”订单。创建货物运输订单完成协议,基本服务和任何附加的运费选项的成本总和为返回的totalShippingCost值。此操作还会生成一个运输标签,您可以使用它来运输包裹。使用提供的运输标签运输包裹时,将产生运输费用。重要!卖家必须通过他们的eBay账户设置支付方式,才能使用此API中的方法创建货物运输订单和相关运输标签。

安装与使用

需求

PHP 7.2及更高版本。

Composer

要使用Composer安装绑定,请将以下内容添加到composer.json

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github/zvps/ebay-sell-logistics-php-client.git"
    }
  ],
  "require": {
    "zvps/ebay-sell-logistics-php-client": "*@dev"
  }
}

然后运行composer install

手动安装

下载文件并包含autoload.php

<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

入门

请按照安装过程进行操作,然后运行以下命令

<?php
require_once(__DIR__ . '/vendor/autoload.php');



// Configure OAuth2 access token for authorization: Authorization Code
$config = Ebay\Sell\Logistics\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Ebay\Sell\Logistics\Api\ShipmentApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$shipment_id = 'shipment_id_example'; // string | This path parameter specifies the unique eBay-assigned ID of the shipment to be canceled. The shipmentId value is generated and returned by a call to createFromShippingQuote.

try {
    $result = $apiInstance->cancelShipment($shipment_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ShipmentApi->cancelShipment: ', $e->getMessage(), PHP_EOL;
}

API端点

所有URI都是相对于 https://api.ebay.com/sell/logistics/v1_beta

模型

授权

授权码

测试

要运行测试,使用

composer install
vendor/bin/phpunit

作者

关于此包

此PHP包是由OpenAPI Generator项目自动生成的

  • API版本:v1_beta.0.0
    • 包版本:5.0.0
  • 构建包:org.openapitools.codegen.languages.PhpClientCodegen