zerogrey/axerve-php

1.0.2 2020-10-15 04:40 UTC

This package is not auto-updated.

Last update: 2024-09-26 23:55:29 UTC


README

为PHP制作的Axerve API客户端

此PHP包由Axerve Codegen项目自动生成

  • API版本:1.0.0
  • 构建包:io.axerve.codegen.v3.generators.php.PhpClientCodegen

要求

PHP 5.5及以上

安装与使用

Composer

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

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

然后运行composer install

手动安装

下载文件并包含autoload.php

    require_once('/path/to/AxerveClient-php/vendor/autoload.php');

测试

要运行单元测试

composer install
./vendor/bin/phpunit

入门

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

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

// Configure API key authorization: ApiKeyAuth
$config = Axerve\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Axerve\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Axerve\Client\Api\PaymentApi(
    // 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
);
$body = new \Axerve\Client\Model\Body(); // \Axerve\Client\Model\Body | 

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

$apiInstance = new Axerve\Client\Api\PaymentApi(
    // 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()
);
$body = new \Axerve\Client\Model\CancelPaymentRequestModel(); // \Axerve\Client\Model\Body6 | 

try {
    $apiInstance->apiV1PaymentCancelPost($body);
} catch (Exception $e) {
    echo 'Exception when calling PaymentApi->apiV1PaymentCancelPost: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Axerve\Client\Api\PaymentApi(
    // 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()
);
$body = new \Axerve\Client\Model\Body4(); // \Axerve\Client\Model\Body4 | 

try {
    $apiInstance->apiV1PaymentCapturePost($body);
} catch (Exception $e) {
    echo 'Exception when calling PaymentApi->apiV1PaymentCapturePost: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Axerve\Client\Api\PaymentApi(
    // 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()
);
$body = new \Axerve\Client\Model\CreatePaymentModel(); // \Axerve\Client\Model\Body1 | 

try {
    $result = $apiInstance->create($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling PaymentApi->apiV1PaymentCreatePost: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Axerve\Client\Api\PaymentApi(
    // 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()
);
$payment_id = "payment_id_example"; // string | 
$language_id = "language_id_example"; // string | 
$payment_token = "payment_token_example"; // string | 

try {
    $result = $apiInstance->apiV1PaymentMethodsPaymentIdLanguageIdGet($payment_id, $language_id, $payment_token);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling PaymentApi->apiV1PaymentMethodsPaymentIdLanguageIdGet: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Axerve\Client\Api\PaymentApi(
    // 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()
);
$body = new \Axerve\Client\Model\Body5(); // \Axerve\Client\Model\Body5 | 

try {
    $apiInstance->apiV1PaymentRefundPost($body);
} catch (Exception $e) {
    echo 'Exception when calling PaymentApi->apiV1PaymentRefundPost: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Axerve\Client\Api\PaymentApi(
    // 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()
);
$body = new \Axerve\Client\Model\SubmitPaymentModel(); // \Axerve\Client\Model\Body3 | 
$payment_token = "payment_token_example"; // string | 

try {
    $apiInstance->submit($body, $payment_token);
} catch (Exception $e) {
    echo 'Exception when calling PaymentApi->apiV1PaymentSubmitPost: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Axerve\Client\Api\PaymentApi(
    // 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()
);
$body = new \Axerve\Client\Model\Body2(); // \Axerve\Client\Model\Body2 | 

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

// Configure API key authorization: ApiKeyAuth
$config = Axerve\Client\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Axerve\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');

$apiInstance = new Axerve\Client\Api\PaymentApi(
    // 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
);
$shop_login = "shop_login_example"; // string | 

try {
    $result = $apiInstance->apiV1ShopMethodsShopLoginGet($shop_login);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling PaymentApi->apiV1ShopMethodsShopLoginGet: ', $e->getMessage(), PHP_EOL;
}
?>

API端点文档

所有URI都是相对于https://sandbox.gestpay.net

模型文档

授权文档

ApiKeyAuth

  • 类型:API密钥
  • API密钥参数名:Authorization
  • 位置:HTTP头

作者