PHPackages                             crtv/yii2-robokassa - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. crtv/yii2-robokassa

ActiveYii2-extension

crtv/yii2-robokassa
===================

Robokassa payment extension.

021PHP

Since Nov 28Pushed 10y ago1 watchersCompare

[ Source](https://github.com/crtv/yii2-robokassa)[ Packagist](https://packagist.org/packages/crtv/yii2-robokassa)[ RSS](/packages/crtv-yii2-robokassa/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

yii2-robokassa
==============

[](#yii2-robokassa)

Install via Composer
--------------------

[](#install-via-composer)

```
composer require crtv/yii2-robokassa

```

Configuration
-------------

[](#configuration)

```
'components' => [
    'robokassa' => [
        'class' => '\robokassa\Merchant',
        'baseUrl' => 'https://auth.robokassa.ru/Merchant/Index.aspx',
        'sMerchantLogin' => '',
        'sMerchantPass1' => '',
        'sMerchantPass2' => '',
        'sMerchantTestPass1' => '',
        'sMerchantTestPass2' => '',
        'isTest' => 0, // or 1
    ]
    ...
]
```

Example
-------

[](#example)

```
class PaymentController extends Controller
{
    public function actionInvoice()
    {
        $model = new Invoice();
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            /** @var \robokassa\Merchant $merchant */
            $merchant = Yii::$app->get('robokassa');
            return $merchant->payment($model->sum, $model->id, 'Пополнение счета', null, Yii::$app->user->identity->email);
        } else {
            return $this->render('invoice', [
                'model' => $model,
            ]);
        }
    }

	/**
	 * @inheritdoc
	 */
    public function actions()
    {
        return [
            'result' => [
                'class' => '\robokassa\ResultAction',
                'callback' => [$this, 'resultCallback'],
            ],
            'success' => [
                'class' => '\robokassa\SuccessAction',
                'callback' => [$this, 'successCallback'],
            ],
            'fail' => [
                'class' => '\robokassa\FailAction',
                'callback' => [$this, 'failCallback'],
            ],
        ];
    }

	/**
	 * Callback.
     * @param \robokassa\Merchant $merchant merchant.
     * @param integer $nInvId invoice ID.
     * @param float $nOutSum sum.
     * @param array $shp user attributes.
	 */
    public function successCallback($merchant, $nInvId, $nOutSum, $shp)
    {
        $this->loadModel($nInvId)->updateAttributes(['status' => Invoice::STATUS_ACCEPTED]);
        return $this->goBack();
    }
    public function resultCallback($merchant, $nInvId, $nOutSum, $shp)
    {
        $this->loadModel($nInvId)->updateAttributes(['status' => Invoice::STATUS_SUCCESS]);
        return 'Ok';
    }
    public function failCallback($merchant, $nInvId, $nOutSum, $shp)
    {
        $model = $this->loadModel($nInvId);
        if ($model->status == Invoice::STATUS_PENDING) {
            $model->updateAttributes(['status' => Invoice::STATUS_FAIL]);
            return 'Ok';
        } else {
            return 'Status has not changed';
        }
    }

    /**
     * @param integer $id
     * @return Invoice
     * @throws \yii\web\BadRequestHttpException
     */
    protected function loadModel($id) {
        $model = Invoice::find($id);
        if ($model === null) {
            throw new BadRequestHttpException;
        }
        return $model;
    }
}
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/85b9dce89ccc88a84065561a7b3a0e9137ab77af0ab80b8062b782ff78ed005d?d=identicon)[crtv](/maintainers/crtv)

---

Top Contributors

[![crtv](https://avatars.githubusercontent.com/u/1057869?v=4)](https://github.com/crtv "crtv (5 commits)")

### Embed Badge

![Health badge](/badges/crtv-yii2-robokassa/health.svg)

```
[![Health](https://phpackages.com/badges/crtv-yii2-robokassa/health.svg)](https://phpackages.com/packages/crtv-yii2-robokassa)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
