ampeco/omnipay-fibank
最新稳定版本:1.3.2
Composer 安装命令:
composer require ampeco/omnipay-fibank
包简介
Omnipay plugin for fibank ECOMM recurring payments
README 文档
README
Omnipay plugin for fibank ECOMM recurring payments
Installation
composer require ampeco/omnipay-fibank
Getting started
Create the gateway
$gateway = Omnipay::create('\Ampeco\OmnipayFibank\Gateway'); $gateway->initialize([ 'merchantCertificate' => '... The PEM certificate you got from the bank', 'merchantCertificatePassword' => 'The Certificate Password', 'createCardAmount' => 1.00, // The amount and currency to use for the create account initial payment 'createCardCurrency' => 'BGN', 'testMode' => true, ]);
Add a new credit card
try{ $response = $gateway->createCard([ 'clientIp' => 'CLIENT IP ADDRESS', 'expiry' => date('Y-m-d', strtotime('+10 years')), 'description' => 'Register a new payment method. The amount will be credited to your account', ])->send(); } catch (EcommException $e) { abort(422, $e->getMessage()); } if (!$response->isSuccessful()) { abort(422, $response->getMessage()); } // You must redirect the client to: echo $response->getRedirectUrl(); echo $response->getTransactionId(); // The transaction ID assigned by the bank
Check if the client completed the card registration
$transactionReference = '1234567890'; // Fetched from above - $response->getTransactionId() try { $result = $gateway->transactionResult([ 'transactionId' => $transactionReference, 'clientIp' => 'CLIENT IP ADDRESS', ])->send(); } catch (EcommException $e) { abort(422, $e->getMessage()); } if (!$result->isSuccessful()){ abort(422, $result->getMessage()); } // The card reference echo $result->getCardReference(); // recurring_test_reference1234`
Charge the saved credit card reference
try { $cardReference = 'recurring_test_reference1234'; // saved from above - $result->getCardReference(); $response = $gateway->purchase([ 'cardReference' => $cardReference, 'amount' => 3, 'currency' => 'BGN', 'description' => 'Purchase #1234', ])->send(); } catch (EcommException $e) { abort(422, $e->getMessage()); } if ($response->isSuccessful()) { echo $response->getTransactionReference(); } else { abort(422, $response->getMessage()); }
统计信息
- 总下载量: 43.78k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-05-02