2017 © Pedro Peláez
 

library payumoney

PayUMoney library for Laravel and core PHP

image

riazxrazor/payumoney

PayUMoney library for Laravel and core PHP

  • Wednesday, May 3, 2017
  • by riazXrazor
  • Repository
  • 1 Watchers
  • 0 Stars
  • 185 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 28 % Grown

The README.md

PayUMoney API for Laravel and core PHP

Simple Library/Package for accepting payments via PayUMoney., (*1)

demo project example

https://github.com/riazXrazor/riazXrazor-payumoey-example, (*2)

Installation

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:, (*3)

{
    "require": {
        "riazxrazor/payumoney": "1.*"
    }
}

Or you can run this command from your project directory., (*4)

composer require riazxrazor/payumoney

Usage Laravel (for non laravel usage see below)

Configuration

Open the config/app.php and add this line in providers section., (*5)

Riazxrazor\Payumoney\PayumoneyServiceProvider::class,

add this line in the aliases section., (*6)

'Payumoney' => Riazxrazor\Payumoney\PayumoneyFacade::class

get the config by running this command., (*7)

php artisan vendor:publish --tag=config

config option can be found config/payumoney.php, (*8)


'KEY' => '', 'SALT' => '', 'TEST_MODE' => TRUE, 'DEBUG' => FALSE

Basic Usage

You can use the function like this., (*9)


// 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();

Usage Non Laravel

For non laravel usage, (*10)

Completing Payment

<?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();

Completing Payment

<?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:, (*11)

$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();

The Versions

03/05 2017

dev-master

9999999-dev http://github.com/riazxrazor/payumoney

PayUMoney library for Laravel and core PHP

  Sources   Download

MIT

The Requires

 

by Riaz Laskar

payu payumoney payuindia

02/05 2017

1.0.0

1.0.0.0 http://github.com/riazxrazor/payumoney

PayUMoney library for Laravel and core PHP

  Sources   Download

MIT

The Requires

 

by Riaz Laskar

payu payumoney payuindia