1. Go to this page and download the library: Download aminkt/yii2-payment-module 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/ */
aminkt / yii2-payment-module example snippets
'payment' => [
'class' => aminkt\yii2\payment\Payment::class,
'minAmount' => 100, // Min availbale money that can pay by gates.
// If you want, same as minAmount you can set maxAmount.
'maxAmount' => 1000000,
// In Development you can uncomment below line to enable by pass mode.This config will pass the gates.
// 'enableByPass' => true,
'orderClass' => \common\models\Order::class, Your order model class name.
// Add this part to add your own gates.
'components' => [
'payment' => [
'class' => aminkt\yii2\payment\components\Payment::class,
// Uncomment below line if you wnat change you default callback address.
// 'callback' => ['/v1/payment/verify'],
'bankTimeout' => 60 * 30, // Max time user can be in bank site.
'encryptKey' => 'wumBOOH04e', // This key will used to generate security token
'blockTime' => 10, // How many times system allow to a user have risky actions.
'gates' => [
'Parsian' => [
'class' => \aminkt\yii2\payment\gates\Parsian::class,
'identityData' => [
'pin' => 'x8Xd1tR4So8kL50d3EV1',
'terminal' => '92133477'
]
],
'BehPardakht' => [
'class' => \aminkt\yii2\payment\gates\MellatGate::class,
'identityData' => [
'terminalId' => '****',
'userName' => '****',
'password' => '****',
'payerId' => 0,
'webService' => 'https://bpm.shaparak.ir/pgwchannel/services/pgw?wsdl',
'bankGatewayAddress' => 'https://bpm.shaparak.ir/pgwchannel/startpay.mellat',
]
],
]
]
]
]
$payment = \aminkt\payment\Payment::getInstance()->payment;
$payment->callback = ['/your-controller/your-action']; // callBack give an array defined a route.
$verify = Payment::getInstance()
->getPayment()
->verify();
if($verify) {
// Payment was successfull.
} else {
// Paymen verify become failed.
}