dwivedianuj9118/phonepe-laravel 问题修复 & 功能扩展

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

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

dwivedianuj9118/phonepe-laravel

Composer 安装命令:

composer require dwivedianuj9118/phonepe-laravel

包简介

Laravel PhonePe Integration- Laravel PhonePe Payment gateway Integration package

README 文档

README

Package Image

PhonePe Laravel Integration (PhonePe Payment Gateway)

This Laravel package allows you to integrate PhonePe payment on your Laravel Application easily.

Contributing

Pull requests are more than welcome. I have created with clean code and developer and begginer user friendly for easy to use and implement also i have tested our code many time its better for use.

If you are using any other payment methods, please create a pull request with your solution, and I will merge it.

Installation

composer require dwivedianuj9118/phonepe-payment-gateway dev-main

Add the required variables in the .env file:

APP_ENV="local" //local or production

Publish the vendor file for configuration:

php artisan vendor:publish --provider="Dwivedianuj9118\PhonePeLaravel\PhonePeLaravelServiceProvider"

open phonepe.config file and modify details with local and production environment variable

Usage generate payment link:

Redirect the user to the payment page from your controller:

<?php

use Dwivedianuj9118\PhonePeLaravel\PhonePeLaravel;

// Your Controller Method
public function phonePePayment()
{
    $phonepe = new PhonePeLaravel();
    // amount, phone number, callback URL, unique merchant transaction id
    $response = $phonepe->doPayment(1000, '9999999999', 'http://localhost:8000/redirect-url', '1');
    if($response->success == true){
         return redirect()->away($response->url);
    }
    else
    {
        // check $response array to find message  
    }
   
}

PhonePe check status api

After Successful Payment, PhonePe will redirect to your callback URL with the transaction ID and status. You can check the payment status using the transaction ID.

<?php

use Dwivedianuj9118\PhonePeLaravel\PhonePeLaravel;
use Illuminate\Http\Request;

public function callBackResponse(Request $request)
{
    $phonepe = new PhonePeLaravel();
    $response = $phonepe->getPaymentStatus($request->all());
    if($response->success == true){
        // Payment Success
        // use $response array for save detail or update
    }
    else
    {
        // Payment Failed           
    }
}

PhonePe refund api

    use Dwivedianuj9118\PhonePeLaravel\PhonePeLaravel;
    use Illuminate\Http\Request;
    
    public function refundPayment(Request $request)
    {
        $phonepe = new PhonePeLaravel();
        $response = $phonepe->refundPayment($request->all());
        if($response->success == true){
            // Payment refund
            //$response->state , $response->message, $response->status,  $response->state
            // use above details in array of refund method
        }
        else
        {
            // Payment Failed
            //  display $response->message
        }
    }

Official Documentation

Documentation can be found on my website.

License

MIT

Author

Support

For support, email dwivedianuj9118[at]gmail[dot]com.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-22