mrcarb0n / laravel-bkash-pgw
bKash PGW (Tokenized Checkout) integration for Laravel: payments, refunds, agreements, payouts, webhooks
v1.0.0
2026-09-08 20:07 UTC
Requires
- php: >=7.4
- ext-json: *
- ext-openssl: *
- guzzlehttp/guzzle: ^7.0
- illuminate/cache: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/config: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/console: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/contracts: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/http: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/routing: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/support: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/view: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- orchestra/testbench: ^6.0|^7.0|^8.0|^9.0
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^9.0|^10.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-08 20:09:32 UTC
README
bKash PGW (Tokenized Checkout) integration for Laravel — payments, refunds, agreements, payouts, webhooks.
Features
- Payments — create, execute (idempotent), query, search
- Refunds — full or partial, up to 10 per transaction, with status lookup
- Agreements — saved-wallet mandates for PIN-only recurring charges
- Payouts — B2C disbursement and B2B merchant transfers (initiate/disburse/query)
- Webhooks — AWS SNS signature verification, auto-subscription, event dispatch
- Callbacks — redirect handler executes the payment and fires events
- Token cache — one grant per account, auto-refresh, lock against duplicate grants
- Error codes — 150+ bKash codes mapped to readable messages
Requirements
- PHP 7.4+
- Laravel 6+
- Guzzle 7+
- bKash merchant account (developer.bka.sh)
Installation
composer require mrcarb0n/laravel-bkash-pgw php artisan bkash:install
Copy the variables from .env.example into your app's .env and fill in your sandbox credentials — see docs/installation.md.
Verify connectivity:
php artisan bkash:test-sandbox
Quick start
use Tiash\LaravelBkash\Facades\Bkash; $response = Bkash::payment()->create([ 'mode' => '0011', 'payerReference' => 'ORDER_123', 'callbackURL' => route('bkash.callback'), 'amount' => 100.00, 'currency' => 'BDT', 'intent' => 'sale', 'merchantInvoiceNumber' => 'INV_123', ]); return redirect($response['bkashURL']);
Fulfil orders by listening for PaymentCompleted — full flow in docs/payments.md.
Documentation
| Doc | Contents |
|---|---|
| Installation | install, config, multi-account, cache store |
| Payments | create/execute/query/search, callback flow, events |
| Refunds | full/partial refunds, status, error codes |
| Agreements | saved-wallet mandate lifecycle |
| Payouts | B2C disbursement, B2B initiate/disburse/query |
| Webhooks | SNS verification, events, transaction types |
| Error handling | exceptions, error code map, retry behavior |
| Going live | production checklist |
Testing
composer test # 42 tests vendor/bin/phpstan analyse --no-progress # static analysis php artisan bkash:test-sandbox # live sandbox smoke test
Changelog
See CHANGELOG.md.
Security
If you find a vulnerability, open a private security advisory instead of a public issue.
License
MIT — see LICENSE.