rudraramesh/esewa-payment 问题修复 & 功能扩展

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

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

rudraramesh/esewa-payment

Composer 安装命令:

composer require rudraramesh/esewa-payment

包简介

A Laravel package designed to simplify the integration of the eSewa payment gateway into your Laravel applications. This package provides an easy-to-use solution for handling online payments with eSewa, one of Nepal's leading payment gateways. It supports initiating payments, verifying transactions,

README 文档

README

Current Version: v2.0.0

Latest Version on Packagist License: MIT

A Laravel package for seamless integration of the eSewa payment gateway, the leading online payment solution in Nepal. Easily accept online payments in your Laravel application using eSewa, with secure server-to-server verification and customizable success/failure pages.

Features

  • Laravel eSewa payment gateway integration
  • Supports online payments in Nepal
  • Secure server-to-server transaction verification
  • Easy configuration and setup
  • Customizable success and failure views
  • Compatible with Laravel 9, 10, 11, 12 and PHP 7.4, 8.x
  • Extensible: fires events on payment success/failure

Installation

  1. Install the Package:

    composer require rudraramesh/esewa-payment
  2. Publish Configuration and Views

    php artisan vendor:publish --provider="Rbb\ESewaPayment\Providers\ESewaPaymentServiceProvider" --tag=config
    php artisan vendor:publish --provider="Rbb\ESewaPayment\Providers\ESewaPaymentServiceProvider" --tag=views

    This will copy the config file to config/esewa.php and the views to resources/views/vendor/esewa-payment/ so you can customize them.

  3. Add Configuration to .env

    ESEWA_ENVIRONMENT=sandbox # or live
    ESEWA_MERCHANT_CODE=your_merchant_code
    ESEWA_API_KEY=your_api_key
    ESEWA_API_PASSWORD=your_api_password
    ESEWA_SUCCESS_URL=https://your-site.com/esewa/success
    ESEWA_FAILED_URL=https://your-site.com/esewa/failure
    ESEWA_CALLBACK_URL=https://your-site.com/esewa/callback

Configuration File

The package uses config/esewa.php to manage settings like the merchant code, API credentials, environment, and URLs for payment success, failure, and callback.

Usage

1. Routes

The package automatically registers the following routes (with prefix esewa.):

Method URI Name Description
POST /esewa/payment esewa.payment Initiate payment
POST /esewa/callback esewa.callback Handle eSewa callback
GET /esewa/success esewa.success Success redirect (optional)
GET /esewa/failure esewa.failure Failure redirect (optional)

2. Initiate Payment

Send a POST request to /esewa/payment with amount and order_id:

$response = Http::post('/esewa/payment', [
    'amount' => 1000,
    'order_id' => 'ORDER123',
]);

Or, from a form:

<form method="POST" action="/esewa/payment">
    @csrf
    <input type="number" name="amount" required />
    <input type="text" name="order_id" required />
    <button type="submit">Pay with eSewa</button>
</form>

3. Handle Callback

The package will handle the callback from eSewa and perform server-to-server verification. On success/failure, it will redirect to the configured URLs.

4. Customizing Views

The package provides default success and failure views that use standalone HTML and Bootstrap for styling. You can customize these views after publishing:

  • resources/views/vendor/esewa-payment/success.blade.php
  • resources/views/vendor/esewa-payment/failure.blade.php

You can edit these files to match your application's look and feel. There is no dependency on any specific layout.

5. Events

Listen for payment events in your application:

Event::listen('esewa.payment.success', function ($payload) {
    // Handle payment success
});
Event::listen('esewa.payment.failed', function ($payload) {
    // Handle payment failure
});

Sandbox/Live Environment

Set ESEWA_ENVIRONMENT=sandbox for testing, or live for production. The package will use the correct endpoints automatically.

Error Handling

  • Input is validated before initiating payment.
  • All errors are logged using Laravel's logger.
  • Server-to-server verification is performed for security.

Links

Contributing

Feel free to fork the repository and create pull requests. Please follow best practices and write tests if you add new features.

License

This package is open-sourced under the MIT License. See the LICENSE File for more information.

rudraramesh/esewa-payment 适用场景与选型建议

rudraramesh/esewa-payment 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 01 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 rudraramesh/esewa-payment 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-30