PHP code example of raziul / shurjopay-laravel

1. Go to this page and download the library: Download raziul/shurjopay-laravel 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/ */

    

raziul / shurjopay-laravel example snippets


use Raziul\Shurjopay\Facades\Shurjopay;


// The payload will be passed to Shurjopay.
$payload = [
    // order info
    // customer info
    // custom values
];

// set the callback url
Shurjopay::setCallbackUrl($success_url, $cancel_url);

// Make a payment
Shurjopay::makePayment($payload);

// OR use methond chaining like below:
Shurjopay::setCallbackUrl($success_url, $cancel_url)->makePayment($payload);


$payment = Shurjopay::verifyPayment($order_id);

if ($payment->success()) {
    // payment success
} else {
    // payment failed
}

try {
	// making payment
	Shurjopay::setCallbackUrl($success_url, $cancel_url)
		->makePayment($payload);

	// or verfication
	Shurjopay::verifyPayment($order_id);

} catch (Raziul\Shurjopay\Exceptions\ShurjopayException $e) {
	return $e->getMessage();
}
sh
php artisan vendor:publish --provider="Raziul\Shurjopay\ShurjopayServiceProvider"