定制 g2a/integration-api-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

g2a/integration-api-client

Composer 安装命令:

composer require g2a/integration-api-client

包简介

G2A Integration API client

README 文档

README

Client library allows to integrate with G2A.COM Integration API
Web site: https://www.g2a.com/integration-api/

Documentation

Go to https://www.g2a.com/integration-api/documentation/

Requirements

Installation

Package is published on Packagist

Add project dependency:

composer require g2a/integration-api-client

Usage

Creating API client

<?php

require __DIR__ . '/../vendor/autoload.php';

$config = new \G2A\IntegrationApi\Model\Config(
    'sandboxapitest@g2a.com',
    'sandboxapi.g2a.com',
    'qdaiciDiyMaTjxMt',
    'b0d293f6-e1d2-4629-8264-fd63b5af3207b0d293f6-e1d2-4629-8264-fd63b5af3207'
);

$g2aApiClient = new \G2A\IntegrationApi\Client($config);

`

Basic Example

<?php

require __DIR__ . '/../vendor/autoload.php';

$config = new \G2A\IntegrationApi\Model\Config(
    'sandboxapitest@g2a.com',
    'sandboxapi.g2a.com',
    'qdaiciDiyMaTjxMt',
    'b0d293f6-e1d2-4629-8264-fd63b5af3207b0d293f6-e1d2-4629-8264-fd63b5af3207'
);
    
$g2aApiClient = new \G2A\IntegrationApi\Client($config);

// add an order
$request = new G2A\IntegrationApi\Request\OrderAddRequest($g2aApiClient);
$request
    ->setProductId('10000037846002')
    ->setCurrency('USD')
    ->setMaxPrice(45.12)
    ->call();

$response = $request->getResponse();

echo 'Order ID: ' . $response->getOrderId() . PHP_EOL;

See examples directory for more use cases

Get products

<?php
// …
$request = new \G2A\IntegrationApi\Request\ProductsListRequest($g2aApiClient);
$request
    ->setPage(1)
    ->setMinQty(5)
    ->call();

$response = $request->getResponse();

foreach ($response->getProducts() as $product) {
    echo $product->getId() . ' ' . $product->getName() . PHP_EOL;
}

Add an order

<?php
// …
$request = new G2A\IntegrationApi\Request\OrderAddRequest($g2aApiClient);
$request
    ->setProductId('10000037846002')
    ->setCurrency('USD')
    ->setMaxPrice(45.12)
    ->call();

$response = $request->getResponse();

echo 'Order ID: ' . $response->getOrderId() . PHP_EOL;

Pay for rder

<?php
// …
$request = new G2A\IntegrationApi\Request\OrderPaymentRequest($g2aApiClient);
$request
    ->setOrderId(1532096834)
    ->call();

$response = $request->getResponse();

echo 'Payment transaction ID: ' . $response->getTransactionId() . PHP_EOL;
echo 'Payment status: ' . $response->getStatus() . PHP_EOL;

Get order details

<?php
// …
$request = new \G2A\IntegrationApi\Request\OrderDetailsRequest($g2aApiClient);
$request
    ->setOrderId(1532096834)
    ->call();

$response = $request->getResponse();

echo 'Order status: ' . $response->getStatus() . PHP_EOL;
echo 'Price: ' . $response->getPrice() . PHP_EOL;
echo 'Currency: ' . $response->getCurrency() . PHP_EOL;

Get order key

<?php
// …
$request = new \G2A\IntegrationApi\Request\OrderKeyRequest($g2aApiClient);
$request
    ->setOrderId(1532096834)
    ->call();

$response = $request->getResponse();

echo 'Order key: ' . $response->getKey() . PHP_EOL;

Sandbox credentials

API Hash: qdaiciDiyMaTjxMt
API Key: 74026b3dc2c6db6a30a73e71cdb138b1e1b5eb7a97ced46689e2d28db1050875

Commands

Code quality

Execute PHPUnit tests

make test

Code style

Requires PHP for CLI installed. Execute in root directory

make csfixer

Run examples

The following command will send example requests to sandbox environment

make run-examples

License

PHP client for Integration API of G2A.COM is released under the MIT license

Support

Contact us on G2A Support Hub

统计信息

  • 总下载量: 1.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 2
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2018-07-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固