1. Go to this page and download the library: Download dbt/moneris-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dbt / moneris-api example snippets
composer
use CraigPaul\Moneris\Moneris;
use CraigPaul\Moneris\Values\Environment;
$moneris = new Moneris(
id: 'store2',
token: 'yesguy',
environment: Environment::testing(),
avs: true, // defaults to false
cvd: true, // defaults to false
cof: true, // defaults to false
);
$gateway = $moneris->connect();
use CraigPaul\Moneris\Moneris;
use CraigPaul\Moneris\Values\Environment;
$gateway = Moneris::connect(
id: 'store2',
token: 'yesguy',
environment: Environment::testing(),
avs: true, // defaults to false
cvd: true, // defaults to false
cof: true, // defaults to false
);
$params = [
'order_id' => uniqid('1234-56789', true),
'amount' => '1.00',
'data_key' => $key,
'payment_indicator' => 'U',
'payment_information' => '2',
'issuer_id' => $issuer_id // this is optional
];
$response = $vault->purchase($params); // could be purchase, preauth, etc.
use CraigPaul\Moneris\Moneris;
$vault = Moneris::vault(
id: 'store2',
token: 'yesguy',
environment: Environment::testing(),
avs: true, // defaults to false
cvd: true, // defaults to false
cof: true, // defaults to false
);
// Or if you already have the Gateway instantiated:
$vault = $gateway->cards();
// Or
$value = $gateway->vault();
use CraigPaul\Moneris\CreditCard;
...
$card = CreditCard::create('4242424242424242', '2012');
$response = $vault->add($card);
use CraigPaul\Moneris\Validation\Errors\ErrorList
// The following example would be returned when you forget to set the `order_id` on your transaction.
$errors = new Errorlist(
new \CraigPaul\Moneris\Validation\Errors\NotSetError('order_id')
);
amount - The amount of the transaction. (string)
authorization - The authorization code for the transaction. (string)
avs_result - The avs result code for the transaction. (string)
card - The card type used for the transaction. (string)
code - The response code for the transaction. (string)
complete - Whether the transaction had completed correctly or not. (boolean)
cvd_result - The cvd result code. (string)
data - The data related to the customer and card for the transaction. (array)
date - The date of the transaction. (string)
id - The Moneris id of the receipt. (string)
iso - The ISO code for the transaction. (string)
key - The data key used for vault transactions. (string)
message - Any relevant message provided for the transaction. (string)
reference - The reference number for the transaction. (string)
time - The time of the transaction. (string)
transaction - The Moneris id of the transaction. (string)
type - The transaction type. (string)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.