Download the PHP package divergent/bkash without Composer
On this page you can find all versions of the php package divergent/bkash. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package bkash
Laravel Package for bKash Payment Gateway
Installation & Configuration
Go to project directory and open terminal. Then run this command
For Laravel version below 5.5 open config/app file and add this line in providers
array
If you are using Laravel version greater than 5.5 then skip this section
After that run this command in command line/Terminal
After successfully publishing, update your .env file. Here is an Example ENV file.
You will also see bkash.php located in config folder. Below contents will found in bkash.php file after successfully published.
Finally, just run this command
This command will generate some necessary database tables which allow merchant to use this package more efficiently.
NOTE: You can add/remove any fields (if you need) of these tables.
Usage
Checkout
- Payment
- Payout
- Supporting Operations
- Refund
Tokenized
- Agreement
- Payment
- Payout
- Refund
Recurring
- Subscription
- Payment
Webhook
- General Webhook
- Recurring Webhook
Checkout Payment
For calling Checkout Payment methods, first you need to create instance of CheckoutApi class.
Don't forget to import use Divergent\Bkash\Apis\Checkout\CheckoutApi;
top of the file.
NOTE: Configurations will be fetch from your previously setup in .env file. Remember that you need to set token for authorization.
Create Payment (Sale or Capture)
$merchantAssociationInfo
is optional field. Default $currency
is BDT.
Execute Payment
You will get $paymentID
from Create Payment
Query Payment
You will get $paymentID
from Execute Payment
Capture Payment
You will get $paymentID
from Execute Payment
NOTE: Capture Payment will be used for payment with authorization
intent.
Void Payment
You will get $paymentID
from Execute Payment
NOTE: Void Payment will be used for payment with authorization
intent.
Checkout Payout
Checkout B2C Payout
Checkout B2B Payout
First you have to call initiatPayout method which return you a payoutID. Then you can call b2bPayout to make B2B Payout.
Checkout B2B Query Payout
You will get $payoutID
from Checkout B2B Payout.
Checkout Supporting Operations
Search Transaction
You will get $trxID
from Execute Payment
Query Organization Balance
Intra-Account Transfer
Checkout Refund
Refund Transaction
$sku
and $reason
are optional fields. You will get $paymentID
and $trxID
from Execute Payment.
Refund Status
You will get $paymentID
and $trxID
from Execute Payment.
Tokenized Agreement
For calling Tokenized Agreement methods, first you need to create instance of TokenizedApi class.
Don't forget to import use Divergent\Bkash\Apis\Tokenized\TokenizedApi;
top of the file.
NOTE: Configurations will be fetch from your previously setup in .env file. Remember that you need to set token for authorization.
Create Agreement
To create agreement, first BkashConstant::CREATE_AGREEMENT
parameter need to pass which allow callback url to know which page to redirect. The possible constant list with defination is given below for better understanding -
Bkash Constant Defination
BkashConstant::CREATE_AGREEMENT
- Used for create agreement.BkashConstant::WITHOUT_AGREEMENT_PAYMENT
- used for make payment without agreement.BkashConstant::WITH_AGREEMENT_PAYMENT
- Used for make payment with agreement.BkashConstant::PAYMENT
- Used for create payment only.
NOTE: Merchant side must need to main database table to get to know if user is already created agreement or not.
Execute Agreement
You will get $paymentID
from Create Agreement.
Agreement Status
You will get $agreementID
from Create Agreement.
Agreement Cancel
You will get $agreementID
from Create Agreement.
Tokenized Payment
Tokenized Create Payment (Sale or Capture)
To create payment, first BkashConstant::PAYMENT
parameter need to pass which allow callback url to know which page to redirect. This constant also define which action you are going to call. You can find more about it Create Agreement. $merchantAssociationInfo
is optional field. Default $currency
is BDT.
Tokenized Execute Payment
You will get $paymentID
from Create Payment.
Tokenized Query Payment
You will get $paymentID
from Execute Payment.
Tokenized Capture Payment
You will get $paymentID
from Execute Payment
NOTE: Tokenized Capture Payment will be used for payment with authorization
intent.
Tokenized Void Payment
You will get $paymentID
from Execute Payment
NOTE: Tokenized Void Payment will be used for payment with authorization
intent.
Tokenized Payout
Tokenized Intra-Account Transfer
Tokenized B2C Payout
Tokenized B2B Payout
First you have to call initiatPayout method which return you a payoutID. Then you can call b2bPayout to make B2B Payout.
Tokenized B2B Query Payout
You will get $payoutID
from Tokenized B2B Payout.
Tokenized Refund
Refund Transaction
$sku
and $reason
are optional fields. You will get $paymentID
and $trxID
from Execute Payment.
Refund Status
You will get $paymentID
and $trxID
from Execute Payment.
Recurring Subscription
For calling Recurring Subscription methods, first you need to create instance of Subscription class.
Don't forget to import use Divergent\Bkash\Apis\Recurring\Subscription;
top of the file.
NOTE: Configurations will be fetch from your previously setup in .env file.
Create Subscription
Available recurring cycles are given below -
DAILY
WEEKLY
FIFTEEN_DAYS
THIRTY_DAYS
NINETY_DAYS
ONE_EIGHTY_DAYS
CALENDAR_MONTH
CALENDAR_YEAR
Subscription Query by Request ID
You will get $requestId
from Create Subscription.
Subscription Query by Subscription ID
You will get $subscriptionID
from Subscription Query by Request ID.
Cancel Subscription
You will get $subscriptionID
from Subscription Query by Request ID. $reason
is Optional value that contains string value.
Subscription List
$page
is defines from which page you want to see subscription list and $size
defines the number of rows you want to show.
Recurring Payment
For calling Recurring Payment methods, first you need to create instance of Payment class.
Don't forget to import use Divergent\Bkash\Apis\Recurring\Payment;
top of the file.
NOTE: Configurations will be fetch from your previously setup in .env file.
Payment List by Subscription ID
You will get $subscriptionID
from Subscription Query by Request ID.
Payment Info by Payment ID
You will get $paymentId
from Payment List by Subscription ID.
Payment Schedule
$frequency
defines the cycles for each subscriptions. Available recurring cycles are given below -
DAILY
WEEKLY
FIFTEEN_DAYS
THIRTY_DAYS
NINETY_DAYS
ONE_EIGHTY_DAYS
CALENDAR_MONTH
CALENDAR_YEAR
$startDate
and $expiryDate
indicates from and to date for payment schedule.
Payment Refund
You will get $paymentId
from Payment List by Subscription ID. $amount
is which amount you want to refund.
Webhook
To integrate webhook in your website, you need to create two url (route).
- general webhook url
- recurring webhook url
One is to get notification from Recurring product.
For calling Webhook methods, first you need to create instance of Webhook class.
Don't forget to import use Divergent\Bkash\Apis\Webhook\Webhook;
top of the file.
General Webhook
Recurring Webhook
Don't worry if you find complexity in implatation by reading this documentation. Here is a demo project. Feel free to use this code. :heart:
Support
This version supports Laravel 5.0 or greater.
- In case of any issues, kindly create one on the Issues section.
- Feel free to ask for the support over the email
[email protected]
.