| Package Data | |
|---|---|
| Maintainer Username: | riazXrazor | 
| Maintainer Contact: | riazcool77@gmail.com (Riaz Laskar) | 
| Package Create Date: | 2017-05-02 | 
| Package Last Update: | 2020-07-03 | 
| Language: | PHP | 
| License: | MIT | 
| Last Refreshed: | 2025-10-27 03:21:01 | 
| Package Statistics | |
|---|---|
| Total Downloads: | 2,333 | 
| Monthly Downloads: | 0 | 
| Daily Downloads: | 0 | 
| Total Stars: | 0 | 
| Total Watchers: | 1 | 
| Total Forks: | 6 | 
| Total Open Issues: | 2 | 
Simple Library/Package for accepting payments via PayUMoney.
To add this library to your project, simply add a dependency on riazxrazor/payumoney to your project's composer.json file. Here is a minimal example of a composer.json file:
{
    "require": {
        "riazxrazor/payumoney": "1.*"
    }
}
Or you can run this command from your project directory.
composer require riazxrazor/payumoney
(for non laravel usage see below)Open the config/app.php and add this line in providers section.
Riazxrazor\Payumoney\PayumoneyServiceProvider::class,
add this line in the aliases section.
'Payumoney' => Riazxrazor\Payumoney\PayumoneyFacade::class
get the config by running this command.
php artisan vendor:publish --tag=config
config option can be found config/payumoney.php
    'KEY' => '',
    'SALT' => '',
    'TEST_MODE' => TRUE,
    'DEBUG' => FALSE
You can use the function like this.
// All of these parameters are required!
// Redirects to PayUMoney
\Payumoney::pay([
                       'txnid'       => 'A_UNIQUE_TRANSACTION_ID',
                       'amount'      => 10.50,
                       'productinfo' => 'A book',
                       'firstname'   => 'Peter',
                       'email'       => 'abc@example.com',
                       'phone'       => '1234567890',
                       'surl'        => url('payumoney-test/return'),
                       'furl'        => url('payumoney-test/return'),
                   ])->send();
                               
 
// In the return method of controller
$result = \Payumoney::completePay($_POST);
if ($result->checksumIsValid() AND isSuccess()) {
  print 'Payment was successful.';
} else {
  print 'Payment was not successful.';
}
The `PayumoneyResponse` has a few more methods that might be useful:
$result = \Payumoney::completePay($_POST);
// Returns Complete, Pending, Failed or Tampered
$result->getStatus(); 
// Returns an array of all the parameters of the transaction
$result->getParams();
// Returns the ID of the transaction
$result->getTransactionId();
// Returns true if the checksum is correct
$result->checksumIsValid();
For non laravel usage
<?php
// pay.php
use Riazxrazor\Payumoney;
require 'vendor/autoload.php';
$payumoney = new Payumoney\Payumoney([
    'KEY' => 'YOUR_MERCHANT_KEY',
    'SALT'  => 'YOUR_MERCHANT_SALT',
    'TEST_MODE'   => true, // optional default to true
    'DEBUG' => FALSE // optional default to false
]);
// All of these parameters are required!
$params = [
    'txnid'       => 'A_UNIQUE_TRANSACTION_ID',
    'amount'      => 10.50,
    'productinfo' => 'A book',
    'firstname'   => 'Peter',
    'email'       => 'abc@example.com',
    'phone'       => '1234567890',
    'surl'        => 'http://localhost/payumoney-test/return.php',
    'furl'        => 'http://localhost/payumoney-test/return.php',
];
// Redirects to PayUMoney
$payumoney->pay($params)->send();
<?php
// return.php
use Riazxrazor\Payumoney;
require 'vendor/autoload.php';
$payumoney = new Payumoney\Payumoney([
    'KEY' => 'YOUR_MERCHANT_KEY',
    'SALT'  => 'YOUR_MERCHANT_SALT',
    'TEST_MODE'   => true, // optional default to true
    'DEBUG' => FALSE // optional default to false
]);
$result = $payumoney->completePay($_POST);
if ($result->checksumIsValid() && $result->isSuccess()) {
  print 'Payment was successful.';
} else {
  print 'Payment was not successful.';
}
The PayumoneyResponse has a few more methods that might be useful:
$result = $payumoney->completePay($_POST);
// Returns Complete, Pending, Failed or Tampered
$result->getStatus(); 
// Returns an array of all the parameters of the transaction
$result->getParams();
// Returns the ID of the transaction
$result->getTransactionId();
// Returns true if the checksum is correct
$result->checksumIsValid();