Download the PHP package ironkeith/moneris-eselectplus-api without Composer

On this page you can find all versions of the php package ironkeith/moneris-eselectplus-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package moneris-eselectplus-api

Moneris-eSELECTplus-API

The PHP API Moneris supplies for eSelectPlus is a terrible mess that throws warnings like they were candy at a parade. This is a simple replacement for people who like PHP5, and hate errors.

Note: as of right now, I've only writting support for purchase, verify, pre-auth, capture, and refund operations. I've also included support for AVS/CVD verification.

Get Started

The first step is to set up your config, and get your Moneris gateway object:

$config = array(
    'api_key' => 'yesguy',
    'store_id' => 'store1',
    'environment' => Moneris::ENV_TESTING
);
$moneris = Moneris::create($config);

There are some handy optional params for the config as well:

$config = array(
    'api_key' => 'yesguy',
    'store_id' => 'store1',
    'environment' => Moneris::ENV_TESTING,
    // optional:
    'require_avs' => true, // default: false
    'avs_codes' => array('A','B', 'D', 'M', 'P', 'W', 'X', 'Y', 'Z'), // default
    'require_cvd' => true, // default: true
    'cvd_codes' => array('M', 'Y', 'P', 'S', 'U') // default
);

To make a purchase is pretty straight forward:

// set up $moneris like we did ^^ up there
$params = array(
    'cc_number' => '4242424242424242',
    'order_id' => 'test' . date("dmy-G:i:s"),
    'amount' => '20.00',
    'expiry_month' => date('m', $time),
    'expiry_year' => date('y', $time)
);
$result = $moneris->purchase($params);

The result object lets you know how everything went:

$result->was_successful(); // did the transaction work?
$result->failed_avs(); // did the transaction pass the AVS check?
$result->failed_cvd(); // did the transaction pass the CVD check?
$result->error_message(); // if something went wrong, what was it?

A common workflow might look like this:

$errors = array();
$result = $moneris->purchase($params);

if ($result->was_successful()) {
    // HOORAY! Party like it's 1999.
} else {
    $errors[] = $result->error_message();
}

There's one caveat though! If a transaction fails AVS/CVD, you still have to void it! An easy way to work around that is to verify the card first!

$errors = array();
$verification_result = $moneris->verify($params);

if ($verification_result->was_successful() && $verification_result->passed_avs() && $verification_result->passed_cvd()) {

    $purchase_result = $moneris->purchase($params);

    if ($purchase_result->was_successful()) {
        // HOORAY! Party like it's 1999.
    } else {
        $errors[] = $result->error_message();
    }

} 

Or:

$errors = array();
$purchase_result = $moneris->purchase($params);

if ($purchase_result->was_successful() && ( $purchase->failed_avs() || $purchase_result->failed_cvd() )) {
    $errors[] = $purchase_result->error_message();
    $void = $moneris->void($purchase_result->transaction());
} else if (! $purchase_result->was_successful()) {
    $errors[] = $purchase_result->error_message();
} else {
    // OMG we're rich!
}

You can view the transaction details via the transaction object.

$result = $moneris->purchase($params);
$transaction = $result->transaction();

You can learn some nift stuff from it, as well as see the XML returned by Moneris.

$transaction->number(); // receipt->TransID from the Moneris XML response
$transaction->amount(); // amount processed
$transaction->response(); // the SimpleXMLElement from the parsed Moneris response.

The capture, void, and refund methods can all accept a transaction object as the first param:

$result = $moneris->purchase($params);
$moneris->refund($result->transaction()); // refund the full purchase
$moneris->refund($result->transaction(), null, '5.00'); // refund $5.00
// OR
$moneris->refund($result->transaction()->number(), $params['order_id'], $params['amount']); // refund the full purchase
$moneris->refund($result->transaction()->number(), $params['order_id'], '5.00'); // refund $5.00

$result = $moneris->preauth($params);
$moneris->capture($result->transaction());
// OR
$moneris->capture($result->transaction()->number(), $params['order_id'], $params['amount']);

$result = $moneris->purchase($params);
$moneris->void($result->transaction());
// OR
$moneris->void($result->transaction()->number(), $params['order_id']);

Lemme know if you have any questions. @ironkeith on the Twitters.


All versions of moneris-eselectplus-api with dependencies

PHP Build Version
Package Version
Requires php Version >=5.2.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ironkeith/moneris-eselectplus-api contains the following files

Loading the files please wait ....