Download the PHP package unipay/unipay-bd without Composer
On this page you can find all versions of the php package unipay/unipay-bd. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package unipay-bd
UniPay BD โ Unified Bangladesh Payment Gateway for Laravel
The ultimate unified Laravel payment gateway package for Bangladeshi Mobile Financial Services (MFS) & Payment Gateways.
๐ Table of Contents
- Overview
- Supported Payment Gateways
- Key Features
- Requirements
- Installation
- Configuration
- Quick Start & Usage
- 1. Initiate Payment
- 2. Handle Payment Callbacks & Webhooks
- 3. Listen to Payment Events
- 4. Process Refunds
- 5. Query Payment Status
- Extending with Custom Drivers
- Exception & Error Handling
- Testing
- Security
- License
๐ Overview
UniPay BD (unipay/unipay-bd) provides a seamless, developer-friendly driver-based payment integration for Laravel applications operating in Bangladesh.
Inspired by Laravel's native driver pattern (FilesystemManager, CacheManager), UniPay allows developers to integrate bKash, Nagad, Rocket, Upay, CellFin, SSLCommerz, and Shurjopay using a single, normalized API syntax.
Instead of writing fragmented, gateway-specific API logic for each payment provider, UniPay BD normalizes all request payloads and response structures (PaymentResponse) across all Bangladeshi payment gateways.
๐ณ Supported Payment Gateways
UniPay BD natively supports 7 Bangladeshi payment providers:
| Gateway | Driver | MFS / Provider | Security & Protocol | Supported Operations |
|---|---|---|---|---|
| bKash | bkash |
bKash PGW | Tokenized REST API v1.2 with Bearer token caching | Create, Execute, Query, Refund |
| Nagad | nagad |
Nagad | RSA OpenSSL Public Key Encryption & Private Key Signing | Create, Complete, Verify, Refund |
| Rocket | rocket |
Dutch-Bangla Bank (DBBL) | Merchant API v1 with Terminal ID | Create, Verify, Refund |
| Upay | upay |
UCB Fintech | Bearer Token REST API | Create, Verify, Refund |
| CellFin | cellfin |
Islami Bank (IBBL) | Reference ID Checkout API | Create, Verify, Refund |
| SSLCommerz | sslcommerz |
SSL Wireless | GWProcess v4 API & Validation API | Create, Validate, Refund |
| Shurjopay | shurjopay |
ShurjoMukhi | Shurjopay API v2 Tokenized | Create, Verify, Refund |
โจ Key Features
- ๐ฏ Unified Manager Architecture: Easily switch payment drivers on the fly using
Payment::driver('bkash'),Payment::driver('nagad'), etc. - ๐ฆ Normalized DTO Responses: Unified
PaymentResponseobject guarantees identical property access (status,paymentId,transactionId,amount,redirectUrl,rawResponse). - ๐ Automated Callback & Webhook System: Built-in callback engine at
/unipay/callback/{gateway}handles payment redirects and webhooks automatically. - ๐ Native Laravel Events: Fires
PaymentSucceeded,PaymentFailed, andPaymentRefundedevents for decoupled application logic. - ๐ Enterprise RSA & Token Security: In-memory token caching for bKash and PKCS1 RSA encryption for Nagad merchant onboarding.
- ๐ Transaction Logging: Automatic logging of payment requests, status updates, and raw gateway JSON payloads to your database.
- ๐ ๏ธ Artisan Installation CLI: Publish configs and database migrations with
php artisan unipay:install.
โ๏ธ Requirements
- PHP:
^8.1 || ^8.2 || ^8.3 - Laravel:
^10.0 || ^11.0 - PHP Extensions:
ext-json,ext-openssl,ext-curl
๐ฆ Installation
Install the package via Composer:
Run the Artisan installer to publish the configuration file and database migrations:
๐ง Configuration
Add your payment gateway credentials to your application's .env file:
๐ป Quick Start & Usage
1. Initiate Payment
To start a checkout process, build a PaymentRequest and call Payment::createPayment():
2. Handle Payment Callbacks & Webhooks
UniPay automatically registers a unified callback route at /unipay/callback/{gateway}.
When a customer completes payment, the MFS provider redirects back to this endpoint. UniPay automatically executes status verification and dispatches Laravel events.
3. Listen to Payment Events
Decouple your order processing logic by listening to UniPay events in App\Providers\EventServiceProvider.php:
Inside your event listener class:
4. Process Refunds
To issue a full or partial refund to a customer:
5. Query Payment Status
Query any transaction status explicitly at any time:
๐ ๏ธ Extending with Custom Drivers
You can easily register custom gateway drivers using Payment::extend():
โ ๏ธ Exception & Error Handling
UniPay provides a clean exception hierarchy:
Unipay\BD\Exceptions\UnipayException: Base exception class.Unipay\BD\Exceptions\InvalidGatewayException: Thrown when requesting an unsupported gateway.Unipay\BD\Exceptions\BkashApiException: Thrown when bKash API returns invalid credentials or auth errors.Unipay\BD\Exceptions\NagadEncryptionException: Thrown when OpenSSL RSA keys or signatures fail.Unipay\BD\Exceptions\PaymentVerificationFailedException: Thrown on failed payment checksums.
๐งช Testing
UniPay BD includes a full Pest & PHPUnit test suite with 100% mocked HTTP responses and OpenSSL key pair generation.
Run the test suite:
Expected output:
๐ Security
If you discover any security-related issues, please email [email protected] instead of using the public issue tracker.
๐ License
UniPay BD is open-sourced software licensed under the MIT License.
Crafted with โค๏ธ for the Bangladeshi Developer Community.
All versions of unipay-bd with dependencies
illuminate/support Version ^10.0 || ^11.0
illuminate/contracts Version ^10.0 || ^11.0
guzzlehttp/guzzle Version ^7.5
ext-json Version *
ext-openssl Version *