Repository has been developed to integrate BillDesk Payment Gateway with HMAC Encryption in Laravel.
This repository is currently in development. There might be some exception.
Your support allows me to keep this package free, up-to-date and maintainable. Alternatively, you can spread the word!
You can install the package via composer:
composer require jagdish-j-p/billdesk-hmac
Then run the publish command to publish the config files and support controller and view
php artisan billdesk:publish
This will generate the following files
billdesk.php
Http/Controllers/BilldeskHmac/Controller.php
payment.blade.php
. Note do not change form action URL billdesk.payment.auth.request
..env
file.BILLDESK_TRANSACTION_RESPONSE_PATH=billdesk/payments/transactions/callback
BILLDESK_MANDATE_RESPONSE_PATH=billdesk/payments/mandates/callback
BILLDESK_WEBHOOK_PATH=billdesk/payments/webhook
BILLDESK_MERCHANT_ID=
BILLDESK_CLIENT_ID=
BILLDESK_HMAC_KEY=
BILLDESK_MERCHANT_LOGO="${APP_URL}/assets/img/logo.jpg"
BILLDESK_RETRY_COUNT=3
BILLDESK_CHILD_WINDOW=false
BILLDESK_ITEM_CODE=DIRECT
BILLDESK_UAT_PREFIX="test-prefix"
php artisan migrate
You can visit http://app.test/billdesk/initiate/payment for the payment flow demo of web integration.
Handle the payment response in Http/Controllers/BilldeskHmac/Controller.php
/**
* This will be called after the user approve the mandate
* @param Request $request
*
* @return Response
*/
public function mandateCallback(MandateModifyResponseRequest $request, $id = null)
{
$response = $request->handle($id);
if ($response['response_format'] == 'JSON') {
return response()->json(['response' => $response, 'billdesk_response' => $request->all()]);
}
dd($response, $request); // Remove this line and modify as per your needs.
}
/**
* This will be called after the user approve the payment
* on the bank side
*
* @param Request $request
* @return Response
*/
public function callback(Request $request)
{
$response = $request->handle();
if ($response['response_format'] == 'JSON')
return response()->json(['response' => $response, 'billdesk_response' => $request->all()]);
dd($response, $request); // Remove this line and modify as per your needs.
// Update your order status
}
/**
* This will handle any direct call from BillDesk
*
* @param Request $request
* @return string
*/
public function webhook(Request $request)
{
$response = $request->handle();
// Update your order status
return 'OK';
}
php artisan billdesk:transaction-status
php artisan billdesk:transaction-status --orderid=orderid1 --orderid=orderid2 --orderid=orderid3
use JagdishJP\BilldeskHmac\Facades\BilldeskHmac;
/**
* Returns status of transaction
*
* @param string $orderid reference order id
* @return array
*/
$status = BilldeskHmac::getTransactionStatus($orderid);
You can also override payment.blade.php
with your custom design to integrate with your layout. but do not change name
attribute of html controls and action
URL of form.
Please see CHANGELOG for more information what has changed recently.
Contrubuters are welcome and will be given full credit.
If you discover any security related issues, please email jagdish.j.ptl@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the Packagify.