channelengine/api-client-php

此包已被废弃,不再维护。作者建议使用 merchant-api-client-php 包代替。

ChannelEngine API 商家版本

2.13.0 2022-09-09 09:46 UTC

README

No Maintenance Intended

Merchant API 客户端库的弃用

此库不再由 ChannelEngine 支持。要使用您选择的编程语言通过 OpenAPI 生成器构建自己的库,请参阅我们帮助中心的 Merchant API: API clients 文章。

ChannelEngine 的 API 遵循 OpenAPI/Swagger 规范,您可以在我们的 API 参考 中找到这些规范。

开发人员更多信息

有关 ChannelEngine API 的详细信息,请访问我们帮助中心的 REST APIs 类别

安装 & 使用

Composer

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

{
  "require": {
    "channelengine/merchant-api-client-php": "*"
  }
}

然后运行 composer install

入门

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

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

use ChannelEngine\Merchant\ApiClient\Configuration;
use ChannelEngine\Merchant\ApiClient\ApiException;
use ChannelEngine\Merchant\ApiClient\Api\OrderApi;

$apiConfig = Configuration::getDefaultConfiguration();
$apiConfig->setHost('https://demo.channelengine.net/api');
$apiConfig->setApiKey('apikey', 'xxxxxxxxxxxx');

$orderApi = new OrderApi(null, $apiConfig);

try {
	$response = $orderApi->orderGetNew();
	dd($response);
} catch (ApiException $e) {
	// In case of a non-2xx status an exception will be trown.
	// However, we can check getResponseBody() to get the deserialized response.
	echo($e->getMessage());
	dd($e->getResponseBody());
}

function dd($var) {
	echo("<pre>");
	print_r($var);
	echo("</pre>");
}