saeedvaziry/payir 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

saeedvaziry/payir

Composer 安装命令:

composer require saeedvaziry/payir

包简介

Pay.ir Laravel Package

README 文档

README

⚠️ This repository is archived and is not maintained anymore.

Please consider using Pay.ir PHP SDK instead

Pay.ir Laravel

Laravel package to connect to Pay.ir Payment Gateway

Installation

composer require saeedvaziry/payir

Publish Configurations

php artisan vendor:publish --provider="SaeedVaziry\Payir\PayirServiceProvider"

Config

Set your api key and redirect url in .env file:

PAYIR_API_KEY=test
PAYIR_REDIRECT=/payir/callback

Usage

Payment Controller

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use SaeedVaziry\Payir\Exceptions\SendException;
use SaeedVaziry\Payir\Exceptions\VerifyException;
use SaeedVaziry\Payir\PayirPG;

class PaymentController extends Controller
{
    public function pay()
    {
        $payir = new PayirPG();
        $payir->amount = 1000; // Required, Amount
        $payir->factorNumber = 'Factor-Number'; // Optional
        $payir->description = 'Some Description'; // Optional
        $payir->mobile = '0912XXXXXXX'; // Optional, If you want to show user's saved card numbers in gateway
        $payir->validCardNumber = '6219860000000000'; // Optional, If you want to limit the payable card

        try {
            $payir->send();

            return redirect($payir->paymentUrl);
        } catch (SendException $e) {
            throw $e;
        }
    }

    public function verify(Request $request)
    {
        $payir = new PayirPG();
        $payir->token = $request->token; // Pay.ir returns this token to your redirect url

        try {
            $verify = $payir->verify(); // returns verify result from pay.ir like (transId, cardNumber, ...)

            dd($verify);
        } catch (VerifyException $e) {
            throw $e;
        }
    }
}

Routes

Route::get('/payir/callback', 'PaymentController@verify');

Usage with facade

Config aliases in config/app.php :

'Payir' => SaeedVaziry\Payir\Facades\Payir::class

Send

Payir::send($amount, $redirect = null, $factorNumber = null, $mobile = null, $description = null);

Send2

Alternatively, You can use send2 method in facade to send optional data to Pay.ir

Payir::send2([
  'amount' => 10000,
  'redirect' => 'Your-Redirect-Url', // optional
  'factorNumber' => 'The-Factor-Number', // optional
  'mobile' => 'Mobile-Number', // optional
  'api' => 'API-Key', // optional, If you don't send this the package will read this from env
  'description' => 'Your-Description', // optional
  'validCardNumber' => 'Valid-Card-Number' // optional
]);

Verify

Payir::verify($token);

Security

If you discover any security related issues, please create an issue or email me (sa.vaziry@gmail.com)

License

This repo is open-sourced software licensed under the MIT license.

saeedvaziry/payir 适用场景与选型建议

saeedvaziry/payir 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.62k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2019 年 08 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「payir」 「SaeedVaziry」 「Saeed Vaziry」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 saeedvaziry/payir 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 saeedvaziry/payir 我们能提供哪些服务?
定制开发 / 二次开发

基于 saeedvaziry/payir 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 4.62k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 13
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-15