2017 © Pedro Peláez
 

library payubiz

PayUbiz library for PHP

image

v3labs/payubiz

PayUbiz library for PHP

  • Monday, July 23, 2018
  • by v3labs
  • Repository
  • 0 Watchers
  • 3 Stars
  • 468 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 6 Versions
  • 2 % Grown

The README.md

PayUbiz API for PHP

Simple library for accepting payments via PayUbiz., (*1)

Installation

To add this library to your project, simply add a dependency on v3labs/payubiz to your project's composer.json file. Here is a minimal example of a composer.json file:, (*2)

{
    "require": {
        "v3labs/payubiz": "^0.3"
    }
}

Usage

You'll find a minimal usage example below., (*3)

Initialize purchase

<?php
// purchase.php

use V3labs\PayUbiz\PayUbiz;

require 'vendor/autoload.php';

$payubiz = new PayUbiz(array(
    'merchantId' => 'YOUR_MERCHANT_ID',
    'secretKey'  => 'YOUR_SECRET_KEY',
    'testMode'   => true
));

// 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/payubiz-php/return.php',
    'furl'        => 'http://localhost/payubiz-php/return.php',
];

// Redirects to PayUbiz
$client->initializePurchase($params)->send();

Finalize purchase

<?php
// return.php

use V3labs\PayUbiz\PayUbiz;

require 'vendor/autoload.php';

$payubiz = new PayUbiz([
    'merchantId' => 'YOUR_MERCHANT_ID',
    'secretKey'  => 'YOUR_SECRET_KEY',
    'testMode'   => true
]);

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

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

The PurchaseResult has a few more methods that might be useful:, (*4)

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

The Versions

23/07 2018

dev-master

9999999-dev http://github.com/v3labs/payubiz-php

PayUbiz library for PHP

  Sources   Download

MIT

The Requires

 

payu payubiz payuindia

23/07 2018
09/12 2015

0.3.0

0.3.0.0 http://github.com/v3labs/payubiz-php

PayUbiz library for PHP

  Sources   Download

MIT

The Requires

 

payu payubiz payuindia

23/04 2015

0.2.0

0.2.0.0

PayUbiz library for PHP

  Sources   Download

MIT

The Requires

 

payu payubiz

23/04 2015

0.1.1

0.1.1.0

PayUbiz library for PHP

  Sources   Download

MIT

The Requires

 

payu payubiz

23/04 2015

0.1

0.1.0.0

PayUbiz client for PHP

  Sources   Download

MIT

The Requires

 

payu payubiz