ahmadrezaei/yii2-sep

By this extension you can add SEP gateway to your yii2 project

Installs: 17

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

v1.0 2017-10-25 15:47 UTC

This package is auto-updated.

Last update: 2024-05-08 21:50:08 UTC


README

By this extension you can add SEP gateway to your yii2 project

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist ahmadrezaei/yii2-sep "*"

or add

"ahmadrezaei/yii2-sep": "*"

to the require section of your composer.json file.

Configuring application

After extension is installed you need to setup auth client collection application component:

return [
    'components' => [
        'sep' => [
            'class' => 'ahmadrezaei\yii\sep\components\Sep',
            'MerchantID' => 'YOUR-MID',
            'Password' => 'YOUR-PASSWORD',
            'mysql' => true, // If you want to save records in db
        ]
        // ...
    ],
    // ...
];

If you want to save records in database, create migrations:

php yii migrate -p=@vendor/ahmadrezaei/yii2-sep/src/migrations 

Usage

For create a payment request:

$amount = 1000; // Rial
$callBackUrl = Url::to(['callback'], true); // callback url
Yii::$app->sep->createPayment($amount, $callBackUrl);

For verify payment request:

$sep = Yii::$app->sep;
if( $sep->verify() ) {
    // payment is successfull
    $transactionID = $sep->RefNumber;
} else {
    // payment is unsuccessfull
}