1. Go to this page and download the library: Download jagdish-j-p/billdesk-hmac library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
/**
* 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';
}
use JagdishJP\BilldeskHmac\Facades\BilldeskHmac;
/**
* Returns status of transaction
*
* @param string $orderid reference order id
* @return array
*/
$status = BilldeskHmac::getTransactionStatus($orderid);