承接 xentixar/esewa-sdk 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

xentixar/esewa-sdk

最新稳定版本:v1.0.03

Composer 安装命令:

composer require xentixar/esewa-sdk

包简介

README 文档

README

This PHP SDK provides a simple interface to integrate Esewa payment gateway functionality into your application. With this SDK, you can easily configure payment details, generate payment forms, decode responses, and validate transactions using Esewa's APIs.

Installation

You can install this SDK via Composer. Run the following command in your terminal:

composer require xentixar/esewa-sdk

To generate the autoloader, run the following command in your terminal:

composer dump-autoload

Usage

Configuration

  • To configure the Esewa payment details, you can use the config method:
use Xentixar\EsewaSdk\Esewa;

$esewa = new Esewa();
$esewa->config('https://your-success-url.com', 'https://your-failure-url.com', 1000.00, 'your-transaction-uuid')

Initialize Payment Form

Development Environment

  • To generate a payment form for the development environment, use the init method without any parameters:
$esewa->init();

Production Environment

  • To generate a payment form for the production environment, use the init method with the $production parameter set to true:
$esewa->init(true);

Decode Response

  • After the payment process, you can decode the Esewa response using the decode method:
$responseData = $esewa->decode();

Validate Transaction

  • You can validate a transaction using the validate method:
$response = $esewa->validate('1000.00', 'your-transaction-uuid', true);

Methods:

config(string $success_url, string $failure_url, float $amount, string $transaction_uuid, string $product_code = 'EPAYTEST', string $secret_key = '8gBm/:&EnhH.1/q', float $tax_amount = 0, float $product_service_charge = 0, float $product_delivery_charge = 0)

  • Configures Esewa payment details.

init(bool $production = false)

  • Initializes the payment form for either the development or production environment based on the $production flag.

decode(): ?array

  • Decodes Esewa response, if the data parameter is set in the GET request.

validate(string $total_amount, string $transaction_uuid, bool $production = false, string $product_code = 'EPAYTEST'): string

  • Validates the transaction by making a cURL request to check the transaction status based on provided parameters.

Security Note:

  • Ensure that the secret key is stored securely and not exposed in your codebase or version control system.
  • When dealing with transactions and security, always ensure that you validate transaction responses to ensure authenticity and avoid fraudulent transactions.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固