定制 projovi/proesewa 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

projovi/proesewa

Composer 安装命令:

composer require projovi/proesewa

包简介

Pro Esewa - A simple laravel package to integrate esewa payment.

README 文档

README

This Laravel package allows you to create payment using Esewa.

Usage/Examples

Install Using Composer

composer require projovi/proesewa

Add One Variable in .env

You can get marchant id from Esewa

ESEWA_MERCHANT_ID="Esewa Merchant Id"
ESEWA_ENV = "Sandbox" or "Live"

Publish Vendor File

php artisan vendor:publish --provider="Projovi\ProEsewa\EsewaServiceProvider"

or

php artisan vendor:publish

And publish "Projovi\ProEsewa\EsewaServiceProvider"

Redirect the user to payment page from your controller

use Projovi\ProEsewa\ProEsewa;

//Your Controller Method
public function esewaPayment()
{
    //Store payment details in DB with pending status
    $payment = new ProEsewa();
    $amount = 123; 
    $order_id = 251264889; //Your Unique Order Id
    $tax_amount = 0; //Tax Amount. If there is not tax amount then keep it 0
    $service_charge = 0; // Serivce Charge. If there is no service charge then keep it 0
    $delivery_charge = 0; // Delivery Charge. If there is no delivery charge then keep it 0.
    $su = route('success.url);
    $fu = route('fail.url);
    return redirect($payment->esewaCheckout($amount,$tax_amount,$service_charge,$delivery_charge,$order_id,$su,$fu))
}

After Successfull Payment esewa will redirect the user to your success url and you can change the payment status to Success else you can change the status to Fail when esewa redirect user to fail url.

Success Payment Case

public function esewaSuccess(Request $request)
{
    $order_id = $request->oid;
    $payment = Payment::where('order_id', $order_id)->first();
    $payment->status = "Success";
    $payment->save();

    //Other Tasks
           
}

Fail Payment Case

public function esewaFail(Request $request)
{
    $payment = Payment::where('order_id', $request->oid)->first();
    $payment->status = "Fail";
    $payment->save();
    //Other Tasks           
}

License

MIT

Author

Support

For support, email developers@projovi.co.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-04