webchemistry / thepay
此包最新版本(1.0.0)没有可用的许可信息。
1.0.0
2016-07-06 13:13 UTC
Requires
- php: >=5.5
Requires (Dev)
- codeception/codeception: ^2.1
- nette/di: ^2.3
- nette/http: ^2.3
- tracy/tracy: ^2.3
This package is auto-updated.
Last update: 2024-09-08 22:52:17 UTC
README
集成 支付网关thepay。此库 使用 他们的 组件,版本 3.2.2,2017年2月16日(您可以在 'lib' 目录中查看)
使用Nette安装
extensions: thePay: WebChemistry\ThePay\DI\ThePayExtension
使用Nette配置
thePay: merchantId: 1 accountId: 3 password: myPassword
不使用Nette配置
$config = [ 'merchantId' => 100, 'accountId' => 100, 'password' => 'pswd', 'dataApiPassword' => 'apiPswd' ]; $thepay = new WebChemistry\ThePay\ThePay($config);
显示支付组件
/** @var WebChemistry\ThePay\ThePay */ $thepay; $sender = $thePay->createSender(199); // Price $sender->setDescription('Super product'); // Description for easier identification in administration $sender->setMerchantData('Customer id is 150.'); // or $sender->setMerchantData([ 'customer' => 150 ]); echo $sender->render();
接收支付
/** @var WebChemistry\ThePay\ThePay */ $thepay; $receiver = $thepay->getReceiver(); if (!$receiver->verifySignature(FALSE)) { die('Bad request.'); } if (!$receiver->isSuccess()) { die('Payment was not successful.'); } // Get info from api $remotePayment = $receiver->getRemotePayment(); if ($remotePayment) { $remotePayment->getValue(); // Price }
永久支付
$payment = $thepay->createPermanent('merchantData', 'description', 'localhost/returnUrl.php'); $payment->getMethods(); // Array of methods with payment information