Skip to content

ignited/omnipay-zippay

Repository files navigation

Omnipay: ZipPay

ZipPay gateway for the Omnipay PHP payment processing library

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

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

Install

Install the gateway using require. Require the league/omnipay base package and this gateway.

$ composer require league/omnipay ignited/omnipay-zippay

Usage

The following gateways are provided by this package:

  • ZipPay

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

A quick example looks something like this:

Process your Authorization

$omniZip = Omnipay::create('ZipPay_Rest');
$omniZip->setApiKey($zipApiKey);
$authTx = $omniZip->authorize([
  'reference'=> $ref,
  'amount' => 10.00,
  'currency' => 'AUD',
  'returnUrl' => 'https://mysite.com/zip/return',
  'card' => $this->OmniPayCardFactory(), //Customers Details, no credit card number
  'items' => $this->zipItemList(), // Array of items implementing Omnipay\ZipPay\ItemInterface   
]);
$result = $authTx->send();
if($response->isRedirect()) { // Authorize worked
  $resData = $result->getData();
  $this->saveAuthorizeId($resData['id']);
  $response->redirect(); //Sends customer off to ZipPay to complete signup
}

Return url (eg /zip/return)

if (!isset($_REQUEST['result']) || $_REQUEST['result'] !== 'approved') 
  throw new \RuntimeError('Problem with your authorization');
$omniZip = Omnipay::create('ZipPay_Rest');
$omniZip->setApiKey($zipApiKey);
$compTx = $omniZip->completeAuthorize([
  'authorityType' => 'checkout_id',
  'authorityValue' => $this->getAuthorizeId(),
  'amount' => 10.00,
  'currency' => 'AUD',
  'captureFunds' => true;
]);
$result = $compTx->send();
if($result->isSuccessful())
  $this->paid();
else
  $this->paymentFailed();

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 announcements, 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.

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email daniel@ignitedlabs.com.au instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.