Download the PHP package softscholar/laravel-payments without Composer
On this page you can find all versions of the php package softscholar/laravel-payments. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download softscholar/laravel-payments
More information about softscholar/laravel-payments
Files in softscholar/laravel-payments
Package laravel-payments
Short Description Payment gateway service by SoftScholar
License MIT
Informations about the package laravel-payments
Laravel Payments by SoftScholar
Laravel Payments is a robust service package for integrating payment gateways into your Laravel application, developed by SoftScholar. This package currently supports Nagad (API v4.0.1) and bKash (Tokenized Checkout API v1.2.0-beta) payment gateways.
Table of Contents
- Installation
- Configuration
- Config File Structure
- Environment Variables
- Nagad Payment Gateway
- Nagad Workflow & API Usage
- Nagad Callback Example
- bKash Payment Gateway
- bKash API Guide
- bKash Token Management
- bKash Regular Checkout
- bKash Agreements (Tokenized Checkout)
- bKash Search & Query Payments
- bKash Refunds
- Supported Payment Gateways
- License
- Contributing
Installation
Install the package via Composer in your Laravel project directory:
Configuration
Publish the package configuration file to set up your payment gateway credentials:
This will publish the configuration file to config/spayment.php.
Config File Structure
The config/spayment.php configuration file contains setup sections for both Nagad and bKash:
Environment Variables
Add the following environment variables to your .env file and replace the values with credentials provided by your payment partners:
Nagad Payment Gateway
Nagad Workflow & API Usage
To initiate a payment using the Nagad gateway, you can call the checkout method on the Payment Facade. You can run regular checkout, authorization (for tokenized setups), or a tokenized payment.
Nagad Callback Example
Handle the redirect callback to verify the payment on your controller:
bKash Payment Gateway
bKash API Guide
The bKash integration uses the Tokenized Checkout API v1.2.0-beta. The package provides a fluent interface to authenticate, initialize, execute, query, search, and refund payments.
The Softscholar\Payment\Services\Gateways\Bkash\Bkash class implements PaymentInterface and offers the following methods:
| Method Name | Parameters | Return Type | Description |
|---|---|---|---|
withToken($token) |
string\|array $token |
static |
Feeds an active id_token string or response array containing the token to the instance. |
grantToken() |
None | array |
Calls bKash to obtain a fresh token payload. |
refreshToken($refreshToken) |
string $refreshToken |
array |
Refreshes the id_token using a refresh_token. |
checkout($data, $type) |
array $data, string $type |
string |
Entry point to create a payment (regular / tokenized) or agreement (authorize). Returns redirect URL. |
createPayment($data) |
array $data |
string |
Directly triggers bKash checkout payment creation and returns the checkout redirect URL. |
executePayment($paymentId, $agreementId) |
string $paymentId, string $agreementId = null |
array |
Executes/completes the payment after successful redirection. |
queryPayment($paymentId) |
string $paymentId |
array |
Queries payment details and status from bKash. |
searchTransaction($trxID) |
string $trxID |
array |
Searches for a transaction by bKash Transaction ID (trxID). |
createAgreement($data) |
array $data |
string |
Creates an agreement for tokenized checkout. Returns agreement redirect URL. |
executeAgreement($agreementId) |
string $agreementId |
array |
Executes/completes agreement enrollment. |
cancelAgreement($agreementId) |
string $agreementId |
array |
Cancels an active agreement. |
refund($data) |
array $data |
array |
Initiates refund of a captured payment. |
refundStatus($paymentId, $trxID) |
string $paymentId, string $trxID |
array |
Checks status of a refunded transaction. |
bKash Token Management
bKash checkout requires authentication using a bearer id_token. You must obtain this token first, and it's highly recommended to store/cache it and refresh it before expiration.
Here is an example wrapper helper:
bKash Regular Checkout
Regular checkout creates a single payment transaction.
1. Initiate Checkout
2. Execute Payment in Callback
After the customer inputs their PIN and verifies the OTP, bKash redirects to the callbackURL with query parameters. You must call executePayment to complete the transaction:
bKash Agreements (Tokenized Checkout)
Tokenized Checkout allows customer account enrollment (creating an agreement) so that subsequent payments can be completed without entering OTP/PIN.
1. Create Agreement
2. Execute Agreement in Callback
3. Charge Using Tokenized Agreement
Once you have stored the active agreementId, you can run a checkout payment directly without requiring PIN/OTP:
4. Cancel Agreement
To delete/deregister a saved customer wallet:
bKash Search & Query Payments
Query Payment Status
Queries checkout status using the unique paymentId:
Search Transaction details
Searches transaction information directly via bKash Transaction ID (trxID):
bKash Refunds
Refund an executed payment transaction:
Check the status of an existing refund:
Supported Payment Gateways
The Laravel Payments package currently supports:
- Nagad (including regular, authorization and tokenized checkout)
- bKash (including regular checkout, agreement setup, tokenized checkout, search, and refund queries)
License
The Laravel Payments package is open-source software licensed under the MIT license.
Contributing
Open source contributions are welcome! If you would like to contribute, please fork the repository and submit a pull request.
For assistance, feel free to contact us at SoftScholar or send an email to [email protected].
All versions of laravel-payments with dependencies
ext-openssl Version *