2017 © Pedro Peláez
 

project globalpay

Globalpay PHP library composer

image

codegidi/globalpay

Globalpay PHP library composer

  • Sunday, July 8, 2018
  • by Codegidi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Globalpay_PHP_script

Globalpay PHP is a library for using the [Globalpay] API for PHP, (*1)

Installing

composer require codegidi/globalpay, (*2)

Usage

  • The steps for carrying out a transaction is as follows:
    1. Get an access token by calling the Client Authorisation method
    1. Use the access_token to send initiate your transaction by calling the Transaction initiaion method
    1. Redirect to GlobalPay transaction interface using the redirectUri retured in the Transaction initiation call
    1. After transaction has been done, you will be redirected to the provided redirectUrl provided with the transactionReference as a querystring
    1. Validate the result by using the Retrieve transaction call

Client Authentication

require_once __DIR__ . '/../vendor/autoload.php'; 
use GlobalPay\Authentication;

$clientAuth = new GlobalPay_Authentication({optional BOOL isLive : #true for for live enviroment and false for staging default value false});
$clientAuthResponse = $clientAuth->Client({client id},{client secret});

if(!isset($clientAuthResponse['error'])){
    $access_token = $clientAuthResponse['access_token'];
} else {
    echo $clientAuthResponse['error'];
}
Transaction Initialization
require_once __DIR__ . '/../vendor/autoload.php'; 
use GlobalPay\Transaction;

$transactionInit = new GlobalPay_Transaction({Access_token},{optional BOOL isLive : #true for for live enviroment and false for staging default value false});
$transactionResponse = $transactionInit->initiation({{return url},{merchant reference},merchant id},{description},{total amount in minor},{currency code i.e NGN for naira},{customer email},{customer number},{customer firstname},{customer lastname});

if(!isset($transactionResponse['error'])){
    header("location:" . $transactionResponse['redirectUri '])
} else {
    echo $transactionResponse['error'];
}
Transaction Verification
require_once __DIR__ . '/../vendor/autoload.php'; 
use GlobalPay\Transaction;

$transaction = new GlobalPay_Transaction({Access_token},{optional BOOL isLive : #true for for live enviroment and false for staging default value false});
$transactionResponse = $transactionInit->verification({merchant id}, {merchant reference}, {transaction reference});

if(!isset($transactionResponse['error'])){
    print_r($transactionResponse);
} else {
    echo $transactionResponse['error'];
}

The Versions

08/07 2018

dev-master

9999999-dev

Globalpay PHP library composer

  Sources   Download

The Requires

  • php >=5.4

 

The Development Requires

by May Anibaba