Search by

mrcarb0n / laravel-bkash-pgw

MrCarb0n

bKash PGW (Tokenized Checkout) integration for Laravel: payments, refunds, agreements, payouts, webhooks

Package info

github.com/MrCarb0n/laravel-bkash-pgw

pkg:composer/mrcarb0n/laravel-bkash-pgw

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-09-08 20:07 UTC

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.

Packagist Version Packagist Downloads PHP Version Laravel Version License PHPStan

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

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.