webtoucher / omnipay-rbkmoney
RBK.money支付处理库的驱动程序
dev-master
2019-01-22 04:57 UTC
Requires
- php: >=5.4.0
- ext-openssl: *
- omnipay/common: ~2.0
Requires (Dev)
- omnipay/tests: ~2.0
This package is auto-updated.
Last update: 2024-09-23 20:52:05 UTC
README
RBK.money支付处理库的驱动程序。
安装
安装此库的首选方式是通过composer。
运行以下命令
$ php composer.phar require webtoucher/omnipay-rbkmoney "*"
或者将以下内容添加到你的composer.json
文件的require
部分:
"webtoucher/omnipay-rbkmoney": "*"
to the require
section of your composer.json
file.
使用方法
配置API客户端
$gateway = \Omnipay\Omnipay::create('RbkMoney'); $gateway->setShopId('[SHOP_ID]'); $gateway->setApiKey('[API_PRIVATE_KEY]'); $gateway->setLogger(function ($message, $level = 'info') { // You can add logging for your requests });
然后你可以创建发票。
$cart = new \Omnipay\RbkMoney\Cart; $cart->addItem(new \Omnipay\RbkMoney\CartItem('Some product', 100)); $cart->addItem(new \Omnipay\RbkMoney\CartItem('Another product', 200, 1, 20)); $request = $gateway->createInvoice([ 'cart' => $cart, 'currency' => 'RUB', 'transactionId' => 1234, 'product' => "Заказ 1234", ]); try { $response = $request->send(); if ($response->isSuccessful()) { // Your handler } } catch (\Omnipay\Common\Exception\OmnipayException $e) { // Your handler }
支持
如果你在使用Omnipay时遇到一般性问题,我们建议你在Stack Overflow上发布。请务必添加omnipay标签,以便更容易找到。
如果你想保持对发布公告的更新,讨论项目想法或提出更详细的问题,还有一个你可以订阅的邮件列表。
如果你认为你发现了一个错误,请使用GitHub问题跟踪器进行报告。