PHP code example of jagdish-j-p / billdesk

1. Go to this page and download the library: Download jagdish-j-p/billdesk 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/ */

    

jagdish-j-p / billdesk example snippets


BILLDESK_RESPONSE_URL=https://app.test/billdesk/payments/callback
BILLDESK_RESPONSE_PATH=billdesk/payments/callback
BILLDESK_WEBHOOK_URL=https://app.test/billdesk/payments/webhook
BILLDESK_WEBHOOK_PATH=billdesk/payments/webhook

BILLDESK_MERCHANT_ID=
BILLDESK_SECURITY_ID=
BILLDESK_CHECKSUM_KEY=
BILLDESK_UAT_PREFIX="test-prefix"

    /**
     * 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/Billdesk/Billdesk;

/**
 * Returns status of transaction
 * 
 * @param string $reference_id reference order id
 * @return array
 */
$status = Billdesk::getTransactionStatus($reference_id);
bash
php artisan billdesk:publish
bash
php artisan migrate
bash
php artisan billdesk:payment-status
bash
php artisan billdesk:payment-status reference_id1,reference_id2,reference_id3