PHP code example of deniztezcan / omnipay-ideal
1. Go to this page and download the library: Download deniztezcan/omnipay-ideal library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
deniztezcan / omnipay-ideal example snippets
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();
$response->getIssuers();
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();
if ($response->isRedirect()) {
// redirect to offsite payment gateway
$response->redirect();
} else {
// payment failed: display message to customer
echo $response->getConsumerMessage();
}
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();
if ($response->isSuccessful()) {
// payment was successful: update database
print_r($response);
} else {
// payment failed: display message to customer
echo $response->getConsumerMessage();
}