Yii2 Iranian SEP Payment Gateway extension
By this extension you can add SEP gateway to your yii2 project, (*1)
Installation
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist ahmadrezaei/yii2-sep "*"
or add, (*4)
"ahmadrezaei/yii2-sep": "*"
to the require section of your composer.json
file., (*5)
Configuring application
After extension is installed you need to setup auth client collection application component:, (*6)
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:, (*7)
php yii migrate -p=@vendor/ahmadrezaei/yii2-sep/src/migrations
Usage
For create a payment request:, (*8)
$amount = 1000; // Rial
$callBackUrl = Url::to(['callback'], true); // callback url
Yii::$app->sep->createPayment($amount, $callBackUrl);
For verify payment request:, (*9)
$sep = Yii::$app->sep;
if( $sep->verify() ) {
// payment is successfull
$transactionID = $sep->RefNumber;
} else {
// payment is unsuccessfull
}