fena / php-payment-sdk
用于与 Fena 支付 API 交互的 SDK。
v1.0.4
2021-09-05 14:23 UTC
Requires
- ext-json: *
- firebase/php-jwt: ^5.2
Requires (Dev)
- phpunit/phpunit: ^8
README
用于与 Fena 支付 API 交互的 SDK。
文档
完整文档可以在以下地址找到: https://docs.fena.co
要求
PHP 7.0.0 及更高版本。
安装
您可以通过 Composer 安装绑定。运行以下命令:
composer require fena/php-payment-sdk
要使用绑定,请使用 Composer 的自动加载。
require_once('vendor/autoload.php');
依赖
入门指南
简单的新支付看起来像这样
use Fena\PaymentSDK\Connection; use Fena\PaymentSDK\Payment; $connection = Connection::createConnection( $integrationId = '8afa74ae9fe8be53db50', $integrationSecret = '55d7d5ed-be22-4321-bb3f-aec8524d8be2' ); $payment = Payment::createPayment( $connection, $amount = '10.00' $reference = 'AA-11', ); $payment->process();
可选:为新支付设置用户或预选提供商
use Fena\PaymentSDK\Connection; use Fena\PaymentSDK\Payment; use Fena\PaymentSDK\Provider; use Fena\PaymentSDK\User; $connection = Connection::createConnection($terminalId, $terminalSecret); $payment = Payment::createPayment( $connection, $amount = '10.00', $reference = 'AA-11', ); $user = User::createUser( $email = 'john.doe@test.com', $firstName = 'John', $lastName = 'Doe', $contactNumber = '07000845953' ); $payment->setUser($user); $provider = Provider::createProvider( $providerId = 'lloyds-bank', $sortCode = '123456', $accountNumber = '12345678' ); $payment->setProvider($provider);