/**
  * Get a dang gateway!
  *
  * @return Moneris_Gateway
  */
 protected function _gateway($params = array())
 {
     $default_params = array('api_key' => 'yesguy', 'store_id' => $this->_store, 'environment' => Moneris::ENV_TESTING);
     return Moneris::create(array_merge($default_params, $params));
 }
<?php

require '../lib/Moneris.php';
$errors = array();
if (!empty($_POST)) {
    // use the testing server for the demo:
    $moneris = Moneris::create(array('api_key' => 'yesguy', 'store_id' => 'store1', 'environment' => Moneris::ENV_STAGING));
    // generate a unique transaction ID:
    $_POST['transaction']['order_id'] = uniqid('ks_api', true);
    try {
        // try to make the purchase:
        $result = $moneris->purchase($_POST['transaction']);
        if ($result->was_successful()) {
            // hooray!
            die("Hot diggity dog!");
        } else {
            $errors = $result->errors();
        }
    } catch (Moneris_Exception $e) {
        $errors[] = $e->getMessage();
    }
}
?>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title>Simple Purchase | Keith Silgard's Moneris API</title>
</head>
<body>