deniztezcan/omnipay-ideal

iDeal driver for the Omnipay PHP payment processing library

1.6 2022-03-14 08:26 UTC

This package is auto-updated.

Last update: 2022-08-14 09:32:36 UTC


README

iDeal (PSP) driver for the Omnipay PHP payment processing library

Latest Stable Version Total Downloads Latest Unstable Version License

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.