PHP code example of mamadali / yii2-zarinpal-v4

1. Go to this page and download the library: Download mamadali/yii2-zarinpal-v4 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/ */

    

mamadali / yii2-zarinpal-v4 example snippets


        'zarinpal' => [
            'class' => 'mamadali\zarinpal\Zarinpal',
            'merchant_id' => مرچنت کد دریافتی از زرین پال,
            'callback_url' => آدرس صفحه بازگشت کاربر از درگاه,
            'testing' => true, // اگر درحال تست درگاه هستید true در غیر اینصورت این قسمت را کامنت کنید
        ],

$zarinpal = Yii::$app->zarinpal;
$result = $zarinpal->request($amount, $description, $mobile, $email, $card_pan, $additional_params);

$this->redirect($zarinpal->redirectUrl);

$zarinpal = Yii::$app->zarinpal;
$result = $zarinpal->verify($amount, $authority);