pickupman/omnipay-hrh

Omnipay gateway for High Risk Holdings

dev-master 2018-08-15 01:00 UTC

This package is not auto-updated.

Last update: 2024-04-20 12:50:41 UTC


README

Hrh driver for the Omnipay PHP payment processing library

Latest Stable Version Total Downloads

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements Hrh support for Omnipay.

Installation

Omnipay is installed via Composer. To install, simply add it to your composer.json file:

{
    "require": {
        "pickupman/omnipay-hrh": "~1.0"
    }
}

And run composer to update your dependencies:

$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update

Basic Usage

The following gateways are provided by this package:

  • High Risk Holdings (Hrh)

For general usage instructions, please see the main Omnipay repository.

Purchase / Sale

For charging a card you may do the following

$gateway = Omnipay\Omnipay::create('Hrh');
$gateway->setUsername('username');
$gateway->setPassword('password');

// Example card data
$card = new Omnipay\Common\CreditCard([
    'firstName'       => 'John',
    'lastName'        => 'Doe',
    'billingAddress1' => '888 Main',
    'billingZip'      => '77777',
    'billingCity'     => 'City',
    'billingState'    => 'State',
    'billingPostcode' => 'Zip',
    'number'          => '4111111111111111',
    'expiryMonth'     => '6',
    'expiryYear'      => '2016',
    'cvv'             => '123'
]);

$response = $gateway->purchase(
		         [
			         'card'                 => $card,
			         'amount'               => '10.00',
			         'clientIp'             => $_SERVER['REMOTE_ADDR'],
			         'transactionReference' => '1',
		         ]
		     )->send();

if ( $response->isSuccessful() ) {
	// Continue processing
	$transactionID = $response->getTransactionReference();
}

Refund / Credit

In order to process a refund, you must pass the originating transaction id returned by the gateway

$gateway = Omnipay\Omnipay::create('Hrh');
$gateway->setUsername('username');
$gateway->setPassword('password');

$response = $gateway->refund(
		         [
			         'amount'               => '10.00',
			         'transactionReference' => 'original transactionid',
		         ]
		     )->send();

if ( $response->isSuccessful() ) {
	// Continue processing
	$transactionID = $response->getTransactionReference();
}

Void

To void an existing transaction, you must pass the originating transaction id returned by the gateway

$gateway = Omnipay\Omnipay::create('Hrh');
$gateway->setUsername('username');
$gateway->setPassword('password');

$response = $gateway->void(
		         [
			         'transactionReference' => 'original transactionid',
		         ]
		     )->send();

if ( $response->isSuccessful() ) {
	// Continue processing
	$transactionID = $response->getTransactionReference();
}

Authorize

You can authorize a credit card to verify funds, and then process the amount later.

$gateway = Omnipay\Omnipay::create('Hrh');
$gateway->setUsername('username');
$gateway->setPassword('password');

// Example card data
$card = new Omnipay\Common\CreditCard([
    'firstName'       => 'John',
    'lastName'        => 'Doe',
    'billingAddress1' => '888 Main',
    'billingZip'      => '77777',
    'billingCity'     => 'City',
    'billingState'    => 'State',
    'billingPostcode' => 'Zip',
    'number'          => '4111111111111111',
    'expiryMonth'     => '6',
    'expiryYear'      => '2016',
    'cvv'             => '123'
]);

$response = $gateway->authorize(
		         [
			         'card'                 => $card,
			         'amount'               => '10.00',
			         'transactionReference' => 'order id or other unique value',
		         ]
		     )->send();

if ( $response->isSuccessful() ) {
	// Continue processing
	$transactionID = $response->getTransactionReference(); // Use this value later to capture
}

Capture

Use a capture, to charge a card after retrieving an authorization

$gateway = Omnipay\Omnipay::create('Hrh');
$gateway->setUsername('username');
$gateway->setPassword('password');

$response = $gateway->capture(
		         [
			         'amount'               => '10.00',
			         'transactionReference' => 'order id or other unique value',
		         ]
		     )->send();

if ( $response->isSuccessful() ) {
	// Continue processing
	$transactionID = $response->getTransactionReference(); // Use this value later to capture
}

Test Mode

This feature will NOT turn on test mode for your account. Test mode must be enabled or disabled from your Hrh control panel. All transactions processed on a live account will be charged.

If you would like to use the default testing credentials from Hrh, please initialize the gateway with

$gateway = Omnipay\Omnipay::create('Hrh');
$gateway->setTestMode(true); // Automatically sets default testing gateway username and password

Any transactions processed with testMode(true) will not be charged, OR shown in your control panel. This method will automatically apply the testing username and password for the Hrh gateway.

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.