承接 jarir-ahmed/sslcommerz 相关项目开发

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

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

jarir-ahmed/sslcommerz

Composer 安装命令:

composer require jarir-ahmed/sslcommerz

包简介

SSLCommerz payment gateway PHP SDK — initiate payments, validate transactions, handle IPN. Built for Bangladesh's leading payment gateway.

README 文档

README

SSLCommerz Payment Gateway PHP SDK — initiate payments, validate transactions, handle IPN callbacks. Built for Bangladesh's leading payment gateway.

composer require jarir-ahmed/sslcommerz

Quick Start

use JarirAhmed\SSLCommerz\SSLCommerz;

$ssl = new SSLCommerz(
    storeId: 'your_store_id',
    storePassword: 'your_store_password',
    isLive: false // false = sandbox, true = production
);

Initiate Payment

$result = $ssl->initiate([
    'amount'          => 5000,
    'currency'        => 'BDT',
    'tran_id'         => $ssl->generateTransactionId('ORDER'),
    'product_name'    => 'Business SMS Package',
    'product_category' => 'Digital Service',
    'cus_name'        => 'John Doe',
    'cus_email'       => 'john@example.com',
    'cus_phone'       => '01712345678',
    'cus_add1'        => '12 Gulshan Avenue',
    'cus_city'        => 'Dhaka',
    'cus_country'     => 'Bangladesh',
    'success_url'     => 'https://example.com/payment/success',
    'fail_url'        => 'https://example.com/payment/fail',
    'cancel_url'      => 'https://example.com/payment/cancel',
    'ipn_url'         => 'https://example.com/payment/ipn',
]);

// Redirect customer to the gateway
header('Location: ' . $result['GatewayPageURL']);

Validate Transaction

// After payment callback, validate with val_id
$validation = $ssl->validate($_POST['val_id']);

if ($validation['status'] === 'VALID') {
    // Payment confirmed — activate order
}

Handle IPN

// In your IPN endpoint:
$ipn = $ssl->verifyIpn($_POST);

if ($ipn['verified']) {
    // Payment confirmed via IPN
}

API

__construct(string $storeId, string $storePassword, bool $isLive = false)

Create a new SSLCommerz instance. Use isLive: false for sandbox testing.

initiate(array $data): array

Start a payment session. Returns gateway URLs and session info.

Required fields: amount, tran_id, product_name, cus_name, cus_email, cus_phone, success_url, fail_url, cancel_url

validate(string $valId): array

Validate a completed transaction. Call this in your success handler.

verifyIpn(array $postData): array

Verify IPN callback data. Pass $_POST directly.

generateTransactionId(string $prefix = 'SSLCZ'): string

Generate a unique transaction ID.

isSandbox(): bool

Check if running in sandbox mode.

Environments

Mode API URL Validator URL
Sandbox sandbox.sslcommerz.com sandbox.sslcommerz.com/validator
Live securepay.sslcommerz.com securepay.sslcommerz.com/validator

Requirements

  • PHP 7.2+
  • ext-curl
  • ext-json

Testing

composer install
composer test

Manual API Testing

To test against the real sandbox:

$ssl = new SSLCommerz('your_sandbox_store_id', 'your_sandbox_password');
$result = $ssl->initiate([...]);
echo $result['GatewayPageURL']; // Open in browser

License

MIT

jarir-ahmed-sslcommerz

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固