2017 © Pedro Peláez
 

library rxp-hpp-php

SDK to send requests and parse responses from Realex Payments using HPP

image

realexpayments/rxp-hpp-php

SDK to send requests and parse responses from Realex Payments using HPP

  • Tuesday, November 21, 2017
  • by realexpayments
  • Repository
  • 4 Watchers
  • 6 Stars
  • 6,453 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 27 Forks
  • 10 Open issues
  • 4 Versions
  • 16 % Grown

The README.md

Please use our new PHP SDK

We've moved. We highly recommend you use the Global Payments PHP SDK which supports all the features of this SDK and will benefit from all future releases: https://github.com/globalpayments/php-sdk, (*1)

With the latest update (1.1.3) this SDK supports the mandatory and recommended HPP fields for 3D Secure 2. Going forward it will only receive critical security updates, no further feature updates will be released beyond 3D Secure 2., (*2)

Realex Payments HPP PHP SDK

You can sign up for a Global Payments (formerly Realex Payments) account at https://developer.globalpay.com, (*3)

Requirements

  • PHP >= 5.3.9
  • For security and support we highly recommend you use PHP 7
  • Composer (https://getcomposer.org/)

Instructions

  1. Add the following to your 'composer.json' file, (*4)

    {
        "require": {
            "realexpayments/rxp-hpp-php": "1.1.3"
        }    
    }
    
  2. Inside the application directory run composer:, (*5)

    composer update
    

    OR (depending on your server configuration), (*6)

    php composer.phar update
    
  3. Add a reference to the autoloader class anywhere you need to use the sdk, (*7)

    require_once ('vendor/autoload.php');
    
  4. Use the sdk br/, (*8)

    $hppRequest = new HppRequest(); 
    $hppRequest->addMerchantId("MerchantId");
    $hppRequest->addAccount("internet");
    ....
    

Usage

Creating HPP Request JSON for Realex Payments JS Library

<?php
require_once ('vendor/autoload.php');

use com\realexpayments\hpp\sdk\domain\HppRequest;
use com\realexpayments\hpp\sdk\RealexHpp;
use com\realexpayments\hpp\sdk\RealexValidationException;
use com\realexpayments\hpp\sdk\RealexException;

$hppRequest = new HppRequest(); 
$hppRequest->addMerchantId("MerchantId");
$hppRequest->addAccount("internet");
$hppRequest->addAmount("1001");
$hppRequest->addCurrency("EUR");
$hppRequest->addAutoSettleFlag(TRUE);
$hppRequest->addHppVersion("2");
// 3D Secure 2 Mandatory and Recommended Fields
$hppRequest->addCustomerEmailAddress("james.mason@example.com");
$hppRequest->addCustomerMobilePhoneNumber("44|07123456789");
$hppRequest->addBillingAddressLine1("Flat 123");
$hppRequest->addBillingAddressLine2("House 456");
$hppRequest->addBillingAddressLine3("Unit 4");
$hppRequest->addBillingCity("Halifax");
$hppRequest->addBillingPostalCode("W5 9HR");
$hppRequest->addBillingCountryCode("826");
$hppRequest->addShippingAddressLine1("Apartment 825");
$hppRequest->addShippingAddressLine2("Complex 741");
$hppRequest->addShippingAddressLine3("House 963");
$hppRequest->addShippingCity("Chicago");
$hppRequest->addShippingState("IL");
$hppRequest->addShippingPostalCode("50001");
$hppRequest->addShippingCountryCode("840");

$realexHpp = new RealexHpp("Shared Secret");

try {
    $requestJson = $realexHpp->requestToJson($hppRequest, false);
    // TODO: pass the HPP request JSON to the JavaScript, iOS or Android Library
}
catch (RealexValidationException $e) {
    // TODO: Add your error handling here
}
catch (RealexException $e) {
    // TODO: Add your error handling here
}

Consuming Response JSON from Realex Payments JS Library

<?php
require_once ('vendor/autoload.php');

use com\realexpayments\hpp\sdk\domain\HppResponse;
use com\realexpayments\hpp\sdk\RealexHpp;

$realexHpp = new RealexHpp("mySecret");
$hppResponse = $realexHpp->responseFromJson(responseJson);

License

See the LICENSE file., (*9)

The Versions

21/11 2017

dev-master

9999999-dev

SDK to send requests and parse responses from Realex Payments using HPP

  Sources   Download

MIT

The Requires

 

payments realex hpp

21/11 2017

v1.1.1

1.1.1.0

SDK to send requests and parse responses from Realex Payments using HPP

  Sources   Download

MIT

The Requires

 

payments realex hpp

24/01 2017

v1.1

1.1.0.0

SDK to send requests and parse responses from Realex Payments using HPP

  Sources   Download

MIT

The Requires

 

payments realex hpp

15/09 2015

v1.0

1.0.0.0

SDK to send requests and parse responses from Realex Payments using HPP

  Sources   Download

MIT

The Requires

 

payments realex hpp