PHP code example of razzbee / payumoney-php-sdk

1. Go to this page and download the library: Download razzbee/payumoney-php-sdk 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/ */

    

razzbee / payumoney-php-sdk example snippets



// purchase.php

use Razzbee\PayUMoney\PayUMoney;

MERCHANT_ID',
    'secretKey'  => 'YOUR_SECRET_KEY',
    'salt'       =>  'YOUR_SALT',
    'testMode'   => true
]);

// All of these parameters are    => '1234567890',
    'surl'        => 'http://localhost/payumoney-php/return.php',
    'furl'        => 'http://localhost/payumoney-php/return.php',
];

// Redirects to PayUMoney
$payumoney->initializePurchase($params)->send();


// return.php

use Razzbee\PayUMoney\PayUMoney;

R_MERCHANT_ID',
    'secretKey'  => 'YOUR_SECRET_KEY',
    'salt'       =>  'YOUR_SALT',
    'testMode'   => true
]);

$result = $payumoney->completePurchase($_POST);

if ($result->checksumIsValid() && $result->getStatus() === PayUMoney::STATUS_COMPLETED) {
  print 'Payment was successful.';
} else {
  print 'Payment was not successful.';
}

$result = $payumoney->completePurchase($_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();