liquido-brl/payin-php-sdk

用于请求 Liquido BR Virgo API 的类。

0.0.8 2023-03-15 19:53 UTC

README

这是一个用于 PHP 应用程序方便地连接 Liquido BR PayIn API 的库。

安装

您可以将以下内容添加到您的 composer.json 文件中,以将此库作为依赖项下载。例如:

"require": {
    "liquido-brl/payin-php-sdk": "0.0.4"
},

使用

现在您只需要使用以下示例中的 PHP

use \LiquidoBrl\PayInPhpSdk\Util\Config;
use \LiquidoBrl\PayInPhpSdk\Util\Brazil\PaymentMethod;
use \LiquidoBrl\PayInPhpSdk\Util\PaymentFlow;
use \LiquidoBrl\PayInPhpSdk\Model\PayInRequest;
use \LiquidoBrl\PayInPhpSdk\Service\PayInService;
use \LiquidoBrl\PayInPhpSdk\Util\Country;
use \LiquidoBrl\PayInPhpSdk\Util\Currency;

...

$isLiveMode = false;

$config = new Config(
    [
        'clientId' => "your client id",
        'clientSecret' => "your client secret",
        'apiKey' => "your api key"
    ],
    $isLiveMode
);

$payInRequest = new PayInRequest([
    "idempotencyKey" => "your idempotency key",
    "amount" => 100,
    "currency" => Currency::BRL,
    "country" => Country::BRAZIL,
    "paymentMethod" => PaymentMethod::PIX_STATIC_QR,
    "paymentFlow" => PaymentFlow::DIRECT,
    "callbackUrl" => "your callback url",
    "payer" => [
        "email" => "your customer email"
    ],
    "description" => "Product A",
    ...
]);

$payInService = new PayInService();
$payInResponse = $payInService->createPayIn($config, $payInRequest);