2017 © Pedro Peláez
 

library mygate

PHP integration for mygate.co.za

image

codechap/mygate

PHP integration for mygate.co.za

  • Wednesday, May 11, 2016
  • by CodeChap
  • Repository
  • 1 Watchers
  • 1 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 11 % Grown

The README.md

MyGate 1Click Enterprise Package

NB! Package is in development stage and not usable!

MyGate’s Tokenization – Enterprise solution eliminates merchant requirements to store card data. The solution utilizes a merchants hosted payment page. By replacing card detail with a unique token, merchants can reduce the risk of storing card data. Using the token, merchants can use a payment page that only requires the card holder to enter their CVV number., (*1)

Disclaimer

Use this library at your own risk, I take no responsibility what so ever for the use of it!, (*2)

Money makes the world go round

Make sure you talk to myGate about the 1 Click enterprise option, there are setup costs that you or your client may want to consider before intergrating the 1 Click Enterprise option., (*3)

Usage

Optain your merchant_id, app_name and app_id from myGate. You need to be registered as a developer or as a merchant., (*4)

Use composer to install it within your framework using your composer.json file:, (*5)

    "require": {
        "codechap/mygate": "dev-master"
    }

or simply incldue the required files:, (*6)

    require("mygate/src/Mygate/connection.php");
    require("mygate/src/Mygate/card.php");

You can use the following test credit cards to test your implementation, (*7)

    $testCards = array(

        // Visa Successful
        array(
            'cardholder' => 'Joe Soap',
            'cardnumber' => '4111111111111111',
            'expirymonth' => '10',
            'expiryyear' => '2015',
            'cvv' => '123'
        ),

        // Visa Declined
        array(
            'cardholder' => 'Joe Soap',
            'cardnumber' => '4242424242424242',
            'expirymonth' => '10',
            'expiryyear' => '2015',
            'cvv' => '123'
        )
    );

Connect to myGate

Create the connection object to myGate, (*8)

    // Open the gateway
    $connect = new Mygate\Connection(
        array(
            'merchant_id' => 'Your-merchant-id-here',
            'app_name' => 'Your-app-name-here', 
            'app_id' => 'Your-app-id-here'
        )
    );

New and initial payment

Start by creating and tokenizing a credit card. You keep a record of the token in your database stored against a user. This token and the credit card holder's CVV number is all you need to collect payments in the future, (*9)

    // Create a new credit card and myGate connection details
    $card = new Mygate\Card($testCards[0], $connect);

    // Create and send the generated token to myGate and store the token in your database against a user.
    $token = $card->tokenize();

    // First time payment of R1200 over twelve months
    $card->pay("1200.00", "First Test Payment", "12");

Second payment

Now that you have the token you can collect payments easer the next for the same user, (*10)

    // Repeat or return customer payment.
    $card = new Mygate\Card($token, $connect);
    $card->setCvv('123'); // Client only needs to enter the CVV number
    $card->pay("100.00", "Second test payment");

Deregistering a card from myGate

This will remove the card from myGate and tokenisation process will need to be repeated., (*11)

    $card = new Mygate\Card($token, $connect);
    $card->forget();

The Versions

11/05 2016

dev-master

9999999-dev https://github.com/codechap/mygate

PHP integration for mygate.co.za

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Avatar CodeChap

mygate