rpay/pokpay-payments-sdk

PokPay的Checkout REST API的PHP SDK

1.4.1 2023-05-08 13:07 UTC

This package is auto-updated.

Last update: 2024-09-08 15:45:29 UTC


README

PokPay的Checkout REST API的PHP SDK

安装与使用

要求

PHP 7.3及以后版本。也应在PHP 8.0上运行,但尚未测试。

Composer

$ composer require rpay/pokpay-payments-sdk

手动安装

下载文件并包含autoload.php

<?php
require_once('/path/to/pok-payments-sdk/vendor/autoload.php');

使用API密钥登录

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

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

// Create the configuration for the API calls
// getDefaultConfiguration accepts a parameter to specify whether the production environment is used
// By default the staging environment is used
// The same configuration is later used for all the other API classes
$config = RPay\POK\PaymentsSdk\Configuration::getDefaultConfiguration(true);

$apiInstance = new RPay\POK\PaymentsSdk\Api\AuthApi(
    $config,
    new GuzzleHttp\Client(),
);

$keyId = 'PokPay Key Id';
$keySecret = 'PokPay Key Secret';

$payload = new \RPay\POK\PaymentsSdk\Model\LoginSdkPayload($keyId, $keySecret); // \RPay\POK\PaymentsSdk\Model\LoginSdkPayload

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

API端点

所有URI在生产环境中均相对于https://api.pokpay.io,在预发布环境中相对于https://api-staging.pokpay.io

模型

授权

jwt

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

测试

要运行测试,请使用

composer install
vendor/bin/phpunit

作者

RPay Ltd

关于此包

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

  • API版本: 1.0.0
  • 构建包: org.openapitools.codegen.languages.PhpClientCodegen