PHPackages                             jarir-ahmed/sslcommerz - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. jarir-ahmed/sslcommerz

ActiveLibrary[Payment Processing](/categories/payments)

jarir-ahmed/sslcommerz
======================

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

v1.0.0(1mo ago)01MITPHPPHP &gt;=7.2

Since Jul 9Pushed 1mo agoCompare

[ Source](https://github.com/jarir2020/jarir-ahmed-sslcommerz)[ Packagist](https://packagist.org/packages/jarir-ahmed/sslcommerz)[ RSS](/packages/jarir-ahmed-sslcommerz/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

sslcommerz
==========

[](#sslcommerz)

**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
-----------

[](#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

[](#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

[](#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

[](#handle-ipn)

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

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

---

API
---

[](#api)

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

[](#__constructstring-storeid-string-storepassword-bool-islive--false)

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

### `initiate(array $data): array`

[](#initiatearray-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`

[](#validatestring-valid-array)

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

### `verifyIpn(array $postData): array`

[](#verifyipnarray-postdata-array)

Verify IPN callback data. Pass `$_POST` directly.

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

[](#generatetransactionidstring-prefix--sslcz-string)

Generate a unique transaction ID.

### `isSandbox(): bool`

[](#issandbox-bool)

Check if running in sandbox mode.

---

Environments
------------

[](#environments)

ModeAPI URLValidator URLSandbox`sandbox.sslcommerz.com``sandbox.sslcommerz.com/validator`Live`securepay.sslcommerz.com``securepay.sslcommerz.com/validator`---

Requirements
------------

[](#requirements)

- PHP 7.2+
- `ext-curl`
- `ext-json`

---

Testing
-------

[](#testing)

```
composer install
composer test
```

### Manual API Testing

[](#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
-------

[](#license)

MIT

jarir-ahmed-sslcommerz
======================

[](#jarir-ahmed-sslcommerz)

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance90

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

47d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/20700f34ff813055154e843bbdbe04d33320c1e6a81bbb3301cad67cb8350fd3?d=identicon)[jarircse16](/maintainers/jarircse16)

---

Top Contributors

[![jarir2020](https://avatars.githubusercontent.com/u/175597633?v=4)](https://github.com/jarir2020 "jarir2020 (1 commits)")

---

Tags

paymentgatewayrocketbkashnagadbangladeshsslcommerz

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jarir-ahmed-sslcommerz/health.svg)

```
[![Health](https://phpackages.com/badges/jarir-ahmed-sslcommerz/health.svg)](https://phpackages.com/packages/jarir-ahmed-sslcommerz)
```

###  Alternatives

[lucassmacedo/omnipay-mercadopago

MercadoPago gateway for OmniPay

155.7k](/packages/lucassmacedo-omnipay-mercadopago)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
