finbricks/finbricks-php-sdk

Finbricks 开放API产品的SDK

1.2.0 2021-11-04 17:26 UTC

This package is auto-updated.

Last update: 2024-09-04 23:45:25 UTC


README

APIs

  • auth - 认证API。所有以/auth/结尾的端点
  • info - 所有以/account/结尾的端点
  • platform - 平台数据
  • eshop - 电子商务
  • status - 支付提供商列表及其状态、故障等
  • recurring_payment - 定期支付API

基本使用

安装

Finbricks SDK可以通过composer安装

    composer require finbricks/finbricks-php-sdk

设置

  • 准备私钥和merchantId,调用API需要这些数据

使用

创建基本客户端

$encryptor = new AsymmetricEncryptor($key="here is your private key.");
$client = (new FinbricksClient($encryptor))->getClient();
$authApiConfiguration = new  Configuration(); // All api have configuration please be sure you import the correct one
$authApiConfiguration->setHost("https://api.zaplaceno.cleverlance.com"); // Here paste where is API server (sandbox or prod)
$authApi = new AuthApi($this->client, $authApiConfiguration); // Instantiate SDK with client and configuration.

调用API

在上一个步骤中,您已经得到了SDK的工作实例(在我们的例子中是AuthApi)。现在,您可以简单地调用方法来获取信息或进行交易。

$req = new AuthenticateRequest(); // Create a class of request 
$req->setScope(Enums::AISP_PISP); // You can use Enums class for scopes
$req->setClientId("someClientId");
$req->setCallbackUrl("http://google.com");
$req->setProvider("KB");
$req->setMerchantId("4d605d8e-4c31-43eb-bf8b-0ce041d4ef1b"); // Here is your merchantID

// Make a call of api and receive response
$response = $this->authApi->authAuthenticatePost("", $req); // If you generate a client with AsymmetricEncryptor then you dont need to paste signature. Fill it with empty string.