phpieces / anz-egate
This is a wrapper for the ANZ payment gateway to make it easier to use.
0.2.0
2017-04-27 11:33 UTC
Requires
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- phpunit/phpunit: ^5.7
- squizlabs/php_codesniffer: ^2.3
This package is not auto-updated.
Last update: 2024-11-01 22:56:56 UTC
README
This is a wrapper for the ANZ payment gateway to make it easier to use. THIS IS NOT PRODUCED BY ANZ, it comes without warranty, However the code is thoughoghly tested and used in production
Installation
Add the repo to your composer file:
{ "require": { "PHPieces/anz-egate": "dev-master" } }
Usage
get fields:
use PHPieces\ANZGateway\ChargeRequest; $fields = ChargeRequest::getFields();
This will give all fields, including those relevant to the merchant details. It is more likely the case that you only want the credit card fields:
use PHPieces\ANZGateway\models\Card; $fields = Card::getFields();
Render:
<? foreach($fields as $label => $name) : ?> <div class="form-group"> <label for="<?= $name ?>"><?= $label ?></label> <input type="text" class="form-control" id="<?= $name ?>" name="<?= $name ?>" > </div> <? endforeach; ?>
Process:
use PHPieces\ANZGateway\enums\FormFields\CardFields; use PHPieces\ANZGateway\Gateway; $gateway = Gateway::create(); $gateway->setAccessCode('mycode'); $gateway->setMerchantID('myid'); $response = $gateway->purchase([ // This field must be unique for every transaction attempt. 'vpc_MerchTxnRef' => 'mymerchid', // This field will show up on the merchant account and is the primary way to search for transactions. 'vpc_OrderInfo' => 'orderid', // cents AUD 'vpc_Amount' => '100', // using the available enum values for the form fields CardFields::CARD_NUMBER => $_POST[CardFields::CARD_NUMBER], //YYmm CardFields::CARD_EXPIRY_DATE => $_POST[CardFields::CARD_EXPIRY_DATE], // code from back of card CardFields::CARD_SECURITY_CODE => $_POST[CardFields::CARD_SECURITY_CODE], ])->send(); if($response->isSuccess()) { //proceed... } else { $error = $response->getMessage(); }
License
The MIT License (MIT). Please see License File for more information.