Skip to content

Library for integrating payumoney easily to your php apps using Simple Interface.

Notifications You must be signed in to change notification settings

ajuchacko/payumoney

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PayuMoney Php

Library for integrating payumoney easily to your laravel/php apps using simple interface.

Installation

Use the package manager composer to install package.

composer install ajuchacko/payumoney

Usage

<?php

use Ajuchacko\Payu\PayuGateway;


$params = [
    'txnid'       => '134',
    'amount'      => 12.00,
    'productinfo' => 'Iphone',
    'firstname'   => 'Jon Doe',
    'email'       => 'jon@mail.com',
    '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.

Get: Test Credentials

Payment Response

<?php

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
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

About

Library for integrating payumoney easily to your php apps using Simple Interface.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages