renekorss / banklink
PHP banklink 库,用于轻松集成波罗的海银行链接。
v3.5.0
2023-03-28 14:38 UTC
Requires
- php: >=7.2
- ext-mbstring: *
- lib-openssl: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- php-coveralls/php-coveralls: ^2.5
- phpmd/phpmd: ^2.6
- phpunit/phpunit: ^9.4
- squizlabs/php_codesniffer: ^3.3
This package is auto-updated.
Last update: 2024-09-23 10:25:18 UTC
README
PHP 支付库
PHP 支付库,用于轻松集成波罗的海银行链接、电子商务网关(Estcard、Nets Estonia)、Liizi 支付链接和 Pocopay。
查看 API 文档:https://renekorss.github.io/Banklink/
安装
composer require renekorss/banklink
支持的提供商
如何使用?
更多信息请访问 Wiki。以下是一个基本示例。
安全警告
切勿将您的私钥和公钥存储在公开可访问的文件夹中。相反,将密钥放在根文件夹下(通常是
public_html
或www
)。如果您将密钥作为字符串存储在数据库中,则它们应仅通过 HTTPS 协议访问。
支付
<?php require __DIR__ . '/vendor/autoload.php'; use RKD\Banklink; // Init protocol $protocol = new Banklink\Protocol\IPizza( 'uid100010', // seller ID (VK_SND_ID) __DIR__ . '/../keys/seb_user_key.pem', // private key '', // private key password, leave empty, if not needed __DIR__ . '/../keys/seb_bank_cert.pem', // public key 'https:///banklink/SEB.php' // return url ); // Init banklink $seb = new Banklink\EE\SEB($protocol); // Set payment data and get payment request object // orderId, sum, message, language $request = $seb->getPaymentRequest(123453, 150, 'Test makse', 'EST'); // You can also add custom request data and/or override request data // Optional $request = $seb->getPaymentRequest(123453, 150, 'Test makse', 'EST', 'EUR', [ 'VK_REF' => 'my_custom_reference_number', // Override reference number 'INAPP' => true // Pocopay specific example ]); ?> <form method="POST" action="<?php echo $request->getRequestUrl(); ?>"> <?php echo $request->getRequestInputs(); ?> <input type="submit" value="Pay with SEB!" /> </form>
身份验证
<?php require __DIR__ . '/vendor/autoload.php'; use RKD\Banklink; // Init protocol $protocol = new Banklink\Protocol\IPizza( 'uid100010', // seller ID (SND ID) __DIR__ . '/../keys/seb_user_key.pem', // private key '', // private key password, leave empty, if not needed __DIR__ . '/../keys/seb_bank_cert.pem', // public key 'https:///banklink/SEB.php' // return url ); // Init banklink $seb = new Banklink\EE\SEB($protocol); // Get auth request object $request = $seb->getAuthRequest(); ?> <form method="POST" action="<?php echo $request->getRequestUrl(); ?>"> <?php echo $request->getRequestInputs(); ?> <input type="submit" value="Authenticate with SEB!" /> </form>
提供商的响应
<?php require __DIR__ . '/vendor/autoload.php'; use RKD\Banklink; // Init protocol $protocol = new Banklink\Protocol\IPizza( 'uid100010', // seller ID (SND ID) __DIR__ . '/../keys/seb_user_key.pem', // private key '', // private key password, leave empty, if not needed __DIR__ . '/../keys/seb_bank_cert.pem', // public key 'https:///banklink/SEB.php' // return url ); // Init banklink $seb = new Banklink\EE\SEB($protocol); // Get response object $response = $seb->handleResponse($_POST); // Successful if ($response->wasSuccessful()) { // Get whole array of response $responseData = $response->getResponseData(); // User prefered language $language = $response->getLanguage(); // Only for payment data $orderId = $response->getOrderId(); $sum = $response->getSum(); $currency = $response->getCurrency(); $sender = $response->getSender(); $transactionId = $response->getTransactionId(); $transactionDate = $response->getTransactionDate(); $message = $response->getMessage(); $automatic = $response->isAutomatic(); // true if response was sent automatically by bank // Only for auth data $userId = $response->getUserId(); // Person ID $userName = $response->getUserName(); // Person name $country = $response->getUserCountry(); // Person country $authDate = $response->getAuthDate(); // Authentication response datetime // Method used for authentication // Possible values: ID Card, Mobile ID, One-off code card, PIN-calculator, Code card or unknown $authMethod = $response->getAuthMethod(); // Failed } else { // Payment data $orderId = $response->getOrderId(); // Order id to cancel order etc. } ?>
任务
composer build
- 运行测试和所有代码检查进行构建composer test
- 运行测试composer format
- 标准格式化代码composer docs
- 构建 API 文档composer phpmd
- 运行 PHP Mess Detectorcomposer phpcs
- 运行 PHP CodeSniffer
许可
许可协议:MIT