samyan/omnipay-ecopayz

Ecopayz driver for the Omnipay payment processing library

v2.2.0 2019-05-02 14:17 UTC

This package is auto-updated.

Last update: 2024-10-29 05:40:44 UTC


README

Ecopayz driver for the Omnipay V3 PHP payment processing library

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

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

Installation

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

{
    "require": {
        "samyan/omnipay-ecopayz": "~2.2.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:

  • Ecopayz

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

Purchase Example:

$gateway = Omnipay::create('Ecopayz');

// You code
// { . . . }

$params = array(
	'customerIdAtMerchant' => $customerIdAtMerchant,
	'transactionId' => $transactionId,
	'amount' => $amount,
	'currency' => $currency,
	'notifyUrl' => $notifyUrl,
	'returnUrl' => $returnUrl,
	'cancelUrl' => $cancelUrl
);

$request = $gateway->purchase($params);
$response = $request->send();

if ($response->isRedirect() === true) {
	echo $response->getRedirectUrl();
}

PurchaseComplete Example:

// You code
// { . . . }

$request = $gateway->completePurchase();
$response = $request->send();

// Check if ok
if (!$response->isSuccessful()) {
	return false;
}

// Get XML object
$xml = $response->getData();

$resultCode = (string)$xml->TransactionResult->Code;

// Check transaction status
switch ($resultCode) {
	case '0':
		$state = 'success';
		break;
	case '1':
		$state = 'failed';
		break;
	case '2':
		$state = 'cancelled';
		break;
	case '3':
		$state = 'failed';
		break;
	case '4':
		$state = 'pending';
		break;
	case '5':
		$state = 'cancelled';
}

// You code
// { . . . }

// At the end print the response to Ecopayz  (obligatory for completation of purchase)
echo $response->getXmlData();

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.