We are going to deploy the new yiiframework.com website on March 23, 2018 from 8:00 to 12:00 UTC.
Website and Yii documentation will not be available in this time frame. Check the news for more details.

Yii 2.0: omnikassa

Yii2 components for Rabobank omnikassa payments
1 follower

Yii2 omnikassa component

Full code @ github


The preferred way to install this extension is through composer.

To install, either run

$ php composer.phar require edofre/yii2-omnikassa "@dev"

or add

"edofre/yii2-omnikassa": "@dev"

to the require section of your composer.json file.


Add the components to the configuration

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',

Create the PaymentRequest object and create a form

$paymentRequest = new \edofre\omnikassa\PaymentRequest([
    'amount'               => 12354,
    'orderId'              => '123456789',
    'normalReturnUrl'      => \yii\helpers\Url::to(['site/return'], true),
    'transactionReference' => uniqid(),
<form method="post" action="<?= Yii::$app->omniKassa->url ?>">
    <input type="hidden" name="Data" value="<?= Yii::$app->omniKassa->dataField ?>">
    <input type="hidden" name="InterfaceVersion" value="<?= Yii::$app->omniKassa->interfaceVersion ?>">
    <input type="hidden" name="Seal" value="<?= Yii::$app->omniKassa->seal ?>">
    <?= \yii\helpers\Html::submitButton('Click here to make your payment', ['class' => 'btn btn-success']) ?>

Create the controller action you specified in the PaymentRequest and process the request

public function actionReturn()
    $response = Yii::$app->omniKassa->processRequest();
    var_dump('Pending', $response->isPending);
    var_dump('Successful', $response->isSuccessful);
    var_dump('Failure', $response->isFailure);

Don't forgot to disable CSRF protection for this action as it is an external action

public function beforeAction($action)
    if ($action->id == 'return') {
        $this->enableCsrfValidation = false;
    return parent::beforeAction($action);

Be the first person to leave a comment

Please to leave your comment.

Create extension
No downloadable files yet