Skip to content

Commit

Permalink
adds readme
Browse files Browse the repository at this point in the history
  • Loading branch information
webncrafts committed May 10, 2020
1 parent f29384d commit bebd6cc
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
81 changes: 81 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# PayUMoney Php


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

## Installation

Use the package manager [composer](https://getcomposer.org/) to install package.

```bash
composer install ajuchacko/payumoney
```

## Usage

```php
<?php

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([
"secret_key" => "testSecret",
"merchant_key"=> "testMerchantKey",
"merchant_id" => "7974556",
"test_mode" => false,
]);

$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.

```

## Payment Response

```php
use Ajuchacko\Payu\PayuGateway;

$payu = new PayuGateway([
"secret_key" => "testSecret",
"merchant_key" => "testMerchantKey",
"merchant_id" => "7974556",
"test_mode" => true,
]);


try {
$response = $payu->getPaymentResponse($request->all());
if ($response->getStatus() === PaymentStatusType::STATUS_COMPLETED) {
# code...
}

// OR

if ($response = $payu->paymentSuccess($request->all())) {
# code...
}
} 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.
13 changes: 13 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
{
"name": "ajuchacko/payumoney",
"description": "PayUMoney library for PHP",
"keywords": ["payu", "payuindia", "payumoney"],
"homepage": "http://github.com/ajuchacko91/payumoney-php",
"type": "library",
"version": "1.1",
"authors": [
{
"name": "Aju Chacko",
"email": "[email protected]",
"homepage": "http://github.com/ajuchacko91"
}
],
"require": {
"phpunit/phpunit": "^8.5",
"symfony/options-resolver": "^5.0",
Expand Down

0 comments on commit bebd6cc

Please sign in to comment.