deniztezcan / omnipay-ideal
iDeal driver for the Omnipay PHP payment processing library
Fund package maintenance!
deniztezcan
Installs: 30 779
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 5
Open Issues: 0
Requires
- ext-openssl: *
- league/omnipay: ^3.2
- nesbot/carbon: 2.*
- spatie/array-to-xml: ^3
Requires (Dev)
- omnipay/tests: ^4
README
iDeal (PSP) driver for the Omnipay PHP payment processing library
Omnipay 3.x is a framework agnostic, multi-gateway payment processing library for PHP 5.6+
Please consider sponsoring me if this repo has saved you a lot of time 😀
Table of Contents
Installation
Omnipay is installed via Composer.
composer require deniztezcan/omnipay-ideal:^1
List iDeal Issuers
use Omnipay\Omnipay; $gateway = Omnipay::create('iDeal'); $gateway->setAcquirer('YOUR_BANK'); $gateway->setMerchantId('MERCHANT_ID'); $gateway->setSubId('SUB_ID'); $gateway->setPrivateKeyPassphrase('PASSPHRASE'); $gateway->setPrivateKeyPath('PATH_TO_PRIVATE_KEY'); $gateway->setPrivateCerPath('PATH_TO_PRIVATE_CER'); $request = $gateway->fetchIssuers(); $response = $request->send();
This gives you an array of Issuers
:
$response->getIssuers();
Do a Payment
use Omnipay\Omnipay; $gateway = Omnipay::create('iDeal'); $gateway->setAcquirer('YOUR_BANK'); $gateway->setMerchantId('MERCHANT_ID'); $gateway->setSubId('SUB_ID'); $gateway->setPrivateKeyPassphrase('PASSPHRASE'); $gateway->setPrivateKeyPath('PATH_TO_PRIVATE_KEY'); $gateway->setPrivateCerPath('PATH_TO_PRIVATE_CER'); $request = $gateway->purchase(['issuer' => 'ISSUER', 'amount' => 99.99, 'currency' => 'EUR', 'returnUrl' => 'RETURN_URL', 'transactionId' => 'PURCHASE_ID', 'description' => 'DESCRIPTION']); $response = $request->send();
To properly handle the response
if ($response->isRedirect()) { // redirect to offsite payment gateway $response->redirect(); } else { // payment failed: display message to customer echo $response->getConsumerMessage(); }
Complete a Payment
use Omnipay\Omnipay; $gateway = Omnipay::create('iDeal'); $gateway->setAcquirer('YOUR_BANK'); $gateway->setMerchantId('MERCHANT_ID'); $gateway->setSubId('SUB_ID'); $gateway->setPrivateKeyPassphrase('PASSPHRASE'); $gateway->setPrivateKeyPath('PATH_TO_PRIVATE_KEY'); $gateway->setPrivateCerPath('PATH_TO_PRIVATE_CER'); $request = $gateway->completePurchase(['transactionReference' => 'TRANSACTION_REFERENCE']); $response = $request->send();
To properly handle the response
if ($response->isSuccessful()) { // payment was successful: update database print_r($response); } else { // payment failed: display message to customer echo $response->getConsumerMessage(); }
Support
If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.
If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.