承接 sadiq-bd/bkash-payment-gateway 相关项目开发

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

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

sadiq-bd/bkash-payment-gateway

Composer 安装命令:

composer require sadiq-bd/bkash-payment-gateway

包简介

Bkash Payment Gateway for PHP

README 文档

README

View Counter

bKash Payment Gateway PHP

A well-structured and secure PHP library to integrate bKash payment processing into your application. Provides robust API handling for bKash Merchant operations.

Features

  • Easy integration with bKash Merchant API
  • Handles payment creation, execution, query, refund, and more
  • Structured request and response handling
  • Exception handling for API errors
  • Sandbox and production mode switch
  • Example scripts included

Installation

composer require sadiq-bd/bkash-payment-gateway

Configuration

Set up your credentials and environment using the provided static setter methods. You can use the sample example.config.php file as a template.

use Sadiq\BkashMerchantAPI\BkashMerchantAPI;

// Set callback URL (for execute payment)
BkashMerchantAPI::setCallBackUrl('https://yourdomain.com/executepayment.php');

// Set your bKash credentials
BkashMerchantAPI::setAppKey('your_app_key');
BkashMerchantAPI::setAppSecret('your_app_secret');
BkashMerchantAPI::setUsername('your_username');
BkashMerchantAPI::setPassword('your_password');

// Enable sandbox mode (set to false for production)
BkashMerchantAPI::sandBoxMode(true);

Usage

Token Generation

Before creating a payment, you need to generate a grant token. See token.php and example.config.php for sample token generation logic.

Creating a Payment

Below is an example based on the actual createpayment.php flow:

use Sadiq\BkashMerchantAPI\BkashMerchantAPI;
use Sadiq\BkashMerchantAPI\Exception\BkashMerchantAPIException;

// Assume configuration and token generation (see example.config.php and token.php)
session_start();
$token = $_SESSION['token'];

$amount = 100; // BDT
$invoice = strtoupper(uniqid());
$reference = "CustomerReference";

try {
    $bkash = new BkashMerchantAPI;
    $bkash->setGrantToken($token);
    if ($resp = $bkash->createPayment($amount, $invoice, $reference)) {
        // Optional: log response
        // prependFileLog(log_file, "\n\n- Create Payment\n{$resp->getResponse()}\n\n");
        $bkash->redirectToPayment($resp);
    }
} catch (BkashMerchantAPIException $e) {
    die($e->getMessage());
}
  • The user will be redirected to bKash for payment approval.

Executing a Payment

After user approval, bKash will redirect back to your callback URL (e.g. executepayment.php). That file will handle execution.

Example Directory Structure

  • src/BkashMerchantAPI/ — Core library classes
  • public/ — Example entry points / demo scripts (createpayment.php, executepayment.php, index.php, etc.)
  • example.config.php — Example configuration file
  • token.php — Example for grant token management
  • README.md — Documentation
  • composer.json — Package definition

Exception Handling

All API errors throw BkashMerchantAPIException for robust error management.

Logging

To enable logging, create a file named gateway.log.txt in your project root. Logging is supported via the prependFileLog function (see example.config.php).

Security

  • Never expose your credentials in public repositories.
  • Always use HTTPS.
  • Rotate credentials regularly.

License

MIT

Support

For issues and feature requests, please use the GitHub Issues page.

More Information

sadiq-bd/bkash-payment-gateway 适用场景与选型建议

sadiq-bd/bkash-payment-gateway 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 42 次下载、GitHub Stars 达 4, 最近一次更新时间为 2024 年 02 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 sadiq-bd/bkash-payment-gateway 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-04