ahmadrezaei / yii2-sep

通过此扩展,您可以向您的yii2项目添加SEP网关

安装: 17

依赖者: 0

建议者: 0

安全性: 0

星星: 0

关注者: 2

分支: 0

开放问题: 0

类型:yii2-extension

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

This package is auto-updated.

Last update: 2024-09-08 22:33:09 UTC


README

通过此扩展,您可以向您的yii2项目添加SEP网关

安装

安装此扩展的首选方法是使用 composer

运行以下命令之一

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

或在您的 composer.json 文件的 require 部分添加

"ahmadrezaei/yii2-sep": "*"

配置应用程序

在扩展安装后,您需要设置 auth client collection 应用程序组件

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
        ]
        // ...
    ],
    // ...
];

如果您想将记录保存到数据库,请创建迁移

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

用法

创建支付请求

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

验证支付请求

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