1. Go to this page and download the library: Download ajuchacko/payumoney 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/ */
ajuchacko / payumoney example snippets
use Ajuchacko\Payu\PayuGateway;
$params = [
'txnid' => '134',
'amount' => 12.00,
'productinfo' => 'Iphone',
'firstname' => 'Jon Doe',
'email' => '[email protected]',
'phone' => '9895309090',
'surl' => 'https://example.com/success',
'furl' => 'https://example.com/failure',
'udf1' => 'Secret value',
];
$payu = new PayuGateway([
"merchant_key"=> "testMerchantKey",
"secret_key" => "testSecret",
"merchant_id" => "7974556",
"test_mode" => true,
]);
$payu->pay($params); // Redirects to PayUMoney
// OR
$hash = $payu->newChecksum($params);
$payu->toArray(); // Returns array or parameters which can be submitted via web/mobile app.
use Ajuchacko\Payu\PayuGateway;
use Ajuchacko\Payu\Exceptions\PaymentFailedException;
use Ajuchacko\Payu\Exceptions\InvalidChecksumException;
$payu = new PayuGateway([
"merchant_key"=> "testMerchantKey",
"secret_key" => "testSecret",
"merchant_id" => "7974556",
"test_mode" => true,
]);
try {
$response = $payu->paymentSuccess($request->all())
// $response->toArray();
// $response->txnid // retrive response params as attributes
} catch (PaymentFailedException $e) {
$response = $payu->getPaymentResponse($request->all());
} catch (InvalidChecksumException $e) {
// Checksum is tampered
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.