phonepe/php-merchant-client

There is no license information available for the latest version (1.0) of this package.

PhonePe Merchant Client Php

1.0 2016-11-22 08:39 UTC

This package is not auto-updated.

Last update: 2024-04-27 17:58:59 UTC


README

This is a Php client for merchant integration. A minimum of PHP 5.3 is required for using this client. For references on all the API's visit:

http://developer.phonepe.com.

Namespacing

  • The Client is namespaced under PhonePe
  • The Request and Response objects are defined in models that are namespaced under PhonePe\Models

Installation

  • If your project uses composer, add the following lines to your composer.json :
    {
        "require": {
            "phonepe/php-merchant-client": "1.*"
        }
    }
  • Now, run "composer update". You will find the php-merchant-client folder inside the vendors folder.

Please note that you will have to require the vendor/autoloader.php in order to autoload all the required classes.

Usage

Use namespace PhonePe to access the client and call the function of the required Api from the object of PhonePeClient Class.

For Example :

    use PhonePe\PhonePeClientImpl;
    use PhonePe\Models\RegularCreditRequest;
    
    require('vendor/autoload.php')      // For autoloading all the required classes
    
    $phonePeClientObject = new PhonePeClientImpl();
    $regularCreditRequestObject = new RegularCreditRequest();
    
    // 
    // Build the regularCreditRequestObject here
    // 
    
    $response = $phonePeClientObject->$regularCredit($regularCreditRequestObject)
    
    echo $response->redirectUrl;    // To get the location to redirect to.

The function will always return an Object of the corresponding return type.

Checksum Generator Usage

  • Namespaced under PhonePe\Utils
  • Call the function checkSumGenerate with an array of all the required variables and the salt index
  • Check the following example :
    use PhonePe\Utils\ChecksumGenerator
    
    require('vendor/autoload.php')
    
    $args = array($merchantId, $transactionId, $amount, $saltKey, $saltIndex);
    $result = ChecksumGenerator::checkSumGenerate($args);