PHP code example of edofre / yii2-omnikassa
1. Go to this page and download the library: Download edofre/yii2-omnikassa 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/ */
edofre / yii2-omnikassa example snippets
return [
...
'components' => [
'omniKassa' => [
'class' => '\edofre\omnikassa\OmniKassa',
'automaticResponse' => false,
'currencyCode' => '978',
'interfaceVersion' => 'HP_1.0',
'keyVersion' => '1',
'merchantId' => '002020000000001',
'paymentMeanBrandList' => 'IDEAL,VISA,MASTERCARD,MAESTRO',
'secretKey' => '002020000000001_KEY1',
'testMode' => true,
'url' => 'https://payment-webinit.simu.omnikassa.rabobank.nl/paymentServlet',
],
...
],
...
];
$paymentRequest = new \edofre\omnikassa\PaymentRequest([
'amount' => 12354, // Amount in cents, 12345 = 123,45
'orderId' => 'your-order-id',
'normalReturnUrl' => \yii\helpers\Url::to(['site/return'], true),
'transactionReference' => "your-transaction-reference",
]);
Yii::$app->omniKassa->prepareRequest($paymentRequest);
public function actionReturn()
{
$response = Yii::$app->omniKassa->processRequest();
var_dump($response->attributes);
var_dump('Pending', $response->isPending);
var_dump('Successful', $response->isSuccessful);
var_dump('Failure', $response->isFailure);
}
public function beforeAction($action)
{
if ($action->id == 'return') {
$this->enableCsrfValidation = false;
}
return parent::beforeAction($action);
}
$ php composer.phar
HTML+PHP
<form method="post" action="<?= Yii::$app->omniKassa->url