- How do I install and configure laravel-bkash in a Laravel application?
- Install it with composer require sabitahmad/laravel-bkash, then publish the migrations and config using php artisan vendor:publish for the laravel-bkash-migrations and laravel-bkash-config tags. Run php artisan migrate and set BKASH_APP_KEY, BKASH_APP_SECRET, BKASH_USERNAME, BKASH_PASSWORD, BKASH_SANDBOX, and callback/base URL values in .env. The published config controls sandbox mode, transaction logging, credentials, and base URLs.
- Which Laravel and PHP versions does sabitAhmad/laravel-bkash support?
- The README lists PHP 8.0+ and Laravel 8.x+ as requirements, while the technical evaluation describes modern Laravel 9.x+ stacks. Check the package constraints and test on your exact Laravel version before adopting it.
- How do I switch laravel-bkash between sandbox and production mode?
- Set BKASH_SANDBOX=true for sandbox testing and false for production, and provide the matching bKash credentials and base URLs. Keep the callback URL environment-specific so sandbox and live payments return to the correct endpoint. The package reads these values through config/laravel-bkash.php and your .env file.
- What is the difference between regular checkout and tokenized checkout in laravel-bkash?
- Regular checkout follows bKash's traditional payment flow, while tokenized checkout uses agreement management to support faster or recurring payments. Use tokenized checkout when you need saved agreements for subscribers; use regular checkout for one-off payments. Both flows are supported through the Bkash facade and API v1.2.0 operations.
- How does laravel-bkash handle bKash token refresh and retries?
- The package includes advanced token management with automatic refresh and retry mechanisms, plus network resilience through retries and timeout handling. Token behavior is configurable, including cache-related settings such as BKASH_TOKEN_CACHE_TTL. Review those settings carefully because token misconfiguration can interrupt payment flows.
- How do I handle the bKash callback URL in Laravel with this package?
- The package provides a structured /bkash/callback endpoint, and you should configure BKASH_CALLBACK_URL to a secure, environment-specific URL. In testing, validate callback handling with mock webhooks and sandbox payments. Use the PaymentCompleted and PaymentFailed events to trigger order updates or notifications after callbacks.
- Does laravel-bkash log transactions to the database for auditing?
- Yes. The package includes migrations for transaction logging with enhanced tracking, and logging can be controlled with BKASH_LOG_TRANSACTIONS. These records support audit trails and debugging, but financial or regulatory compliance may still require additional controls and retention policies.
- What events does laravel-bkash fire for payments and agreements?
- The package fires Laravel events including PaymentCompleted, PaymentFailed, and AgreementCreated. You can listen for these events to decouple order processing, notifications, and other workflows, including queued jobs.
- Is sabitAhmad/laravel-bkash safe for production use with bKash API v1.2.0?
- It is an unofficial, MIT-licensed package that is actively maintained, with a recent release noted as 2025-09-24. It abstracts bKash API v1.2.0 and includes sandbox/production separation, exception handling, retries, and event support. Risks include dependence on bKash API changes, token/callback misconfiguration, and limited adoption, so test thoroughly in sandbox and monitor production.
- Can I use laravel-bkash for refunds, payment queries, and agreement cancellation?
- Yes. The package supports payment create, execute, query, refund, and search operations, plus agreement create, execute, query, and cancel. These operations are exposed through the Bkash facade with detailed BkashException error handling.