securionpay / securionpay-php
此包已被废弃且不再维护。未建议替代包。
SecurionPay PHP 库
v2.6.0
2022-10-28 08:36 UTC
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2023-12-22 14:29:35 UTC
README
此库已过时。请使用 Shift4 PHP 库。
SecurionPay PHP 库
如果您还没有 SecurionPay 账户,您可以在 这里 创建。
安装
Composer
最佳使用此库的方式是通过 Composer。
为此,您需要将此配置添加到您的 composer.json
{ "require": { "securionpay/securionpay-php": "^2.5.0" } }
然后,要使用此库,您可以使用 Composer 的自动加载器
require_once('vendor/autoload.php');
手动安装
如果您不想使用 Composer,则可以下载 最新版本。
然后,要使用此库,您可以将自动加载器配置为从 lib/
目录加载类,或使用包含的自动加载器
require_once 'lib/SecurionPay/Util/SecurionPayAutoloader.php'; \SecurionPay\Util\SecurionPayAutoloader::register();
快速入门示例
use SecurionPay\SecurionPayGateway; use SecurionPay\Exception\SecurionPayException; $gateway = new SecurionPayGateway('sk_test_[YOUR_SECRET_KEY]'); $request = array( 'amount' => 499, 'currency' => 'EUR', 'card' => array( 'number' => '4242424242424242', 'expMonth' => 11, 'expYear' => 2022 ) ); try { $charge = $gateway->createCharge($request); // do something with charge object - see https://securionpay.com/docs/api#charge-object $chargeId = $charge->getId(); } catch (SecurionPayException $e) { // handle error response - see https://securionpay.com/docs/api#error-object $errorType = $e->getType(); $errorCode = $e->getCode(); $errorMessage = $e->getMessage(); }
文档
有关更多信息,请参阅我们官方文档: https://securionpay.com/docs。