2017 © Pedro Peláez
 

library proxypay

ProxyPay library. Provides methods to compose SHA signatures and to check ProxyPay responses.

image

netoxygen/proxypay

ProxyPay library. Provides methods to compose SHA signatures and to check ProxyPay responses.

  • Wednesday, June 13, 2018
  • by netoxygen
  • Repository
  • 3 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 17 % Grown

The README.md

Latest Stable Version Build Status Coverage Status, (*1)

ProxyPay library

Provides methods to compose SHA signatures and to check ProxyPay responses., (*2)

Full documentation can be found here, (*3)

Requirements:

  • PHP 5.5+

Installation:

The library is PSR-4 compliant and the simplest way to install it is via composer:, (*4)

 composer require netoxygen/proxypay

Description

Request and Responses signature

All the communication between your server and ProxyPay is signed using HMAC SHA256., (*5)

Keys

You have been provided two keys:, (*6)

  • key_in: use it to sign your requests
  • key_out: use it to check ProxyPay responses signature

Usage

Signing your requests to ProxyPay

You have to add in your request a param named sha_sign (or SHA_SIGN). The easier way to sign your requests is to use the PaymentRequest class., (*7)

use Netoxygen\ProxyPay\PaymentRequest;

/**
  * We assume that $_POST contains all your request parameters:
  * - seller
  * - amount
  * - description
  * - success_url
  * - error_url
  * - cancel_url
  *
  * All the other parameters will be filtered.
  */
$request = new PaymentRequest($_POST, 'my_key_in');

// You can loop over all your parameters in the $request
foreach ($request->get_parameters() as $key => $value) {
    echo $key . '=' . $value;
}

// You can retrieve the SHA_SIGN
$sha_sign = $request->compose_sha_sign();

Check ProxyPay responses signature

At the end of the process, you receive a signed GET callback from ProxyPay. To ensure that the request is correctly signed, just use the Paymentresponse class., (*8)

use Netoxygen\ProxyPay\PaymentResponse;

$response = new PaymentResponse($_GET, 'my_key_out');
if ($response->is_valid()) {
    // $response signature is verified, now check the transaction status
    $params         = $response->get_parameters();
    $payment_status = $params['STATUS'];
    switch($payment_status) {
        case 'SUCCESS':
            // Complete the transaction on your side
            break;

        case 'CANCEL':
            // The transaction has been cancelled by the user
            break;

        case 'ERROR':   /* FALLTHROUGH */
        default:
            // An error occured
            break;
} else {
    // Bad request: throw away
}

The Versions

13/06 2018

dev-master

9999999-dev https://github.com/NetOxygen/proxypay.git

ProxyPay library. Provides methods to compose SHA signatures and to check ProxyPay responses.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Belkacem Alidra

payment sha proxypay

13/06 2018

1.6.2

1.6.2.0 https://github.com/NetOxygen/proxypay.git

ProxyPay library. Provides methods to compose SHA signatures and to check ProxyPay responses.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Belkacem Alidra

payment sha proxypay

02/02 2017

1.5.0

1.5.0.0 https://github.com/NetOxygen/proxypay.git

ProxyPay library. Provides methods to compose SHA signatures and to check ProxyPay responses.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Belkacem Alidra

payment sha proxypay