My Profile_


Purchase

NEW!   We now have our Interactive tool for this section.

A Purchase verifies funds on the customer’s card, removes the funds and prepares them for deposit into the merchant’s account.

Canada Code Sample

<?php
##
## Example php -q TestPurchase.php store1
##
require "../../mpgClasses.php";
/**************************** Request Variables *******************************/
$store_id='store5';
$api_token='yesguy';
/************************* Transactional Variables ****************************/
$type='purchase';
$cust_id='cust id';
$order_id='ord-'.date("dmy-G:i:s");
$amount='1.00';
$pan='4242424242424242';
$expiry_date='2011';
$crypt='7';
$dynamic_descriptor='123';
$status_check = 'false';

/*********************** Transactional Associative Array **********************/
$txnArray=array('type'=>$type,
     		    'order_id'=>$order_id,
     		    'cust_id'=>$cust_id,
    		    'amount'=>$amount,
   			    'pan'=>$pan,
   			    'expdate'=>$expiry_date,
   			    'crypt_type'=>$crypt,
   			    'dynamic_descriptor'=>$dynamic_descriptor
				//,'wallet_indicator' => '' //Refer to documentation for details
				//,'cm_id' => '8nAK8712sGaAkls56' //set only for usage with Offlinx - Unique max 50 alphanumeric characters transaction id generated by merchant
   		       );
/**************************** Transaction Object *****************************/
$mpgTxn = new mpgTransaction($txnArray);
/******************* Credential on File **********************************/
$cof = new CofInfo();
$cof->setPaymentIndicator("U");
$cof->setPaymentInformation("2");
$cof->setIssuerId("168451306048014");
$mpgTxn->setCofInfo($cof);
/****************************** Request Object *******************************/
$mpgRequest = new mpgRequest($mpgTxn);
$mpgRequest->setProcCountryCode("CA"); //"US" for sending transaction to US environment
$mpgRequest->setTestMode(true); //false or comment out this line for production transactions
/***************************** HTTPS Post Object *****************************/
/* Status Check Example
$mpgHttpPost  =new mpgHttpsPostStatus($store_id,$api_token,$status_check,$mpgRequest);
*/
$mpgHttpPost = new mpgHttpsPost($store_id,$api_token,$mpgRequest);
/******************************* Response ************************************/
$mpgResponse=$mpgHttpPost->getMpgResponse();
print("\nCardType = " . $mpgResponse->getCardType());
print("\nTransAmount = " . $mpgResponse->getTransAmount());
print("\nTxnNumber = " . $mpgResponse->getTxnNumber());
print("\nReceiptId = " . $mpgResponse->getReceiptId());
print("\nTransType = " . $mpgResponse->getTransType());
print("\nReferenceNum = " . $mpgResponse->getReferenceNum());
print("\nResponseCode = " . $mpgResponse->getResponseCode());
print("\nISO = " . $mpgResponse->getISO());
print("\nMessage = " . $mpgResponse->getMessage());
print("\nIsVisaDebit = " . $mpgResponse->getIsVisaDebit());
print("\nAuthCode = " . $mpgResponse->getAuthCode());
print("\nComplete = " . $mpgResponse->getComplete());
print("\nTransDate = " . $mpgResponse->getTransDate());
print("\nTransTime = " . $mpgResponse->getTransTime());
print("\nTicket = " . $mpgResponse->getTicket());
print("\nTimedOut = " . $mpgResponse->getTimedOut());
print("\nStatusCode = " . $mpgResponse->getStatusCode());
print("\nStatusMessage = " . $mpgResponse->getStatusMessage());
print("\nHostId = " . $mpgResponse->getHostId());
print("\nIssuerId = " . $mpgResponse->getIssuerId());
?>

                

Purchase - Transaction Values

$txnArray=array('type'=>'purchase',... );

$mpgTxn = new mpgTransaction($txnArray);

$mpgRequest = new mpgRequest($mpgTxn);


Purchase object mandatory values

Value Type Limits Set methods/variables Description
Order ID String 50-character alphanumeric 'order_id'=>$order_id Merchant-defined transaction identifier that must be unique for every Purchase, Pre-Authorization and Independent Refund transaction. No two transactions of these types may have the same order ID.

For Refund, Completion and Purchase Correction transactions, the order ID must be the same as that of the original transaction.

The last 10 characters of the order ID are displayed in the “Invoice Number” field on the Merchant Direct Reports. However only letters, numbers and spaces are sent to Merchant Direct.

A minimum of 3 and a maximum of 10 valid characters are sent to Merchant Direct. Only the last characters beginning after any invalid characters are sent. For example, if the order ID is 1234-567890, only 567890 is sent to Merchant Direct.

If the order ID has fewer than 3 characters, it may display a blank or 0000000000 in the Invoice Number field.
Amount String 10-character decimal 'amount'=>$amount Transaction amount This must contain at least 3 digits, two of which are penny values.

The minimum allowable value is $0.01, and the maximum allowable value is $9999999.99. Transaction amounts of $0.00 are not allowed.
Credit card number String 20-character numeric 'pan'=>$pan Most credit card numbers today are 16 digits, but some 13-digit numbers are still accepted by some issuers. This field has been intentionally expanded to 20 digits in consideration for future expansion and potential support of private label card ranges.
Expiry date String 4-character numeric

YYMM format.
'expdate'=>$expiry_date Submit in YYMM format.

Note: This is the reverse of the date displayed on the physical card, which is MMYY.
E-Commerce indicator String 1-character alphanumeric 'crypt_type'=>$crypt

Describes the category of e-commerce transaction being processed. Allowable values are:


  • 1 - Mail Order / Telephone Order—Single
  • 2 - Mail Order / Telephone Order—Recurring
  • 3 - Mail Order / Telephone Order—Instalment
  • 4 - Mail Order / Telephone Order—Unknown classification
  • 5 - Authenticated e-commerce transaction (VBV)
  • 6 - Non-authenticated e-commerce transaction (VBV)
  • 7 - SSL-enabled merchant

In Credential on File transactions where the request field e-commerce indicator is also being sent: the allowable values for e-commerce indicator are dependent on the value sent for payment indicator, as follows:


if payment indicator = R, then allowable values for e-commerce indicator: 2, 5 or 6
if payment indicator = C, then allowable values for e-commerce indicator: 1, 5, 6 or 7
if payment indicator = U, then allowable values for e-commerce indicator: 1 or 7
if payment indicator = Z, then allowable values for e-commerce indicator: 1, 5, 6 or 7

Purchase optional values

Value Type Limits Set method Description
Status Check Boolean true/false $mpgHttpPost = new mpgHttpsPostStatus($store_id,$api_token,$status_check,$mpgRequest); Status Check is a connection object value that allows merchants to verify whether a previously sent transaction was processed successfully. To submit a Status Check request, resend the original transaction with all the same parameter values, but set the status check value to either true or false. Once set to “true”, the gateway will check the status of a transaction that has an order_id that matches the one passed.
  • If the transaction is found, the gateway will respond with the specifics of that transaction.
  • If the transaction is not found, the gateway will respond with a not found message.
  • Once it is set to “false”, the transaction will process as a new transaction.
Things to consider:
  • The Status Check request should only be used once and immediately (within 2 minutes) after the last transaction that had failed.
  • Do not resend the Status Check request if it has timed out. Additional investigation is required.
Customer ID String 50-character alphanumeric 'cust_id' This can be used for policy number, membership number, student ID, invoice number.

This field is searchable from the Moneris Merchant Resource Centre.
COF Info Object $mpgTxn->setCofInfo($cof); Refer to Purchase with Credential on File
Dynamic descriptor String 20-character alphanumeric 'dynamic_descriptor' Merchant defined description sent on a per-transaction basis that will appear on the credit card statement.  Dependent on the card Issuer, the statement will typically show the dynamic descriptor appended to the merchant's existing business name separated by the "/" character.  Please note that the combined length of the merchant's business name, forward slash "/" character, and the dynamic descriptor may not exceed 22 characters.

-Example-

Existing Business Name:  ABC Painting

Dynamic Descriptor:  Booking 12345

Cardholder Statement Displays:  ABC Painting/Booking 1         

Customer Information Object $mpgCustInfo = new mpgCustInfo();

$mpgTxn->setCustInfo($mpgCustInfo);
Refer below for further breakdown and definition.
AVS Information Object $mpgAvsInfo = new mpgAvsInfo ($avsTemplate);

$mpgTxn->setAvsInfo($mpgAvsInfo);
Refer below for further breakdown and definition.
CVD Information Object $mpgCvdInfo = new mpgCvdInfo ($cvdTemplate);

$mpgTxn->setCvdInfo($mpgCvdInfo);
Refer below for further breakdown and definition.
Recurring Billing Object $mpgRecur = new mpgRecur($recurArray);

$mpgTxn->setRecur($mpgRecur);
Refer below for further breakdown and definition.
Convenience Fee Object $mpgConvFee = new mpgConvFeeInfo($convFeeTemplate);

$mpgTxn = new mpgTransaction($txnArray);
Refer below for further breakdown and definition.

Please note, if the Convenience Fee is set, then Recurring Billing is not supported.

Purchase With Customer Information

An optional add-on to a number of transactions the Customer Information object. The Customer Information object offers a number of fields to be submitted as part of the financial transaction, and stored by Moneris. These details may be viewed in the future in the Merchant Resource Center.

Canada Code Sample

<?php
## Example php -q TestPurchase-CustInfo.php
require "../../mpgClasses.php";
/************************ Request Variables ***************************/
$store_id='store5';
$api_token='yesguy';
/********************* Transactional Variables ************************/
$type='purchase';
$order_id='ord-'.date("dmy-G:i:s");
$cust_id='my cust id';
$amount='1.00';
$pan='4242424242424242';
$expiry_date='0812';		//December 2008
$crypt='7';
/******************* Customer Information Variables ********************/
$first_name = 'Cedric';
$last_name = 'Benson';
$company_name = 'Chicago Bears';
$address = '334 Michigan Ave';
$city = 'Chicago';
$province = 'Illinois';
$postal_code = 'M1M1M1';
$country = 'United States';
$phone_number = '453-989-9876';
$fax = '453-989-9877';
$tax1 = '1.01';
$tax2 = '1.02';
$tax3 = '1.03';
$shipping_cost = '9.95';
$email ='Joe@widgets.com';
$instructions ="Make it fast";
/*********************** Line Item Variables **************************/
$item_name[0] = 'Guy Lafleur Retro Jersey';
$item_quantity[0] = '1';
$item_product_code[0] = 'JRSCDA344';
$item_extended_amount[0] = '129.99';
$item_name[1] = 'Patrick Roy Signed Koho Stick';
$item_quantity[1] = '1';
$item_product_code[1] = 'JPREEA344';
$item_extended_amount[1] = '59.99';
/******************** Customer Information Object *********************/
$mpgCustInfo = new mpgCustInfo();
/********************** Set Customer Information **********************/
$billing = array(
				 'first_name' => $first_name,
                 'last_name' => $last_name,
                 'company_name' => $company_name,
                 'address' => $address,
                 'city' => $city,
                 'province' => $province,
                 'postal_code' => $postal_code,
                 'country' => $country,
                 'phone_number' => $phone_number,
                 'fax' => $fax,
                 'tax1' => $tax1,
                 'tax2' => $tax2,
                 'tax3' => $tax3,
                 'shipping_cost' => $shipping_cost
                 );
$mpgCustInfo->setBilling($billing);
$shipping = array(
				 'first_name' => $first_name,
                 'last_name' => $last_name,
                 'company_name' => $company_name,
                 'address' => $address,
                 'city' => $city,
                 'province' => $province,
                 'postal_code' => $postal_code,
                 'country' => $country,
                 'phone_number' => $phone_number,
                 'fax' => $fax,
                 'tax1' => $tax1,
                 'tax2' => $tax2,
                 'tax3' => $tax3,
                 'shipping_cost' => $shipping_cost
                 );
$mpgCustInfo->setShipping($shipping);
$mpgCustInfo->setEmail($email);
$mpgCustInfo->setInstructions($instructions);
/*********************** Set Line Item Information *********************/
$item[0] = array(
			   'name'=>$item_name[0],
               'quantity'=>$item_quantity[0],
               'product_code'=>$item_product_code[0],
               'extended_amount'=>$item_extended_amount[0]
               );
$item[1] = array(
			   'name'=>$item_name[1],
               'quantity'=>$item_quantity[1],
               'product_code'=>$item_product_code[1],
               'extended_amount'=>$item_extended_amount[1]
               );
$mpgCustInfo->setItems($item[0]);
$mpgCustInfo->setItems($item[1]);
/***************** Transactional Associative Array ********************/
$txnArray=array(
				'type'=>$type,
		        'order_id'=>$order_id,
		        'cust_id'=>$cust_id,
		        'amount'=>$amount,
		        'pan'=>$pan,
		        'expdate'=>$expiry_date,
		        'crypt_type'=>$crypt
	           );
/********************** Transaction Object ****************************/
$mpgTxn = new mpgTransaction($txnArray);
/******************** Set Customer Information ************************/
$mpgTxn->setCustInfo($mpgCustInfo);
/************************* Request Object *****************************/
$mpgRequest = new mpgRequest($mpgTxn);
$mpgRequest->setProcCountryCode("CA"); //"US" for sending transaction to US environment
$mpgRequest->setTestMode(true); //false or comment out this line for production transactions
/************************ HTTPS Post Object ***************************/
$mpgHttpPost  =new mpgHttpsPost($store_id,$api_token,$mpgRequest);
/****************8********** Response *********************************/
$mpgResponse=$mpgHttpPost->getMpgResponse();
print("\nCardType = " . $mpgResponse->getCardType());
print("\nTransAmount = " . $mpgResponse->getTransAmount());
print("\nTxnNumber = " . $mpgResponse->getTxnNumber());
print("\nReceiptId = " . $mpgResponse->getReceiptId());
print("\nTransType = " . $mpgResponse->getTransType());
print("\nReferenceNum = " . $mpgResponse->getReferenceNum());
print("\nResponseCode = " . $mpgResponse->getResponseCode());
print("\nISO = " . $mpgResponse->getISO());
print("\nMessage = " . $mpgResponse->getMessage());
print("\nIsVisaDebit = " . $mpgResponse->getIsVisaDebit());
print("\nAuthCode = " . $mpgResponse->getAuthCode());
print("\nComplete = " . $mpgResponse->getComplete());
print("\nTransDate = " . $mpgResponse->getTransDate());
print("\nTransTime = " . $mpgResponse->getTransTime());
print("\nTicket = " . $mpgResponse->getTicket());
print("\nTimedOut = " . $mpgResponse->getTimedOut());
?>
                

Purchase - Transaction Values

$txnArray=array('type'=>'purchase',... );

$mpgTxn = new mpgTransaction($txnArray);

$mpgRequest = new mpgRequest($mpgTxn);


Purchase object mandatory values

Value Type Limits Set methods/variables Description
Order ID String 50-character alphanumeric 'order_id' Merchant-defined transaction identifier that must be unique for every Purchase, Pre-Authorization and Independent Refund transaction. No two transactions of these types may have the same order ID.

For Refund, Completion and Purchase Correction transactions, the order ID must be the same as that of the original transaction.

The last 10 characters of the order ID are displayed in the “Invoice Number” field on the Merchant Direct Reports. However only letters, numbers and spaces are sent to Merchant Direct.

A minimum of 3 and a maximum of 10 valid characters are sent to Merchant Direct. Only the last characters beginning after any invalid characters are sent. For example, if the order ID is 1234-567890, only 567890 is sent to Merchant Direct.

If the order ID has fewer than 3 characters, it may display a blank or 0000000000 in the Invoice Number field.
Amount String 10-character decimal 'amount' Transaction amount This must contain at least 3 digits, two of which are penny values.

The minimum allowable value is $0.01, and the maximum allowable value is $9999999.99. Transaction amounts of $0.00 are not allowed.
Credit card number String 20-character numeric 'pan' Most credit card numbers today are 16 digits, but some 13-digit numbers are still accepted by some issuers. This field has been intentionally expanded to 20 digits in consideration for future expansion and potential support of private label card ranges.
Expiry date String 4-character numeric

YYMM format.
'expdate' Submit in YYMM format.

Note: This is the reverse of the date displayed on the physical card, which is MMYY.
E-Commerce indicator String 1-character alphanumeric 'crypt_type'

Describes the category of e-commerce transaction being processed. Allowable values are:


  • 1 - Mail Order / Telephone Order—Single
  • 2 - Mail Order / Telephone Order—Recurring
  • 3 - Mail Order / Telephone Order—Instalment
  • 4 - Mail Order / Telephone Order—Unknown classification
  • 5 - Authenticated e-commerce transaction (VBV)
  • 6 - Non-authenticated e-commerce transaction (VBV)
  • 7 - SSL-enabled merchant

In Credential on File transactions where the request field e-commerce indicator is also being sent: the allowable values for e-commerce indicator are dependent on the value sent for payment indicator, as follows:


if payment indicator = R, then allowable values for e-commerce indicator: 2, 5 or 6
if payment indicator = C, then allowable values for e-commerce indicator: 1, 5, 6 or 7
if payment indicator = U, then allowable values for e-commerce indicator: 1 or 7
if payment indicator = Z, then allowable values for e-commerce indicator: 1, 5, 6 or 7

Purchase optional values

Value Type Limits Set method Description
Status Check Boolean true/false $mpgHttpPost = new mpgHttpsPostStatus($store_id,$api_token,$status_check,$mpgRequest); Status Check is a connection object value that allows merchants to verify whether a previously sent transaction was processed successfully. To submit a Status Check request, resend the original transaction with all the same parameter values, but set the status check value to either true or false. Once set to “true”, the gateway will check the status of a transaction that has an order_id that matches the one passed.
  • If the transaction is found, the gateway will respond with the specifics of that transaction.
  • If the transaction is not found, the gateway will respond with a not found message.
  • Once it is set to “false”, the transaction will process as a new transaction.
Things to consider:
  • The Status Check request should only be used once and immediately (within 2 minutes) after the last transaction that had failed.
  • Do not resend the Status Check request if it has timed out. Additional investigation is required.
Customer ID String 50-character alphanumeric 'cust_id' This can be used for policy number, membership number, student ID, invoice number.

This field is searchable from the Moneris Merchant Resource Centre.
COF Info Object $mpgTxn->setCofInfo($cof); Refer to Purchase with Credential on File
Dynamic descriptor String 20-character alphanumeric 'dynamic_descriptor' Merchant defined description sent on a per-transaction basis that will appear on the credit card statement.  Dependent on the card Issuer, the statement will typically show the dynamic descriptor appended to the merchant's existing business name separated by the "/" character.  Please note that the combined length of the merchant's business name, forward slash "/" character, and the dynamic descriptor may not exceed 22 characters.

-Example-

Existing Business Name:  ABC Painting

Dynamic Descriptor:  Booking 12345

Cardholder Statement Displays:  ABC Painting/Booking 1

Customer Information Object $mpgCustInfo = new mpgCustInfo();

$mpgTxn->setCustInfo($mpgCustInfo);
Refer below for further breakdown and definition.
AVS Information Object $mpgAvsInfo = new mpgAvsInfo ($avsTemplate);

$mpgTxn->setAvsInfo($mpgAvsInfo);
Refer below for further breakdown and definition.
CVD Information Object $mpgCvdInfo = new mpgCvdInfo ($cvdTemplate);

$mpgTxn->setCvdInfo($mpgCvdInfo);
Refer below for further breakdown and definition.
Recurring Billing Object $mpgRecur = new mpgRecur($recurArray);

$mpgTxn->setRecur($mpgRecur);
Refer below for further breakdown and definition.
Convenience Fee Object $mpgConvFee = new mpgConvFeeInfo($convFeeTemplate);

$mpgTxn = new mpgTransaction($txnArray);
Refer below for further breakdown and definition.

Please note, if the Convenience Fee is set, then Recurring Billing is not supported.

mpgCustInfo object mandatory properties

Value Type Limits Set method / Variable Decription
Email Address String 60-character alphanumeric $mpgCustInfo->setEmail($email); Customer email address.
Instructions String 100-character alphanumeric $mpgCustInfo->setInstructions($instructions); Instructions or notes.
Billing Information Object $mpgCustInfo->setBilling($billing); Billing information is stored as part of the mpgCustInfo object. A maximum of 1 billing object may be set. They can be written to the object using hash tables.



Refer below for further breakdown and definition.
Shipping Information Object $mpgCustInfo->setShipping($shipping); Shipping information is stored as part of the mpgCustInfo object. A maximum of 1 shipping object may be set. They can be written to the object using hash tables.



Refer below for further breakdown and definition.
Items Array Object $mpgCustInfo->setItems($item1); Item information is stored as part of the mpgCustInfo object. Multiple items may be set. They can be written to the object using hash tables.



Refer below for further breakdown and definition.

Setting Billing & Shipping using Hash Tables

Writing billing or shipping information using hash tables is done as follows:

  1. Instantiate an mpgCustInfo object.
  2. Build the hashtable using put methods with the hash table keys in the table below.
  3. Call the mpgCustInfo object's setBilling()/setShipping() method to pass the hashtable information to the mpgCustInfo object
  4. Call the mpgTransaction object's setCustInfo() method to write the CustInfo object (with the billing/shipping information to the transaction object.

Billing & Shipping mandatory values

Value Type Limits Variable/Hash Table Key Description
First Name String 30-character alphanumeric 'first_name' Customer first name
Last Name String 30-character alphanumeric 'last_name' Customer last name
Company Name String 50-character alphanumeric 'company_name' Customer 's company name
Address String 70-character alphanumeric 'address' Customer's address
City String 30-character alphanumeric 'city' Customer's city
Province / State String 30-character alphanumeric 'province' Customer's province or state
Postal / Zip Code String 30-character alphanumeric 'postal_code' Customer's postal or zip code
Country String 30-character alphanumeric 'country' Customer's country
Phone Number String 30-character alphanumeric 'phone_number' Customer's phone number
Fax Number String 30-character alphanumeric 'fax' Customer's fax number
Federal Tax String 10-character alphanumeric 'tax1' Federal tax amount. Amount is not used for calculating total amount.
Provincial / State Tax String 10-character alphanumeric 'tax2' Provincial or state tax amount. Amount is not used for calculating total amount.
Country / Local / Specialty Tax String 10-character alphanumeric 'tax3' County, local or specialty tax amount. Amount is not used for calculating total amount.
Shipping Cost String 10-character alphanumeric 'shipping_cost' Shipping cost. Amount is not used for calculating total amount.

Setting Items using Hash Tables

Writing item information using hash tables is done as follows:

  1. Instantiate an mpgCustInfo object.
  2. Build the hashtable using put methods with the hash table keys in the table below. (The sample code uses a different hash table for each item for clarity purposes. However, the skillful developer can re-use the same one.)
  3. Call the mpgCustInfo object's setItems() method to pass the hashtable information to the mpgCustInfo object
  4. Call the mpgTransaction object's setCustInfo() method to write the mpgCustInfo object (with the item information to the transaction object).

Item mandatory values

Value Type Limits Variable/Hash Table Key Description
Item Name String 45-character alphanumeric 'name' Item name or description.
Item Quantity String 5-character numeric 'quantity' You must send a quantity > 0 or the item will not be added to the item list (i.e. minimum 1, maximum 99999)
Item Product Code String 20-character alphanumeric 'product_code' Item product code or SKU.
Item Extended Amount String 9-character decimal 'extended_amount' Must contain at least 3 digits and 2 penny values.

0.01-999999.99

Purchase with CVD & AVS

The Card Validation Digits (CVD) value refers to the numbers appearing on the back of the credit card rather than the numbers imprinted on the front1. It is an optional fraud prevention tool that enables merchants to verify data provided by the cardholder at transaction time. This data is submitted along with the transaction to the issuing bank, which provides a response indicating whether the data is a match.

The response that is received from CVD verification is intended to provide added security and fraud prevention, but the response itself does not affect the completion of a transaction. Upon receiving a response, the choice whether to proceed with a transaction is left entirely to the merchant. The responses is not a strict guideline of which transaction will approve or decline.

Address Verification Service (AVS) is an optional fraud-prevention tool offered by issuing banks whereby a cardholder's address is submitted as part of the transaction authorization. The AVS address is then compared to the address kept on file at the issuing bank. AVS checks whether the street number, street name and zip/postal code match. The issuing bank returns an AVS result code indicating whether the data was matched successfully. Regardless of the AVS result code returned, the credit card is authorized by the issuing bank.

The response that is received from AVS verification is intended to provide added security and fraud prevention, but the response itself does not affect the completion of a transaction. Upon receiving a response, the choice to proceed with a transaction is left entirely to the merchant. The responses is not a strict guideline of whether a transaction will be approved or declined.

Things to consider:

  • CVD is only supported by Visa, MasterCard, Discover, JCB, American Express and UnionPay.
  • AVS is only supported by Visa, MasterCard, Discover and American Express.
  • When testing CVD or AVS, you must only use the Visa test card numbers 4242424242424242 or 4005554444444403, and the amounts described in the Simulator eFraud Response Codes Table
  • For a full list of possible AVS & CVD result codes refer to the CVD AVS Result Code table

Security:The CVD value must only be passed to the payment gateway. Under no circumstances may it be stored for subsequent uses or displayed as part of the receipt information.

Note:Please be advised that CVD results will NOT be returned in the response for UnionPay.

Canada Code Sample

<?php
##
## This program takes 3 arguments from the command line:
## 1. Store id
## 2. api token
## 3. order id
##
## Example php -q TestPurchase-Efraud.php store1 45728773 45109
##
require "../../mpgClasses.php";
/************************ Request Variables ***************************/
$store_id='store5';
$api_token='yesguy';
/********************* Transactional Variables ************************/
$type='purchase';
$order_id='ord-'.date("dmy-G:i:s");
$cust_id='my cust id';
$amount='10.30';
$pan='4242424242424242';
$expiry_date='0812';		//December 2008
$crypt='7';
/************************** AVS Variables *****************************/
$avs_street_number = '201';
$avs_street_name = 'Michigan Ave';
$avs_zipcode = 'M1M1M1';
$avs_email = 'test@host.com';
$avs_hostname = 'www.testhost.com';
$avs_browser = 'Mozilla';
$avs_shiptocountry = 'Canada';
$avs_merchprodsku = '123456';
$avs_custip = '192.168.0.1';
$avs_custphone = '5556667777';
/************************** CVD Variables *****************************/
$cvd_indicator = '1';
$cvd_value = '198';
/********************** AVS Associative Array *************************/
$avsTemplate = array(
					 'avs_street_number'=>$avs_street_number,
                     'avs_street_name' =>$avs_street_name,
                     'avs_zipcode' => $avs_zipcode,
                     'avs_hostname'=>$avs_hostname,
					 'avs_browser' =>$avs_browser,
					 'avs_shiptocountry' => $avs_shiptocountry,
					 'avs_merchprodsku' => $avs_merchprodsku,
					 'avs_custip'=>$avs_custip,
					 'avs_custphone' => $avs_custphone
                    );
/********************** CVD Associative Array *************************/
$cvdTemplate = array(
					 'cvd_indicator' => $cvd_indicator,
                     'cvd_value' => $cvd_value
                    );
/************************** AVS Object ********************************/
$mpgAvsInfo = new mpgAvsInfo ($avsTemplate);
/************************** CVD Object ********************************/
$mpgCvdInfo = new mpgCvdInfo ($cvdTemplate);
/***************** Transactional Associative Array ********************/
$txnArray=array(
				'type'=>$type,
       			'order_id'=>$order_id,
       			'cust_id'=>$cust_id,
       			'amount'=>$amount,
       			'pan'=>$pan,
       			'expdate'=>$expiry_date,
       			'crypt_type'=>$crypt
          		);
/********************** Transaction Object ****************************/
$mpgTxn = new mpgTransaction($txnArray);
/************************ Set AVS and CVD *****************************/
$mpgTxn->setAvsInfo($mpgAvsInfo);
$mpgTxn->setCvdInfo($mpgCvdInfo);
/************************ Request Object ******************************/
$mpgRequest = new mpgRequest($mpgTxn);
$mpgRequest->setProcCountryCode("CA"); //"US" for sending transaction to US environment
$mpgRequest->setTestMode(true); //false or comment out this line for production transactions
/*********************** HTTPS Post Object ****************************/
$mpgHttpPost  =new mpgHttpsPost($store_id,$api_token,$mpgRequest);
/*************************** Response *********************************/
$mpgResponse=$mpgHttpPost->getMpgResponse();
print("\nCardType = " . $mpgResponse->getCardType());
print("\nTransAmount = " . $mpgResponse->getTransAmount());
print("\nTxnNumber = " . $mpgResponse->getTxnNumber());
print("\nReceiptId = " . $mpgResponse->getReceiptId());
print("\nTransType = " . $mpgResponse->getTransType());
print("\nReferenceNum = " . $mpgResponse->getReferenceNum());
print("\nResponseCode = " . $mpgResponse->getResponseCode());
print("\nISO = " . $mpgResponse->getISO());
print("\nMessage = " . $mpgResponse->getMessage());
print("\nIsVisaDebit = " . $mpgResponse->getIsVisaDebit());
print("\nAuthCode = " . $mpgResponse->getAuthCode());
print("\nComplete = " . $mpgResponse->getComplete());
print("\nTransDate = " . $mpgResponse->getTransDate());
print("\nTransTime = " . $mpgResponse->getTransTime());
print("\nTicket = " . $mpgResponse->getTicket());
print("\nTimedOut = " . $mpgResponse->getTimedOut());
print("\nAVSResponse = " . $mpgResponse->getAvsResultCode());
print("\nCVDResponse = " . $mpgResponse->getCvdResultCode());
print("\nITDResponse = " . $mpgResponse->getITDResponse());
?>
                

Purchase - Transaction Values

$txnArray=array('type'=>'purchase',... );

$mpgTxn = new mpgTransaction($txnArray);

$mpgRequest = new mpgRequest($mpgTxn);


Purchase object mandatory values

Value Type Limits Set methods/variables Description
Order ID String 50-character alphanumeric 'order_id' Merchant-defined transaction identifier that must be unique for every Purchase, Pre-Authorization and Independent Refund transaction. No two transactions of these types may have the same order ID.

For Refund, Completion and Purchase Correction transactions, the order ID must be the same as that of the original transaction.

The last 10 characters of the order ID are displayed in the “Invoice Number” field on the Merchant Direct Reports. However only letters, numbers and spaces are sent to Merchant Direct.

A minimum of 3 and a maximum of 10 valid characters are sent to Merchant Direct. Only the last characters beginning after any invalid characters are sent. For example, if the order ID is 1234-567890, only 567890 is sent to Merchant Direct.

If the order ID has fewer than 3 characters, it may display a blank or 0000000000 in the Invoice Number field.
Amount String 10-character decimal 'amount' Transaction amount This must contain at least 3 digits, two of which are penny values.

The minimum allowable value is $0.01, and the maximum allowable value is $9999999.99. Transaction amounts of $0.00 are not allowed.
Credit card number String 20-character numeric 'pan' Most credit card numbers today are 16 digits, but some 13-digit numbers are still accepted by some issuers. This field has been intentionally expanded to 20 digits in consideration for future expansion and potential support of private label card ranges.
Expiry date String 4-character numeric

YYMM format.
'expdate' Submit in YYMM format.

Note: This is the reverse of the date displayed on the physical card, which is MMYY.
E-Commerce indicator String 1-character alphanumeric 'crypt_type'

Describes the category of e-commerce transaction being processed. Allowable values are:


  • 1 - Mail Order / Telephone Order—Single
  • 2 - Mail Order / Telephone Order—Recurring
  • 3 - Mail Order / Telephone Order—Instalment
  • 4 - Mail Order / Telephone Order—Unknown classification
  • 5 - Authenticated e-commerce transaction (VBV)
  • 6 - Non-authenticated e-commerce transaction (VBV)
  • 7 - SSL-enabled merchant

In Credential on File transactions where the request field e-commerce indicator is also being sent: the allowable values for e-commerce indicator are dependent on the value sent for payment indicator, as follows:


if payment indicator = R, then allowable values for e-commerce indicator: 2, 5 or 6
if payment indicator = C, then allowable values for e-commerce indicator: 1, 5, 6 or 7
if payment indicator = U, then allowable values for e-commerce indicator: 1 or 7
if payment indicator = Z, then allowable values for e-commerce indicator: 1, 5, 6 or 7

Purchase optional values

Value Type Limits Set method Description
Status Check Boolean true/false $mpgHttpPost = new mpgHttpsPostStatus($store_id,$api_token,$status_check,$mpgRequest); Status Check is a connection object value that allows merchants to verify whether a previously sent transaction was processed successfully. To submit a Status Check request, resend the original transaction with all the same parameter values, but set the status check value to either true or false. Once set to “true”, the gateway will check the status of a transaction that has an order_id that matches the one passed.
  • If the transaction is found, the gateway will respond with the specifics of that transaction.
  • If the transaction is not found, the gateway will respond with a not found message.
  • Once it is set to “false”, the transaction will process as a new transaction.
Things to consider:
  • The Status Check request should only be used once and immediately (within 2 minutes) after the last transaction that had failed.
  • Do not resend the Status Check request if it has timed out. Additional investigation is required.
Customer ID String 50-character alphanumeric 'cust_id' This can be used for policy number, membership number, student ID, invoice number.

This field is searchable from the Moneris Merchant Resource Centre.
COF Info Object $mpgTxn->setCofInfo($cof); Refer to Purchase with Credential on File
Dynamic descriptor String 20-character alphanumeric 'dynamic_descriptor' Merchant defined description sent on a per-transaction basis that will appear on the credit card statement.  Dependent on the card Issuer, the statement will typically show the dynamic desciptor appended to the merchant's existing business name separated by the "/" character.  Please note that the combined length of the merchant's business name, forward slash "/" character, and the dynamic descriptor may not exceed 22 characters.

-Example-

Existing Business Name:  ABC Painting

Dynamic Descriptor:  Booking 12345

Cardholder Statement Displays:  ABC Painting/Booking 1
Customer Information Object $mpgCustInfo = new mpgCustInfo();

$mpgTxn->setCustInfo($mpgCustInfo);
Refer below for further breakdown and definition.
AVS Information Object $mpgAvsInfo = new mpgAvsInfo ($avsTemplate);

$mpgTxn->setAvsInfo($mpgAvsInfo);
Refer below for further breakdown and definition.
CVD Information Object $mpgCvdInfo = new mpgCvdInfo ($cvdTemplate);

$mpgTxn->setCvdInfo($mpgCvdInfo);
Refer below for further breakdown and definition.
Recurring Billing Object $mpgRecur = new mpgRecur($recurArray);

$mpgTxn->setRecur($mpgRecur);
Refer below for further breakdown and definition.
Convenience Fee Object $mpgConvFee = new mpgConvFeeInfo($convFeeTemplate);

$mpgTxn = new mpgTransaction($txnArray);
Refer below for further breakdown and definition.

Please note, if the Convenience Fee is set, then Recurring Billing is not supported.

CvdInfo object mandatory values

Value Type Limits Set method / Variable Description
CVD indicator String 1-character numeric 'cvd_indicator' CVD presence indicator:

0: CVD value is deliberately bypassed or is not provided by the merchant.

1: CVD value is present.

2: CVD value is on the card, but is illegible.

9: Cardholder states that the card has no CVD imprint.
CVD Value String 4-character numeric 'cvd_value' CVD value located on credit card. The CVD value (supplied by the cardholder) must only be passed to the payment gateway. Under no circumstances may it be stored for subsequent use or displayed as part of the receipt information.

AvsInfo object mandatory values

Value Type Limits Set method / Variable Description
AVS street number String 19-character alphanumeric1 'avs_street_number' Cardholder street number.
AVS street name String See AVS street number 'avs_street_name' Cardholder street name.
AVS zip/postal code String 9-character alphanumeric 'avs_zipcode' . Cardholder zip/postal code

CVD & AVS Response Fields

Value Limits Get Method Description
CVD result code 2-character alphanumeric $mpgResponse->getCvdResultCode(); Indicates the CVD validation result. The first byte is the numeric CVD indicator sent in the request; the second byte is the response code. Possible response codes are shown in the CVD Result Code table.
AVS result code 1-character alphanumeric $mpgResponse->getAvsResultCode(); Indicates the address verification result. For a full list of possible response codes refer to the AVS Result Code table.

Purchase with Credential on File

When storing Customer’s credentials for use in future authorizations, or when using these credentials in subsequent transactions, card brands now require merchants to indicate this in the transaction request.


Things to consider:

  • While the requirements for handling credential on file transactions relate to Visa, Mastercard and Discover only, in order to avoid confusion and prevent error, please implement these changes for all card types and the Moneris system will then correctly flow the relevant card data values as appropriate
  • When initially storing cardholder credentials, please be sure to adhere to the following:
    1. Obtain the cardholder’s card verification digits(CVD).
    2. Issuer ID will be sent without value for the initial transaction.
    3. The payment information field will always be a value of 0.
    4. Include cardholder consent prior to cardholder data being stored.
    5. Financial transaction must be approved before storing.

Note:Credential on file transactions are available to Canada Integrations only.


Canada Code Sample

require "../../mpgClasses.php";
 
/**************************** Request Variables *******************************/
 
$store_id='store5';
$api_token='yesguy';
 
/************************* Transactional Variables ****************************/
 
$type='purchase';
$cust_id='cust id';
$order_id='ord-'.date("dmy-G:i:s");
$amount='1.00';
$pan='4242424242424242';
$expiry_date='2011';
$crypt='7';
$dynamic_descriptor='123';
$status_check = 'false';
 
/*********************** Transactional Associative Array **********************/
 
$txnArray=array('type'=>$type,
                                            'order_id'=>$order_id,
                                            'cust_id'=>$cust_id,
                                            'amount'=>$amount,
                                                                'pan'=>$pan,
                                                                'expdate'=>$expiry_date,
                                                                'crypt_type'=>$crypt,
                                                                'dynamic_descriptor'=>$dynamic_descriptor
                                                                                //,'wallet_indicator' => '' //Refer to documentation for details
                                                                                //,'cm_id' => '8nAK8712sGaAkls56' //set only for usage with Offlinx - Unique max 50 alphanumeric characters transaction id generated by merchant
                                               );
 
/**************************** Transaction Object *****************************/
 
$mpgTxn = new mpgTransaction($txnArray);
 
/******************* Credential on File **********************************/
 
$cof = new CofInfo();
$cof->setPaymentIndicator("U");
$cof->setPaymentInformation("2");
$cof->setIssuerId("168451306048014");
 
$mpgTxn->setCofInfo($cof);
 
/****************************** Request Object *******************************/
 
$mpgRequest = new mpgRequest($mpgTxn);
$mpgRequest->setProcCountryCode("CA"); //"US" for sending transaction to US environment
$mpgRequest->setTestMode(true); //false or comment out this line for production transactions
 
/***************************** HTTPS Post Object *****************************/
 
/* Status Check Example
$mpgHttpPost  =new mpgHttpsPostStatus($store_id,$api_token,$status_check,$mpgRequest);
*/
 
$mpgHttpPost = new mpgHttpsPost($store_id,$api_token,$mpgRequest);
 
/******************************* Response ************************************/
 
$mpgResponse=$mpgHttpPost->getMpgResponse();
 
print("\nCardType = " . $mpgResponse->getCardType());
print("\nTransAmount = " . $mpgResponse->getTransAmount());
print("\nTxnNumber = " . $mpgResponse->getTxnNumber());
print("\nReceiptId = " . $mpgResponse->getReceiptId());
print("\nTransType = " . $mpgResponse->getTransType());
print("\nReferenceNum = " . $mpgResponse->getReferenceNum());
print("\nResponseCode = " . $mpgResponse->getResponseCode());
print("\nISO = " . $mpgResponse->getISO());
print("\nMessage = " . $mpgResponse->getMessage());
print("\nIsVisaDebit = " . $mpgResponse->getIsVisaDebit());
print("\nAuthCode = " . $mpgResponse->getAuthCode());
print("\nComplete = " . $mpgResponse->getComplete());
print("\nTransDate = " . $mpgResponse->getTransDate());
print("\nTransTime = " . $mpgResponse->getTransTime());
print("\nTicket = " . $mpgResponse->getTicket());
print("\nTimedOut = " . $mpgResponse->getTimedOut());
print("\nStatusCode = " . $mpgResponse->getStatusCode());
print("\nStatusMessage = " . $mpgResponse->getStatusMessage());
print("\nHostId = " . $mpgResponse->getHostId());
print("\nIssuerId = " . $mpgResponse->getIssuerId());
 
?>

                

Purchase - Transaction Values

$txnArray=array('type'=>'purchase',... );

$mpgTxn = new mpgTransaction($txnArray);

$mpgRequest = new mpgRequest($mpgTxn);


Purchase object mandatory values

Value Type Limits Set methods/variables Description
Order ID String 50-character alphanumeric 'order_id'=>$order_id Merchant-defined transaction identifier that must be unique for every Purchase, Pre-Authorization and Independent Refund transaction. No two transactions of these types may have the same order ID.

For Refund, Completion and Purchase Correction transactions, the order ID must be the same as that of the original transaction.

The last 10 characters of the order ID are displayed in the “Invoice Number” field on the Merchant Direct Reports. However only letters, numbers and spaces are sent to Merchant Direct.

A minimum of 3 and a maximum of 10 valid characters are sent to Merchant Direct. Only the last characters beginning after any invalid characters are sent. For example, if the order ID is 1234-567890, only 567890 is sent to Merchant Direct.

If the order ID has fewer than 3 characters, it may display a blank or 0000000000 in the Invoice Number field.
Amount String 10-character decimal 'amount'=>$amount Transaction amount This must contain at least 3 digits, two of which are penny values.

The minimum allowable value is $0.01, and the maximum allowable value is $9999999.99. Transaction amounts of $0.00 are not allowed.
Credit card number String 20-character numeric 'pan'=>$pan Most credit card numbers today are 16 digits, but some 13-digit numbers are still accepted by some issuers. This field has been intentionally expanded to 20 digits in consideration for future expansion and potential support of private label card ranges.
Expiry date String 4-character numeric

YYMM format.
'expdate'=>$expiry_date Submit in YYMM format.

Note: This is the reverse of the date displayed on the physical card, which is MMYY.
E-Commerce indicator String 1-character alphanumeric 'crypt_type'=>$crypt

Describes the category of e-commerce transaction being processed. Allowable values are:


  • 1 - Mail Order / Telephone Order—Single
  • 2 - Mail Order / Telephone Order—Recurring
  • 3 - Mail Order / Telephone Order—Instalment
  • 4 - Mail Order / Telephone Order—Unknown classification
  • 5 - Authenticated e-commerce transaction (VBV)
  • 6 - Non-authenticated e-commerce transaction (VBV)
  • 7 - SSL-enabled merchant

In Credential on File transactions where the request field e-commerce indicator is also being sent: the allowable values for e-commerce indicator are dependent on the value sent for payment indicator, as follows:


if payment indicator = R, then allowable values for e-commerce indicator: 2, 5 or 6
if payment indicator = C, then allowable values for e-commerce indicator: 1, 5, 6 or 7
if payment indicator = U, then allowable values for e-commerce indicator: 1 or 7
if payment indicator = Z, then allowable values for e-commerce indicator: 1, 5, 6 or 7

Purchase optional values

Value Type Limits Set method Description
Status Check Boolean true/false $mpgHttpPost = new mpgHttpsPostStatus($store_id,$api_token,$status_check,$mpgRequest); Status Check is a connection object value that allows merchants to verify whether a previously sent transaction was processed successfully. To submit a Status Check request, resend the original transaction with all the same parameter values, but set the status check value to either true or false. Once set to “true”, the gateway will check the status of a transaction that has an order_id that matches the one passed.
  • If the transaction is found, the gateway will respond with the specifics of that transaction.
  • If the transaction is not found, the gateway will respond with a not found message.
  • Once it is set to “false”, the transaction will process as a new transaction.
Things to consider:
  • The Status Check request should only be used once and immediately (within 2 minutes) after the last transaction that had failed.
  • Do not resend the Status Check request if it has timed out. Additional investigation is required.
Customer ID String 50-character alphanumeric 'cust_id' This can be used for policy number, membership number, student ID, invoice number.

This field is searchable from the Moneris Merchant Resource Centre.
COF Info Object $mpgTxn->setCofInfo($cof);

For more information, see Definitions of Request Fields – Credential on File below.

Dynamic descriptor String 20-character alphanumeric 'dynamic_descriptor' Merchant defined description sent on a per-transaction basis that will appear on the credit card statement.  Dependent on the card Issuer, the statement will typically show the dynamic descriptor appended to the merchant's existing business name separated by the "/" character.  Please note that the combined length of the merchant's business name, forward slash "/" character, and the dynamic descriptor may not exceed 22 characters.

-Example-

Existing Business Name:  ABC Painting

Dynamic Descriptor:  Booking 12345

Cardholder Statement Displays:  ABC Painting/Booking 1         

Customer Information Object $mpgCustInfo = new mpgCustInfo();

$mpgTxn->setCustInfo($mpgCustInfo);
Refer below for further breakdown and definition.
AVS Information Object $mpgAvsInfo = new mpgAvsInfo ($avsTemplate);

$mpgTxn->setAvsInfo($mpgAvsInfo);
Refer below for further breakdown and definition.
CVD Information Object $mpgCvdInfo = new mpgCvdInfo ($cvdTemplate);

$mpgTxn->setCvdInfo($mpgCvdInfo);
Refer below for further breakdown and definition.
Recurring Billing Object $mpgRecur = new mpgRecur($recurArray);

$mpgTxn->setRecur($mpgRecur);
Refer below for further breakdown and definition.
Convenience Fee Object $mpgConvFee = new mpgConvFeeInfo($convFeeTemplate);

$mpgTxn = new mpgTransaction($txnArray);
Refer below for further breakdown and definition.

Please note, if the Convenience Fee is set, then Recurring Billing is not supported.

Credential on File Info Object and Variables

The Credential on File Info object is nested within the request for the applicable transaction types.

Object:

  • cof

Variables in the cof object:

  • PaymentIndicator
  • PaymentInformation
  • IssuerID


Definitions of Request Fields – Credential on File
Variable Name Type Limits Decription
IssuerID

NOTE: This variable is required for all merchant- intiated transactions following the first one; upon sending the first transaction, the Issuer ID value is received in the transaction response and then used in subsequent transaction requests (IssuerID does not apply for Discover or Union Pay).

String 15-character alphanumeric

Variable length

Unique identifier for the cardholder's stored credentials

Sent back in the response from the card brand when processing a Credential on File transaction

If the cardholder's credentials are being stored for the first time, and the issuer ID was returned in the response, you must save the issuer ID on your system to use in subsequent Credential on File transactions (applies to merchant-initiated transactions only)

The issuer ID must be saved to your systems when returned from Moneris Gateway in the response data, regardless if the value was received or not

As a best practice, if the issuer ID is not returned and you received a value of NULL instead, store that value and send it in the subsequent transaction
Payment Indicator String 1-character alphabetic Indicates the current or intended use of the credentials

Possible values for first transactions:
C - unscheduled Credential on File (first transactions only)
R – recurring

Possible values for subsequent transactions:
R - recurring
U - unscheduled merchant-initiated transaction
Z - unscheduled customer-initiated transaction

In Credential on File transactions where the request field e-commerce indicator is also being sent: the allowable values for e-commerce indicator are dependent on the value sent for payment indicator, as follows:

if payment indicator = R, then allowable values for e-commerce indicator: 2, 5 or 6
if payment indicator = C, then allowable values for e-commerce indicator: 1, 5, 6 or 7
if payment indicator = U, then allowable values for e-commerce indicator: 1 or 7
if payment indicator = Z, then allowable values for e-commerce indicator: 1, 5, 6 or 7
Payment Information String 1-character numeric Describes whether the transaction is the first or subsequent in the series
Possible values are:
0 - first transaction in a series (storing payment details provided by the cardholder)
2 - subsequent transactions (using previously stored payment details)
COF Info Object mandatory values
Value Type Limits Set Method
IssuerID
NOTE: This variable is required for all merchant- intiated transactions following the first one; upon sending the first transaction, the Issuer ID value is received in the transaction response and then used in subsequent transaction requests (IssuerID does not apply for Discover or Union Pay).
String 15-character alphanumeric

variable length
$cof->setIssuerId("VALUE_ FOR_ISSUER_ID");
NOTE: For a list and explanation of the possible values to send for this variable, see Definitions of Request Fields – Credential on File
PaymentIndicator String 1-character alphabetic $cof->setPaymentIndicator ("PAYMENT_INDICATOR_VALUE");
NOTE: For a list and explanation of the possible values to send for this variable, see Definitions of Request Fields – Credential on File
PaymentInformation String 1-character numeric $cof->setPaymentInformation ("PAYMENT_INFO_VALUE");
NOTE: For a list and explanation of the possible values to send for this variable, see Definitions of Request Fields – Credential on File

Purchase with Recurring Billing

NEW!   We now have our Interactive tool for this section.

Verifies funds on the customer’s card, removes the funds and prepares them for deposit into the merchant’s account.

Recurring Billing allows you to set up payments whereby Moneris automatically processes the transactions and bills customers on your behalf based on the billing cycle information you provide.

In addition to instantiating a transaction object and a connection object (as you would for a normal transaction), you must instantiate a Recur object. This object has a number of mandatory properties that must be set.

Any transaction that supports Recurring Billing has a setRecur method. This is used to write the Recurring Billing information to the transaction object before writing the transaction object to the connection object.

Things to consider:

  • To avoid shifting, do not set the start_date after the 28th if the recur_unit is month. To set the billing date for the last day of the month, set recur_unit to eom.

Canada Code Sample

require "../../mpgClasses.php";
 
/**************************** Request Variables *******************************/
 
$store_id = 'store5';
$api_token = 'yesguy';
 
/********************************* Recur Variables ****************************/
$recurUnit = 'eom';
$startDate = '2018/11/30';
$numRecurs = '4';
$recurInterval = '10';
$recurAmount = '31.00';
$startNow = 'true';
 
/************************* Transactional Variables ****************************/
 
$orderId = 'ord-'.date("dmy-G:i:s");
$custId = 'student_number';
$creditCard = '5454545454545454';
$nowAmount = '10.00';
$expiryDate = '0912';
$cryptType = '7';
 
/*********************** Recur Associative Array **********************/
 
$recurArray = array('recur_unit'=>$recurUnit, // (day | week | month)
                                                                                                    'start_date'=>$startDate, //yyyy/mm/dd
                                                                                                    'num_recurs'=>$numRecurs,
                                                                                                    'start_now'=>$startNow,
                                                                                                    'period' => $recurInterval,
                                                                                                    'recur_amount'=> $recurAmount
                                                                                                    );
 
$mpgRecur = new mpgRecur($recurArray);
 
/*********************** Transactional Associative Array **********************/
 
$txnArray=array('type'=>'purchase',
                                                                                'order_id'=>$orderId,
                                                                                'cust_id'=>$custId,
                                                                                'amount'=>$nowAmount,
                                                                                'pan'=>$creditCard,
                                                                                'expdate'=>$expiryDate,
                                                                                'crypt_type'=>$cryptType
                                                                                );
 
/**************************** Transaction Object *****************************/
 
$mpgTxn = new mpgTransaction($txnArray);
 
/****************************** Recur Object *********************************/
 
$mpgTxn->setRecur($mpgRecur);
 
/******************* Credential on File **********************************/
 
$cof = new CofInfo();
$cof->setPaymentIndicator("R");
$cof->setPaymentInformation("2");
$cof->setIssuerId("168451306048014");
 
$mpgTxn->setCofInfo($cof);
 
 
/****************************** Request Object *******************************/
 
$mpgRequest = new mpgRequest($mpgTxn);
$mpgRequest->setProcCountryCode("CA"); //"US" for sending transaction to US environment
$mpgRequest->setTestMode(true); //false or comment out this line for production transactions
 
/***************************** HTTPS Post Object *****************************/
 
$mpgHttpPost = new mpgHttpsPost($store_id,$api_token,$mpgRequest);
 
/******************************* Response ************************************/
 
$mpgResponse=$mpgHttpPost->getMpgResponse();
 
print ("\nCardType = " . $mpgResponse->getCardType());
print("\nTransAmount = " . $mpgResponse->getTransAmount());
print("\nTxnNumber = " . $mpgResponse->getTxnNumber());
print("\nReceiptId = " . $mpgResponse->getReceiptId());
print("\nTransType = " . $mpgResponse->getTransType());
print("\nReferenceNum = " . $mpgResponse->getReferenceNum());
print("\nResponseCode = " . $mpgResponse->getResponseCode());
print("\nISO = " . $mpgResponse->getISO());
print("\nMessage = " . $mpgResponse->getMessage());
print("\nIsVisaDebit = " . $mpgResponse->getIsVisaDebit());
print("\nAuthCode = " . $mpgResponse->getAuthCode());
print("\nComplete = " . $mpgResponse->getComplete());
print("\nTransDate = " . $mpgResponse->getTransDate());
print("\nTransTime = " . $mpgResponse->getTransTime());
print("\nTicket = " . $mpgResponse->getTicket());
print("\nTimedOut = " . $mpgResponse->getTimedOut());
print("\nRecurSuccess = " . $mpgResponse->getRecurSuccess());
print("\nIssuerId = " . $mpgResponse->getIssuerId());
?>
 
 
 

                

Purchase - Transaction Values

$txnArray=array('type'=>'purchase',... );

$mpgTxn = new mpgTransaction($txnArray);

$mpgRequest = new mpgRequest($mpgTxn);


Purchase object mandatory values

Value Type Limits Set methods/variables Description
Order ID String 50-character alphanumeric 'order_id' Merchant-defined transaction identifier that must be unique for every Purchase, Pre-Authorization and Independent Refund transaction. No two transactions of these types may have the same order ID.

For Refund, Completion and Purchase Correction transactions, the order ID must be the same as that of the original transaction.

The last 10 characters of the order ID are displayed in the “Invoice Number” field on the Merchant Direct Reports. However only letters, numbers and spaces are sent to Merchant Direct.

A minimum of 3 and a maximum of 10 valid characters are sent to Merchant Direct. Only the last characters beginning after any invalid characters are sent. For example, if the order ID is 1234-567890, only 567890 is sent to Merchant Direct.

If the order ID has fewer than 3 characters, it may display a blank or 0000000000 in the Invoice Number field.
Amount String 10-character decimal 'amount' Transaction amount This must contain at least 3 digits, two of which are penny values.

The minimum allowable value is $0.01, and the maximum allowable value is $9999999.99. Transaction amounts of $0.00 are not allowed.
Credit card number String 20-character numeric 'pan' Most credit card numbers today are 16 digits, but some 13-digit numbers are still accepted by some issuers. This field has been intentionally expanded to 20 digits in consideration for future expansion and potential support of private label card ranges.
Expiry date String 4-character numeric

YYMM format.
'expdate' Submit in YYMM format.

Note: This is the reverse of the date displayed on the physical card, which is MMYY.
E-Commerce indicator String 1-character alphanumeric 'crypt_type'

Describes the category of e-commerce transaction being processed. Allowable values are:


  • 1 - Mail Order / Telephone Order—Single
  • 2 - Mail Order / Telephone Order—Recurring
  • 3 - Mail Order / Telephone Order—Instalment
  • 4 - Mail Order / Telephone Order—Unknown classification
  • 5 - Authenticated e-commerce transaction (VBV)
  • 6 - Non-authenticated e-commerce transaction (VBV)
  • 7 - SSL-enabled merchant

In Credential on File transactions where the request field e-commerce indicator is also being sent: the allowable values for e-commerce indicator are dependent on the value sent for payment indicator, as follows:


if payment indicator = R, then allowable values for e-commerce indicator: 2, 5 or 6
if payment indicator = C, then allowable values for e-commerce indicator: 1, 5, 6 or 7
if payment indicator = U, then allowable values for e-commerce indicator: 1 or 7
if payment indicator = Z, then allowable values for e-commerce indicator: 1, 5, 6 or 7

Purchase optional values

Value Type Limits Set method Description
Status Check Boolean true/false $mpgHttpPost = new mpgHttpsPostStatus($store_id,$api_token,$status_check,$mpgRequest); Status Check is a connection object value that allows merchants to verify whether a previously sent transaction was processed successfully. To submit a Status Check request, resend the original transaction with all the same parameter values, but set the status check value to either true or false. Once set to “true”, the gateway will check the status of a transaction that has an order_id that matches the one passed.
  • If the transaction is found, the gateway will respond with the specifics of that transaction.
  • If the transaction is not found, the gateway will respond with a not found message.
  • Once it is set to “false”, the transaction will process as a new transaction.
Things to consider:
  • The Status Check request should only be used once and immediately (within 2 minutes) after the last transaction that had failed.
  • Do not resend the Status Check request if it has timed out. Additional investigation is required.
Customer ID String 50-character alphanumeric 'cust_id' This can be used for policy number, membership number, student ID, invoice number.

This field is searchable from the Moneris Merchant Resource Centre.
Dynamic descriptor String 20-character alphanumeric 'dynamic_descriptor' Merchant defined description sent on a per-transaction basis that will appear on the credit card statement.  Dependent on the card Issuer, the statement will typically show the dynamic desciptor appended to the merchant's existing business name separated by the "/" character.  Please note that the combined length of the merchant's business name, forward slash "/" character, and the dynamic descriptor may not exceed 22 characters.

-Example-

Existing Business Name:  ABC Painting

Dynamic Descriptor:  Booking 12345

Cardholder Statement Displays:  ABC Painting/Booking 1
Customer Information Object $mpgCustInfo = new mpgCustInfo();

$mpgTxn->setCustInfo($mpgCustInfo);
Refer below for further breakdown and definition.
AVS Information Object $mpgAvsInfo = new mpgAvsInfo ($avsTemplate);

$mpgTxn->setAvsInfo($mpgAvsInfo);
Refer below for further breakdown and definition.
CVD Information Object $mpgCvdInfo = new mpgCvdInfo ($cvdTemplate);

$mpgTxn->setCvdInfo($mpgCvdInfo);
Refer below for further breakdown and definition.
Recurring Billing Object $mpgRecur = new mpgRecur($recurArray);

$mpgTxn->setRecur($mpgRecur);
Refer below for further breakdown and definition.
COF Info Object $mpgTxn->setCofInfo($cof); Refer to Purchase with Credential on File

Note:If recurring object were sent in the transactions, then COF Info Object needs to be sent as well.

Recurring object mandatory values

Value Type Limits Variable Description
Recur unit String day, week, month or eom 'recur_unit' Unit to be used as a basis for the interval. This can be set as day, week, month or the end of the month.

Works in conjunction with the period argument (see below) to define the billing frequency.
Start Now String true/false 'start_now' IIf a single charge is to be made against the card immediately, set this value to true. The amount to be billed immediately may differ from the amount billed on a regular basis thereafter.

If the billing is to start in the future, set this value to false.
'start_date' String YYYY/MM/DD format start_date Date of the first future recurring billing transaction. This value must be a date in the future.

If an additional charge is to be made immediately, the start_now argument must be set to true.
Number of Recurs String numeric 1-99 'num_recurs' The number of times that the transaction must recur.
Period String numeric 1-999 'period' Number of recur units that must pass between recurring billings.
Recurring Amount String 9-character decimal 0.01-9999999.99. 'recur_amount' Amount of the recurring transaction. This must contain at least three digits, two of which are penny values.

This is the amount that will be billed on the start_date, and then billed repeatedlybased on the interval defined by period and recur_unit.

Recurring Billing Response Fields

Value Limits Get Method Description
Recurring billing success true/false $mpgResponse->getRecurSuccess(); Indicates whether the recurring billing transaction has been successfully set up for future billing.

Purchase with Convenience Fee

The Convenience Fee program allows merchants to apply an additional charge to a customer’s bill (with their consent) for the convenience of being able to pay for goods and services using an alternative payment channel. This applies only when providing a true convenience in the form of a channel outside the merchant's customary face-to-face payment channels.

The convenience fee is a charge in addition to what the consumer is paying for the provided goods/services. This charge appears as a separate line item on the consumer’s statement.

The Convenience Fee program provides several benefits. It may allow you an opportunity to reduce or eliminate credit card processing fees and improve customer satisfaction.

In addition to instantiating a transaction object and a connection object (as you would for a normal transaction), you must instantiate a ConvFeeInfo object. This object has one mandatory value that must be set:

Canada Code Sample

<?php

/* eSELECTplus Canada Convenience Fee Account Required this transaction*/

require "../../mpgClasses.php";

/************************ Request Variables **********************************/

$store_id='monca00392';
$api_token='qYdISUhHiOdfTr1CLNpN';
//$status = 'false';

/************************ Transaction Variables ******************************/

$orderid='ord-'.date("dmy-G:i:s");
$amount='10.00';
$pan='4242424242424242';
$expiry_date='1812';
$dynamic_descriptor='test';

/************************ Transaction Array **********************************/

$txnArray=array(type=>'purchase',  
         order_id=>$orderid,
         cust_id=>'cust',
         amount=>$amount,
         pan=>$pan,
         expdate=>$expiry_date,
         crypt_type=>'7', 
         dynamic_descriptor=>$dynamic_descriptor
           );

/********************** ConvFee Associative Array *************************/

$convFeeTemplate = array(
						 convenience_fee=>'1.00'
						);

/************************** ConvFee Object ********************************/

$mpgConvFee = new mpgConvFeeInfo($convFeeTemplate);

/************************ Transaction Object *******************************/

$mpgTxn = new mpgTransaction($txnArray);

/************************ Set ConvFee *****************************/

$mpgTxn->setConvFeeInfo($mpgConvFee);

/************************ Request Object **********************************/

$mpgRequest = new mpgRequest($mpgTxn);
$mpgRequest->setProcCountryCode("CA"); //"CA" for sending transaction to Canadian environment
$mpgRequest->setTestMode(true); //false or comment out this line for production transactions

/************************ mpgHttpsPost Object ******************************/

$mpgHttpPost  =new mpgHttpsPost($store_id,$api_token,$mpgRequest);

//Status check example
//$mpgHttpPost = new mpgHttpsPostStatus($store_id,$api_token,$status,$mpgRequest);

/************************ Response Object **********************************/

$mpgResponse=$mpgHttpPost->getMpgResponse();


print("\nCardType = " . $mpgResponse->getCardType());
print("\nTransAmount = " . $mpgResponse->getTransAmount());
print("\nTxnNumber = " . $mpgResponse->getTxnNumber());
print("\nReceiptId = " . $mpgResponse->getReceiptId());
print("\nTransType = " . $mpgResponse->getTransType());
print("\nReferenceNum = " . $mpgResponse->getReferenceNum());
print("\nISO = " . $mpgResponse->getISO());
print("\nResponseCode = " . $mpgResponse->getResponseCode());
print("\nMessage = " . $mpgResponse->getMessage());
print("\nAuthCode = " . $mpgResponse->getAuthCode());
print("\nComplete = " . $mpgResponse->getComplete());
print("\nTransDate = " . $mpgResponse->getTransDate());
print("\nTransTime = " . $mpgResponse->getTransTime());
print("\nTicket = " . $mpgResponse->getTicket());
print("\nTimedOut = " . $mpgResponse->getTimedOut());
print("\nCardLevelResult = " . $mpgResponse->getCardLevelResult());
print("\nCfSuccess = " . $mpgResponse->getCfSuccess());
print("\nCfStatus = " . $mpgResponse->getCfStatus());
print("\nFeeAmount = " . $mpgResponse->getFeeAmount());
print("\nFeeRate = " . $mpgResponse->getFeeRate());
print("\nFeeType = " . $mpgResponse->getFeeType());
//print("\nStatusCode = " . $mpgResponse->getStatusCode());
//print("\nStatusMessage = " . $mpgResponse->getStatusMessage());


?>

                

Purchase - Transaction Values

$txnArray=array('type'=>'purchase',... );

$mpgTxn = new mpgTransaction($txnArray);

$mpgRequest = new mpgRequest($mpgTxn);


Purchase object mandatory values

Value Type Limits Set methods/variables Description
Order ID String 50-character alphanumeric 'order_id' Merchant-defined transaction identifier that must be unique for every Purchase, Pre-Authorization and Independent Refund transaction. No two transactions of these types may have the same order ID.

For Refund, Completion and Purchase Correction transactions, the order ID must be the same as that of the original transaction.

The last 10 characters of the order ID are displayed in the “Invoice Number” field on the Merchant Direct Reports. However only letters, numbers and spaces are sent to Merchant Direct.

A minimum of 3 and a maximum of 10 valid characters are sent to Merchant Direct. Only the last characters beginning after any invalid characters are sent. For example, if the order ID is 1234-567890, only 567890 is sent to Merchant Direct.

If the order ID has fewer than 3 characters, it may display a blank or 0000000000 in the Invoice Number field.
Amount String 10-character decimal 'amount' Transaction amount This must contain at least 3 digits, two of which are penny values.

The minimum allowable value is $0.01, and the maximum allowable value is $9999999.99. Transaction amounts of $0.00 are not allowed.
Credit card number String 20-character numeric 'pan' Most credit card numbers today are 16 digits, but some 13-digit numbers are still accepted by some issuers. This field has been intentionally expanded to 20 digits in consideration for future expansion and potential support of private label card ranges.
Expiry date String 4-character numeric

YYMM format.
'expdate' Submit in YYMM format.

Note: This is the reverse of the date displayed on the physical card, which is MMYY.
E-Commerce indicator String 1-character alphanumeric 'crypt_type'

Describes the category of e-commerce transaction being processed. Allowable values are:


  • 1 - Mail Order / Telephone Order—Single
  • 2 - Mail Order / Telephone Order—Recurring
  • 3 - Mail Order / Telephone Order—Instalment
  • 4 - Mail Order / Telephone Order—Unknown classification
  • 5 - Authenticated e-commerce transaction (VBV)
  • 6 - Non-authenticated e-commerce transaction (VBV)
  • 7 - SSL-enabled merchant

In Credential on File transactions where the request field e-commerce indicator is also being sent: the allowable values for e-commerce indicator are dependent on the value sent for payment indicator, as follows:


if payment indicator = R, then allowable values for e-commerce indicator: 2, 5 or 6
if payment indicator = C, then allowable values for e-commerce indicator: 1, 5, 6 or 7
if payment indicator = U, then allowable values for e-commerce indicator: 1 or 7
if payment indicator = Z, then allowable values for e-commerce indicator: 1, 5, 6 or 7

Convenience Fee Object $mpgConvFee = new mpgConvFeeInfo($convFeeTemplate);

$mpgTxn->setConvFeeInfo($mpgConvFee);
Refer below for further breakdown and definition.

Please note, if the Convenience Fee is set, then Recurring Billing is not supported.

Purchase optional values

Value Type Limits Set method Decription
Status Check Boolean true/false $mpgHttpPost = new mpgHttpsPostStatus($store_id,$api_token,$status_check,$mpgRequest); Status Check is a connection object value that allows merchants to verify whether a previously sent transaction was processed successfully. To submit a Status Check request, resend the original transaction with all the same parameter values, but set the status check value to either true or false. Once set to “true”, the gateway will check the status of a transaction that has an order_id that matches the one passed.
  • If the transaction is found, the gateway will respond with the specifics of that transaction.
  • If the transaction is not found, the gateway will respond with a not found message.
  • Once it is set to “false”, the transaction will process as a new transaction.
Things to consider:
  • The Status Check request should only be used once and immediately (within 2 minutes) after the last transaction that had failed.
  • Do not resend the Status Check request if it has timed out. Additional investigation is required.
Customer ID String 50-character alphanumeric 'cust_id' This can be used for policy number, membership number, student ID, invoice number.

This field is searchable from the Moneris Merchant Resource Centre.
Dynamic descriptor String 20-character alphanumeric 'dynamic_descriptor' Merchant defined description sent on a per-transaction basis that will appear on the credit card statement.  Dependent on the card Issuer, the statement will typically show the dynamic desciptor appended to the merchant's existing business name separated by the "/" character.  Please note that the combined length of the merchant's business name, forward slash "/" character, and the dynamic descriptor may not exceed 22 characters.

-Example-

Existing Business Name:  ABC Painting

Dynamic Descriptor:  Booking 12345

Cardholder Statement Displays:  ABC Painting/Booking 1
Customer Information Object $mpgCustInfo = new mpgCustInfo();

$mpgTxn->setCustInfo($mpgCustInfo);
Refer below for further breakdown and definition.
AVS Information Object $mpgAvsInfo = new mpgAvsInfo ($avsTemplate);

$mpgTxn->setAvsInfo($mpgAvsInfo);
Refer below for further breakdown and definition.
CVD Information Object $mpgCvdInfo = new mpgCvdInfo ($cvdTemplate);

$mpgTxn->setCvdInfo($mpgCvdInfo);
Refer below for further breakdown and definition.
Recurring Billing Object $mpgRecur = new mpgRecur($recurArray);

$mpgTxn->setRecur($mpgRecur);
Refer below for further breakdown and definition.

Convenience Fee Mandatory Values

Value Type Limits Set method / Variable Description
Convenience fee amount String 9-character decimal 'convenience_fee' Amount customer is being charged as a convenience fee

Convenience Fee Response Fields

Value Limits Get Method Description
Convenience fee success true/false $mpgResponse->getCfSuccess(); Indicates whether the Convenience Fee transaction processed successfully.
Convenience fee status 2-character alphanumeric $mpgResponse->getCfStatus(); Indicates the status of the merchant and convenience fee transactions. The CfStatus field provides details about the transaction behavior and should be referenced when contacting Moneris Customer Support.

Possible values are:

1 or 1F - Completed 1st purchase transaction

2 or 2F - Completed 2nd purchase transaction

3 - Completed void transaction

4A or 4D - Completed refund transaction

7 or 7F - Completed merchant independent refund transaction

8 or 8F - Completed merchant refund transaction

9 or 9F - Completed 1st void transaction

10 or 10F - Completed 2nd void transaction

11A or 11D - Completed refund transaction

Convenience fee amount 9-character decimal $mpgResponse->getFeeAmount(); The expected Convenience Fee amount. This field will return the amount submitted by the merchant for a successful transaction. For an unsuccessful transaction, it will return the expected convenience fee amount.
Convenience fee rate 9-character decimal $mpgResponse->getFeeRate(); The convenience fee rate that has been defined on the merchant’s profile. For example:

1.00 - a fixed amount or

10.0 - a percentage amount

Convenience fee type AMT/PCT $mpgResponse->getFeeType(); The type of convenience fee that has been defined on the merchant’s profile.

Available options are:

AMT - fixed amount

PCT - percentage


INTERAC® Online Payment Purchase

Please Note: You must be to view this content. Please or sign up.

Purchase with 3-D Secure

NEW!   We now have our Interactive tool for this section.

The Purchase with 3-D Secure transaction follows a 3-D Secure MPI authentication. After receiving confirmation from the MPI ACS transaction, this Purchase verifies funds on the customer’s card, removes the funds and prepares them for deposit into the merchant’s account.

To perform the 3-D Secure authentication, the Moneris MPI or any 3rd party MPI may be used.

In addition to 3-D Secure transactions, this transaction can also be used to process Apple Pay and Google Pay™ transactions. This transaction is applicable only if choosing to integrate directly to Apple Wallet or Google Wallet (if not using the Moneris Apple Pay or Google Pay™ SDKs).

Refer to Apple or Google developer portals for details on integrating directly to their wallets to retrieve the payload data.

NOTE: Moneris strongly discourages the use of frames as part of a 3-D Secure implementation, and cannot guarantee their reliability when processing transactions in the production environment.

Canada Code Sample

<?php

## Example php -q TestPurchase-VBV.php "moneris" store

require "../../mpgClasses.php";

/******************************* Request Variables ********************************/

$store_id='store5';
$api_token='yesguy';

/****************************** Transactional Variables ***************************/

$type='cavv_purchase';
$order_id='ord-'.date("dmy-G:i:s");
$cust_id='CUST887763';
$amount='10.00';
$pan="4242424242424242";
$expiry_date="1511";
$cavv='AAABBJg0VhI0VniQEjRWAAAAAAA=';
$crypt_type = '7';
$wallet_indicator = "APP";
$dynamic_descriptor='123456';

/*************************** Transaction Associative Array ************************/

$txnArray=array(
			'type'=>$type,
	        'order_id'=>$order_id,
			'cust_id'=>$cust_id,
	        'amount'=>$amount,
	        'pan'=>$pan,
	        'expdate'=>$expiry_date,
			'cavv'=>$cavv,
			'crypt_type'=>$crypt_type, //mandatory for AMEX only
			//'wallet_indicator'=>$wallet_indicator, //set only for wallet transactions. e.g. APPLE PAY
			//'network'=> "Interac", //set only for Interac e-commerce
			//'data_type'=> "3DSecure", //set only for Interac e-commerce
			'dynamic_descriptor'=>$dynamic_descriptor
			//,'cm_id' => '8nAK8712sGaAkls56' //set only for usage with Offlinx - Unique max 50 alphanumeric characters transaction id generated by merchant
	           );

/****************************** Transaction Object *******************************/

$mpgTxn = new mpgTransaction($txnArray);

/******************* Credential on File **********************************/

$cof = new CofInfo();
$cof->setPaymentIndicator("U");
$cof->setPaymentInformation("2");
$cof->setIssuerId("168451306048014");

$mpgTxn->setCofInfo($cof);


/******************************* Request Object **********************************/

$mpgRequest = new mpgRequest($mpgTxn);
$mpgRequest->setProcCountryCode("CA"); //"US" for sending transaction to US environment
$mpgRequest->setTestMode(true); //false or comment out this line for production transactions

/****************************** HTTPS Post Object *******************************/

$mpgHttpPost  =new mpgHttpsPost($store_id,$api_token,$mpgRequest);

/************************************* Response *********************************/

$mpgResponse=$mpgHttpPost->getMpgResponse();

print("\nCardType = " . $mpgResponse->getCardType());
print("\nTransAmount = " . $mpgResponse->getTransAmount());
print("\nTxnNumber = " . $mpgResponse->getTxnNumber());
print("\nReceiptId = " . $mpgResponse->getReceiptId());
print("\nTransType = " . $mpgResponse->getTransType());
print("\nReferenceNum = " . $mpgResponse->getReferenceNum());
print("\nResponseCode = " . $mpgResponse->getResponseCode());
print("\nISO = " . $mpgResponse->getISO());
print("\nMessage = " . $mpgResponse->getMessage());
print("\nAuthCode = " . $mpgResponse->getAuthCode());
print("\nComplete = " . $mpgResponse->getComplete());
print("\nTransDate = " . $mpgResponse->getTransDate());
print("\nTransTime = " . $mpgResponse->getTransTime());
print("\nTicket = " . $mpgResponse->getTicket());
print("\nTimedOut = " . $mpgResponse->getTimedOut());
print("\nCavvResultCode = " . $mpgResponse->getCavvResultCode());
print("\nIssuerId = " . $mpgResponse->getIssuerId());


?>


                

Purchase with 3-D Secure - Transaction

$txnArray=array('type'=>'cavv_purchase',... );

$mpgTxn = new mpgTransaction($txnArray);

$mpgRequest = new mpgRequest($mpgTxn);


Purchase object mandatory values

Value Type Limits Set method Description
Order ID String 50-character alphanumeric 'order_id' Merchant-defined transaction identifier that must be unique for every Purchase, Pre-Authorization and Independent Refund transaction. No two transactions of these types may have the same order ID.

For Refund, Completion and Purchase Correction transactions, the order ID must be the same as that of the original transaction.

The last 10 characters of the order ID are displayed in the “Invoice Number” field on the Merchant Direct Reports. However only letters, numbers and spaces are sent to Merchant Direct.

A minimum of 3 and a maximum of 10 valid characters are sent to Merchant Direct. Only the last characters beginning after any invalid characters are sent. For example, if the order ID is 1234-567890, only 567890 is sent to Merchant Direct.

If the order ID has fewer than 3 characters, it may display a blank or 0000000000 in the Invoice Number field.
Amount String 10-character decimal 'amount' Transaction amount This must contain at least 3 digits, two of which are penny values.

The minimum allowable value is $0.01, and the maximum allowable value is $9999999.99. Transaction amounts of $0.00 are not allowed.
Credit card number String 20-character numeric 'pan' Most credit card numbers today are 16 digits, but some 13-digit numbers are still accepted by some issuers. This field has been intentionally expanded to 20 digits in consideration for future expansion and potential support of private label card ranges.
Expiry date String 4-character numeric

YYMM format.
'expdate' Submit in YYMM format.

Note: This is the reverse of the date displayed on the physical card, which is MMYY.
Cardholder Authentication Verification Value(CAVV) String 50-character alphanumeric 'cavv' Value provided by the Moneris MPI or by a third-party MPI. It is part of a Verified by Visa (VbV), MasterCard SecureCode (MCSC) or American Express SafeKey transaction.

For Apple Pay and Google Pay processing please submit the decrypted cryptogram in this field.
E-Commerce Indicator String 1-character numeric 'crypt_type'

Describes the category of e-commerce transaction being processed. Allowable values are:


  • 1 - Mail Order / Telephone Order—Single
  • 2 - Mail Order / Telephone Order—Recurring
  • 3 - Mail Order / Telephone Order—Instalment
  • 4 - Mail Order / Telephone Order—Unknown classification
  • 5 - Authenticated e-commerce transaction (VBV)
  • 6 - Non-authenticated e-commerce transaction (VBV)
  • 7 - SSL-enabled merchant

In Credential on File transactions where the request field e-commerce indicator is also being sent: the allowable values for e-commerce indicator are dependent on the value sent for payment indicator, as follows:


if payment indicator = R, then allowable values for e-commerce indicator: 2, 5 or 6
if payment indicator = C, then allowable values for e-commerce indicator: 1, 5, 6 or 7
if payment indicator = U, then allowable values for e-commerce indicator: 1 or 7
if payment indicator = Z, then allowable values for e-commerce indicator: 1, 5, 6 or 7


For Apple Pay or Google Pay transactions where you are doing decryption: send the value of the eciIndicator or 3dsEciIndicator field returned in the payload


If the value is not present in the payload, send the value as 5; if you get a 2-character value (e.g.,. 05 or 07), remove the initial 0 and just send us the 2nd character


Allowable values for Apple Pay and Google Pay are:


  • 5: Authenticated e-commerce transaction
  • 7: SSL-enabled merchant

Purchase optional values

Value Type Limits Set method Decription
Status Check Boolean true/false $mpgHttpPost = new mpgHttpsPostStatus($store_id,$api_token,$status_check,$mpgRequest); Status Check is a connection object value that allows merchants to verify whether a previously sent transaction was processed successfully. To submit a Status Check request, resend the original transaction with all the same parameter values, but set the status check value to either true or false. Once set to “true”, the gateway will check the status of a transaction that has an order_id that matches the one passed.
  • If the transaction is found, the gateway will respond with the specifics of that transaction.
  • If the transaction is not found, the gateway will respond with a not found message.
  • Once it is set to “false”, the transaction will process as a new transaction.
Things to consider:
  • The Status Check request should only be used once and immediately (within 2 minutes) after the last transaction that had failed.
  • Do not resend the Status Check request if it has timed out. Additional investigation is required.
Customer ID String 50-character alphanumeric 'cust_id' This can be used for policy number, membership number, student ID, invoice number.

This field is searchable from the Moneris Merchant Resource Centre.
Dynamic descriptor String 20-character alphanumeric 'dynamic_descriptor' Merchant defined description sent on a per-transaction basis that will appear on the credit card statement.  Dependent on the card Issuer, the statement will typically show the dynamic desciptor appended to the merchant's existing business name separated by the "/" character.  Please note that the combined length of the merchant's business name, forward slash "/" character, and the dynamic descriptor may not exceed 22 characters.

-Example-

Existing Business Name:  ABC Painting

Dynamic Descriptor:  Booking 12345

Cardholder Statement Displays:  ABC Painting/Booking 1               
COF Info Object $mpgTxn->setCofInfo($cof); Refer to Purchase with Credential on File
Wallet Indicator String 3-character alphanumeric 'wallet_indicator' Available to Canada integrations only. This field is applicable to Apple Pay and Google Pay transactions whereby the merchant is using their own API to decrypt the payload. This is a mandatory field for wallet transactions.
Field is a case sensitive. Possible value:

Field is a case sensitive. Possible value:
    • APP = Apple Pay In-app
    • APW = Apple Pay On the Web
    • GPW = Google pay on Web
    • GPP = Google pay InApp
    • MMP = MasterCard MasterPass
    • VCO = Visa Checkout

Please note that if this field is included to indicate Apple Pay or Google Pay, then Convenience Fee is not supported.

Customer Information Object $mpgCustInfo = new mpgCustInfo();

$mpgTxn->setCustInfo($mpgCustInfo);
Refer below for further breakdown and definition.
AVS Information Object $mpgAvsInfo = new mpgAvsInfo ($avsTemplate);

$mpgTxn->setAvsInfo($mpgAvsInfo);
Refer below for further breakdown and definition. This feature is not available for Apple Pay and Google Pay.
CVD Information Object $mpgCvdInfo = new mpgCvdInfo ($cvdTemplate);

$mpgTxn->setCvdInfo($mpgCvdInfo);
Refer below for further breakdown and definition. This feature is not available for Apple Pay and Google Pay.
Convenience Fee Object $mpgConvFee = new mpgConvFeeInfo($convFeeTemplate);

$mpgTxn->setConvFeeInfo($mpgConvFee);
Refer below for further breakdown and definition.

Please note, if the Convenience Fee is set, then Recurring Billing is not supported.
Network String alphanumeric cavvPurchase.setNetwork(network); Available to Canada integrations only. This field is applicable to Apple Pay and Google Pay transactions whereby the merchant is using their own API to decrypt the payload. This is a mandatory field for INTERAC ® e-Commerce Apple Pay transactions.
Field is a case sensitive:
  • Interac
Data Type String alphanumeric cavvPurchase.setDataType(data_type); Available to Canada integrations only. This field is applicable to INTERAC® e-Commerce Apple Pay and Google Pay transactions whereby the merchant is using their own API to decrypt the payload. This is a mandatory field for INTERAC ® e-Commerce Apple Pay transactions.
Field is a case sensitive. Possible value:
  • 3D Secure = Cryptogram obtained using Merchant Capability 3DS
  • EMV = Cryptogram obtained using Merchant Capability EMV

3-D Secure Response Fields

Value Limits Get Method Description
CAVV result code 1-character alphanumeric $mpgResponse->getCavvResultCode() Indicates the Verified by Visa CAVV result. Possible response codes are shown in the CAVV Result Code table.

Purchase with Vault

NEW!   We now have our Interactive tool for this section.

This transaction uses the data key to identify a previously registered credit card profile. The details saved within the profile are then submitted to perform a Purchase transaction.

The data key may be a temporary one generated using Hosted Tokenization or it may be a permanent one from the Vault.

The Vault feature allows merchants to create long term customer profiles, edit those profiles, and use them to process transactions without having to enter financial information each time.

The only difference between charging a temporary token and charging a standard Vault token is whether the expiry date is sent. With the Vault token, the expiry date is stored along with the card number as part of the Vault profile. Therefore, there is no need to send the expiry date again with each normal Vault transaction.

However, a temporary token transaction may have only stored the card number. Therefore, in this scenario the expiry date must be sent when you charge the card.

Canada Code Sample

 
require "../../mpgClasses.php";
 
/************************ Request Variables **********************************/
 
$store_id='store5';
$api_token='yesguy';
 
/************************ Transaction Variables ******************************/
 
$data_key='ot-odvn9lBTZm0lSWyQgansBqQi3';
$orderid='res-purch-'.date("dmy-G:i:s");
$amount='1.00';
$custid='cust';
$crypt_type='1';
 
$expdate='1911'; //For Temp Tokens only
/************************ Transaction Array **********************************/
 
$txnArray=array('type'=>'res_purchase_cc',
                                                                                'data_key'=>$data_key,
                                                'order_id'=>$orderid,
                                                'cust_id'=>$custid,
                                                'amount'=>$amount,
                                                'crypt_type'=>$crypt_type,
                                                                                //'expdate'=>$expdate,
                                                                                'dynamic_descriptor'=>'12484'
                                                );
 
 
/************************ Transaction Object *******************************/
 
$mpgTxn = new mpgTransaction($txnArray);
 
/******************* Credential on File **********************************/
 
$cof = new CofInfo();
$cof->setPaymentIndicator("U");
$cof->setPaymentInformation("2");
$cof->setIssuerId("168451306048014");
 
$mpgTxn->setCofInfo($cof);
 
/************************ Request Object **********************************/
 
$mpgRequest = new mpgRequest($mpgTxn);
$mpgRequest->setProcCountryCode("CA"); //"US" for sending transaction to US environment
$mpgRequest->setTestMode(true); //false or comment out this line for production transactions
 
/************************ mpgHttpsPost Object ******************************/
 
$mpgHttpPost  =new mpgHttpsPost($store_id,$api_token,$mpgRequest);
 
/************************ Response Object **********************************/
 
$mpgResponse=$mpgHttpPost->getMpgResponse();
 
 
print("\nDataKey = " . $mpgResponse->getDataKey());
print("\nReceiptId = " . $mpgResponse->getReceiptId());
print("\nReferenceNum = " . $mpgResponse->getReferenceNum());
print("\nResponseCode = " . $mpgResponse->getResponseCode());
print("\nISO = " . $mpgResponse->getISO());
print("\nAuthCode = " . $mpgResponse->getAuthCode());
print("\nMessage = " . $mpgResponse->getMessage());
print("\nTransDate = " . $mpgResponse->getTransDate());
print("\nTransTime = " . $mpgResponse->getTransTime());
print("\nTransType = " . $mpgResponse->getTransType());
print("\nComplete = " . $mpgResponse->getComplete());
print("\nTransAmount = " . $mpgResponse->getTransAmount());
print("\nCardType = " . $mpgResponse->getCardType());
print("\nTxnNumber = " . $mpgResponse->getTxnNumber());
print("\nTimedOut = " . $mpgResponse->getTimedOut());
print("\nAVSResponse = " . $mpgResponse->getAvsResultCode());
print("\nResSuccess = " . $mpgResponse->getResSuccess());
print("\nPaymentType = " . $mpgResponse->getPaymentType());
print("\nIssuerId = " . $mpgResponse->getIssuerId());
 
//----------------- ResolveData ------------------------------
 
print("\n\nCust ID = " . $mpgResponse->getResDataCustId());
print("\nPhone = " . $mpgResponse->getResDataPhone());
print("\nEmail = " . $mpgResponse->getResDataEmail());
print("\nNote = " . $mpgResponse->getResDataNote());
print("\nMasked Pan = " . $mpgResponse->getResDataMaskedPan());
print("\nExp Date = " . $mpgResponse->getResDataExpDate());
print("\nCrypt Type = " . $mpgResponse->getResDataCryptType());
print("\nAvs Street Number = " . $mpgResponse->getResDataAvsStreetNumber());
print("\nAvs Street Name = " . $mpgResponse->getResDataAvsStreetName());
print("\nAvs Zipcode = " . $mpgResponse->getResDataAvsZipcode());
 
?>

                

Purchase with Vault - Transaction Values

$txnArray=array('type'=>'res_purchase_cc',... );

$mpgTxn = new mpgTransaction($txnArray);

$mpgRequest = new mpgRequest($mpgTxn);


Purchase with Vault mandatory values

VALUE TYPE LIMITS SET METHOD / VARIABLE DESCRIPTION
Data Key String 25-character alphanumeric 'data_key' The data key is the token that points to a previously stored profile. Profile identifier that all future financial Vault transactions (that is, they occur after the profile was registered by a ResAddCC or ResTokenizeCC transaction) will use to associate with the saved information.

The data key is generated by Moneris, and is returned to the merchant (via the Receipt object) when the profile is first registered.
Order ID String 50-character alphanumeric 'order_id' Merchant-defined transaction identifier that must be unique for every Purchase, Pre-Authorization and Independent Refund transaction. No two transactions of these types may have the same order ID.

For Refund, Completion and Purchase Correction transactions, the order ID must be the same as that of the original transaction.

The last 10 characters of the order ID are displayed in the “Invoice Number” field on the Merchant Direct Reports. However only letters, numbers and spaces are sent to Merchant Direct.

A minimum of 3 and a maximum of 10 valid characters are sent to Merchant Direct. Only the last characters beginning after any invalid characters are sent. For example, if the order ID is 1234-567890, only 567890 is sent to Merchant Direct.

If the order ID has fewer than 3 characters, it may display a blank or 0000000000 in the Invoice Number field.
Amount String 10-character decimal 'amount' Transaction amount This must contain at least 3 digits, two of which are penny values.

The minimum allowable value is $0.01, and the maximum allowable value is $9999999.99. Transaction amounts of $0.00 are not allowed.
E-Commerce indicator String 1-character alphanumeric 'crypt_type'

Describes the category of e-commerce transaction being processed. Allowable values are:


  • 1 - Mail Order / Telephone Order—Single
  • 2 - Mail Order / Telephone Order—Recurring
  • 3 - Mail Order / Telephone Order—Instalment
  • 4 - Mail Order / Telephone Order—Unknown classification
  • 5 - Authenticated e-commerce transaction (VBV)
  • 6 - Non-authenticated e-commerce transaction (VBV)
  • 7 - SSL-enabled merchant

In Credential on File transactions where the request field e-commerce indicator is also being sent: the allowable values for e-commerce indicator are dependent on the value sent for payment indicator, as follows:


if payment indicator = R, then allowable values for e-commerce indicator: 2, 5 or 6
if payment indicator = C, then allowable values for e-commerce indicator: 1, 5, 6 or 7
if payment indicator = U, then allowable values for e-commerce indicator: 1 or 7
if payment indicator = Z, then allowable values for e-commerce indicator: 1, 5, 6 or 7

Purchase with Vault optional values

VALUE TYPE LIMITS SET METHOD / VARIABLE DECRIPTION
Status Check Boolean true/false $mpgHttpPost = new mpgHttpsPostStatus($store_id,$api_token,$status_check,$mpgRequest); Status Check is a connection object value that allows merchants to verify whether a previously sent transaction was processed successfully. To submit a Status Check request, resend the original transaction with all the same parameter values, but set the status check value to either true or false. Once set to “true”, the gateway will check the status of a transaction that has an order_id that matches the one passed.
  • If the transaction is found, the gateway will respond with the specifics of that transaction.
  • If the transaction is not found, the gateway will respond with a not found message.
  • Once it is set to “false”, the transaction will process as a new transaction.
Things to consider:
  • The Status Check request should only be used once and immediately (within 2 minutes) after the last transaction that had failed.
  • Do not resend the Status Check request if it has timed out. Additional investigation is required.
Expiry Date String 4-character numeric

YYMM format.
'expdate' The optional Expiry Date applies to Hosted Tokenization transactions. If the expiry date was not collected by Hosted Tokenization solution, then it must be set in the Vault transaction request.
Customer ID String 50-character alphanumeric 'cust_id' This can be used for policy number, membership number, student ID, invoice number.

This field is searchable from the Moneris Merchant Resource Centre.
Dynamic descriptor String 20-character alphanumeric 'dynamic_descriptor' Merchant defined description sent on a per-transaction basis that will appear on the credit card statement.  Dependent on the card Issuer, the statement will typically show the dynamic desciptor appended to the merchant's existing business name separated by the "/" character.  Please note that the combined length of the merchant's business name, forward slash "/" character, and the dynamic descriptor may not exceed 22 characters.

-Example-

Existing Business Name:  ABC Painting

Dynamic Descriptor:  Booking 12345

Cardholder Statement Displays:  ABC Painting/Booking 1               
Customer Information Object $mpgCustInfo = new mpgCustInfo();

$mpgTxn->setCustInfo($mpgCustInfo);
Refer below for further breakdown and definition.
AVS Information Object $mpgAvsInfo = new mpgAvsInfo ($avsTemplate);

$mpgTxn->setAvsInfo($mpgAvsInfo);
Refer below for further breakdown and definition.
CVD Information Object $mpgCvdInfo = new mpgCvdInfo ($cvdTemplate);

$mpgTxn->setCvdInfo($mpgCvdInfo);
Refer below for further breakdown and definition.
Recurring Billing Object $mpgRecur = new mpgRecur($recurArray);

$mpgTxn->setRecur($mpgRecur);
Refer below for further breakdown and definition.
COF Info Object $mpgTxn->setCofInfo($cof); Refer to Purchase with Credential on File

Note:If recurring object were sent in the transactions, then COF Info Object needs to be sent as well.

Vault Response Fields

Value Limits Get Method Description
Data Key 25-character alphanumeric $mpgResponse->getDataKey(); This field is created when a profile is created and a token is returned.

It is a unique profile identifier, and is a required value for all future Vault transactions.
Vault Success true/false $mpgResponse->getResSuccess(); Indicates whether Vault transaction was successful.
Payment Type cc $mpgResponse->getPaymentType(); Indicates the payment type associated with a Vault profile.
Customer ID 30-character alphanumeric $mpgResponse->getResDataCustId(); Returns the customer ID saved in the profile.
Phone Number 30-character alphanumeric $mpgResponse->getResDataPhone(); Returns the phone number saved in the profile.
Email Address 30-character alphanumeric $mpgResponse->getResDataEmail(); Returns the email address saved in the profile.
Note 30-character alphanumeric $mpgResponse->getResDataNote(); Returns the note saved in the profile.
Credit Card Fields
Masked PAN 20-character numeric $mpgResponse->getResDataMaskedPan(); Returns the first 4 last 4 of the card number saved in the profile.
Expiry Date 4-character numeric $mpgResponse->getResDataExpDate(); Returns the expiry date of the card number saved in the profile. YYMM format.
E-Commerce Indicator 1-character numeric $mpgResponse->getResDataCryptType(); Returns the e-commerce indicator saved in the profile.
AVS Street Number 19-character alphanumeric $mpgResponse->getResDataAvsStreetNumber(); Returns the AVS street number saved in the profile. If no other AVS street number is passed in the transaction request, this value will be submitted along with the financial transaction to the issuer.
AVS Street Name 19-character alphanumeric $mpgResponse->getResDataAvsStreetName(); Returns the AVS street name saved in the profile. If no other AVS street number is passed in the transaction request, this value will be submitted along with the financial transaction to the issuer.
AVS Zip/Postal Code 9-character alphanumeric $mpgResponse->getResDataAvsZipcode(); Returns the AVS zip/postal code saved in the profile. If no other AVS street number is passed in the transaction request, this value will be submitted along with the financial transaction to the issuer.

Purchase with Vault and Customer Information

The Vault feature allows merchants to create customer profiles, edit those profiles, and use them to process transactions without having to enter financial information each time.

The Vault is a complement to the recurring payment module. It securely stores customer account information on Moneris secure servers. This allows merchants to bill customers for routine products or services when an invoice is due.

An optional add-on to a number of transactions the Customer Information object. The Customer Information object offers a number of fields to be submitted as part of the financial transaction, and stored by Moneris. These details may be viewed in the future in the Merchant Resource Center.

Canada Code Sample

 
require "../../mpgClasses.php";
 
/************************ Request Variables **********************************/
 
$store_id='store5';
$api_token='yesguy';
 
/************************ Transaction Variables ******************************/
 
$data_key='t8RCndWBNFNt4Dx32CCnl2tlz';
$orderid='res-purch-'.date("dmy-G:i:s");
$amount='1.00';
$custid='cust';
$crypt_type='1';
 
/************************ Transaction Array **********************************/
 
$txnArray=array('type'=>'res_purchase_cc',
                                                                                'data_key'=>$data_key,
                                                'order_id'=>$orderid,
                                                'cust_id'=>$custid,
                                                'amount'=>$amount,
                                                'crypt_type'=>$crypt_type
                                                 );
 
/************************ CustInfo Object **********************************/
 
$mpgCustInfo = new mpgCustInfo();
 
/********************* Set E-mail and Instructions **************/
 
$email ='Joe@widgets.com';
$mpgCustInfo->setEmail($email);
 
$instructions ="Make it fast";
$mpgCustInfo->setInstructions($instructions);
 
/********************* Create Billing Array and set it **********/
 
$billing = array( 'first_name' => 'Joe',
                                        'last_name' => 'Thompson',
                                        'company_name' => 'Widget Company Inc.',
                                        'address' => '111 Bolts Ave.',
                                        'city' => 'Toronto',
                                        'province' => 'Ontario',
                                        'postal_code' => 'M8T 1T8',
                                        'country' => 'Canada',
                                        'phone_number' => '416-555-5555',
                                        'fax' => '416-555-5555',
                                        'tax1' => '123.45',
                                        'tax2' => '12.34',
                                        'tax3' => '15.45',
                                        'shipping_cost' => '456.23');
 
$mpgCustInfo->setBilling($billing);
 
/********************* Create Shipping Array and set it **********/
 
$shipping = array( 'first_name' => 'Joe',
                                        'last_name' => 'Thompson',
                                        'company_name' => 'Widget Company Inc.',
                                        'address' => '111 Bolts Ave.',
                                        'city' => 'Toronto',
                                        'province' => 'Ontario',
                                        'postal_code' => 'M8T 1T8',
                                        'country' => 'Canada',
                                        'phone_number' => '416-555-5555',
                                        'fax' => '416-555-5555',
                                        'tax1' => '123.45',
                                        'tax2' => '12.34',
                                        'tax3' => '15.45',
                                        'shipping_cost' => '456.23');
 
$mpgCustInfo->setShipping($shipping);
 
/********************* Create Item Arrays and set them **********/
 
$item1 = array ('name'=>'item 1 name',
                                        'quantity'=>'53',
                                        'product_code'=>'item 1 product code',
                                        'extended_amount'=>'1.00');
 
$mpgCustInfo->setItems($item1);
 
 
$item2 = array('name'=>'item 2 name',
                                        'quantity'=>'53',
                                        'product_code'=>'item 2 product code',
                                        'extended_amount'=>'1.00');
 
$mpgCustInfo->setItems($item2);
 
/************************ Transaction Object *******************************/
 
$mpgTxn = new mpgTransaction($txnArray);
$mpgTxn->setCustInfo($mpgCustInfo);
 
/************************ Request Object **********************************/
 
$mpgRequest = new mpgRequest($mpgTxn);
$mpgRequest->setProcCountryCode("CA"); //"US" for sending transaction to US environment
$mpgRequest->setTestMode(true); //false or comment out this line for production transactions
 
/************************ mpgHttpsPost Object ******************************/
 
$mpgHttpPost  =new mpgHttpsPost($store_id,$api_token,$mpgRequest);
 
/************************ Response Object **********************************/
 
$mpgResponse=$mpgHttpPost->getMpgResponse();
 
print("\nDataKey = " . $mpgResponse->getDataKey());
print("\nReceiptId = " . $mpgResponse->getReceiptId());
print("\nReferenceNum = " . $mpgResponse->getReferenceNum());
print("\nResponseCode = " . $mpgResponse->getResponseCode());
print("\nISO = " . $mpgResponse->getISO());
print("\nAuthCode = " . $mpgResponse->getAuthCode());
print("\nMessage = " . $mpgResponse->getMessage());
print("\nTransDate = " . $mpgResponse->getTransDate());
print("\nTransTime = " . $mpgResponse->getTransTime());
print("\nTransType = " . $mpgResponse->getTransType());
print("\nComplete = " . $mpgResponse->getComplete());
print("\nTransAmount = " . $mpgResponse->getTransAmount());
print("\nCardType = " . $mpgResponse->getCardType());
print("\nTxnNumber = " . $mpgResponse->getTxnNumber());
print("\nTimedOut = " . $mpgResponse->getTimedOut());
print("\nAVSResponse = " . $mpgResponse->getAvsResultCode());
print("\nResSuccess = " . $mpgResponse->getResSuccess());
print("\nPaymentType = " . $mpgResponse->getPaymentType());
 
//----------------- ResolveData ------------------------------
 
print("\n\nCust ID = " . $mpgResponse->getResDataCustId());
print("\nPhone = " . $mpgResponse->getResDataPhone());
print("\nEmail = " . $mpgResponse->getResDataEmail());
print("\nNote = " . $mpgResponse->getResDataNote());
print("\nMasked Pan = " . $mpgResponse->getResDataMaskedPan());
print("\nExp Date = " . $mpgResponse->getResDataExpDate());
print("\nCrypt Type = " . $mpgResponse->getResDataCryptType());
print("\nAvs Street Number = " . $mpgResponse->getResDataAvsStreetNumber());
print("\nAvs Street Name = " . $mpgResponse->getResDataAvsStreetName());
print("\nAvs Zipcode = " . $mpgResponse->getResDataAvsZipcode());
 
?>

                

Purchase with Vault - Transaction Values

$txnArray=array('type'=>'res_purchase_cc',... );

$mpgTxn = new mpgTransaction($txnArray);

$mpgRequest = new mpgRequest($mpgTxn);


Purchase with Vault mandatory values

VALUE TYPE LIMITS SET METHOD / VARIABLE DESCRIPTION
Data Key String 25-character alphanumeric 'data_key' The data key is the token that points to a previously stored profile. Profile identifier that all future financial Vault transactions (that is, they occur after the profile was registered by a ResAddCC or ResTokenizeCC transaction) will use to associate with the saved information.

The data key is generated by Moneris, and is returned to the merchant (via the Receipt object) when the profile is first registered.
Order ID String 50-character alphanumeric 'order_id' Merchant-defined transaction identifier that must be unique for every Purchase, Pre-Authorization and Independent Refund transaction. No two transactions of these types may have the same order ID.

For Refund, Completion and Purchase Correction transactions, the order ID must be the same as that of the original transaction.

The last 10 characters of the order ID are displayed in the “Invoice Number” field on the Merchant Direct Reports. However only letters, numbers and spaces are sent to Merchant Direct.

A minimum of 3 and a maximum of 10 valid characters are sent to Merchant Direct. Only the last characters beginning after any invalid characters are sent. For example, if the order ID is 1234-567890, only 567890 is sent to Merchant Direct.

If the order ID has fewer than 3 characters, it may display a blank or 0000000000 in the Invoice Number field.
Amount String 10-character decimal 'amount' Transaction amount This must contain at least 3 digits, two of which are penny values.

The minimum allowable value is $0.01, and the maximum allowable value is $9999999.99. Transaction amounts of $0.00 are not allowed.
E-Commerce indicator String 1-character alphanumeric 'crypt_type'

Describes the category of e-commerce transaction being processed. Allowable values are:


  • 1 - Mail Order / Telephone Order—Single
  • 2 - Mail Order / Telephone Order—Recurring
  • 3 - Mail Order / Telephone Order—Instalment
  • 4 - Mail Order / Telephone Order—Unknown classification
  • 5 - Authenticated e-commerce transaction (VBV)
  • 6 - Non-authenticated e-commerce transaction (VBV)
  • 7 - SSL-enabled merchant

In Credential on File transactions where the request field e-commerce indicator is also being sent: the allowable values for e-commerce indicator are dependent on the value sent for payment indicator, as follows:


if payment indicator = R, then allowable values for e-commerce indicator: 2, 5 or 6
if payment indicator = C, then allowable values for e-commerce indicator: 1, 5, 6 or 7
if payment indicator = U, then allowable values for e-commerce indicator: 1 or 7
if payment indicator = Z, then allowable values for e-commerce indicator: 1, 5, 6 or 7

Purchase with Vault optional values

VALUE TYPE LIMITS SET METHOD / VARIABLE DECRIPTION
Status Check Boolean true/false $mpgHttpPost = new mpgHttpsPostStatus($store_id,$api_token,$status_check,$mpgRequest); Status Check is a connection object value that allows merchants to verify whether a previously sent transaction was processed successfully. To submit a Status Check request, resend the original transaction with all the same parameter values, but set the status check value to either true or false. Once set to “true”, the gateway will check the status of a transaction that has an order_id that matches the one passed.
  • If the transaction is found, the gateway will respond with the specifics of that transaction.
  • If the transaction is not found, the gateway will respond with a not found message.
  • Once it is set to “false”, the transaction will process as a new transaction.
Things to consider:
  • The Status Check request should only be used once and immediately (within 2 minutes) after the last transaction that had failed.
  • Do not resend the Status Check request if it has timed out. Additional investigation is required.
Expiry Date String 4-character numeric

YYMM format.
'expdate' The optional Expiry Date applies to Hosted Tokenization transactions. If the expiry date was not collected by Hosted Tokenization solution, then it must be set in the Vault transaction request.
Customer ID String 50-character alphanumeric 'cust_id' This can be used for policy number, membership number, student ID, invoice number.

This field is searchable from the Moneris Merchant Resource Centre.
Dynamic descriptor String 20-character alphanumeric 'dynamic_descriptor' Merchant defined description sent on a per-transaction basis that will appear on the credit card statement.  Dependent on the card Issuer, the statement will typically show the dynamic desciptor appended to the merchant's existing business name separated by the "/" character.  Please note that the combined length of the merchant's business name, forward slash "/" character, and the dynamic descriptor may not exceed 22 characters.

-Example-

Existing Business Name:  ABC Painting

Dynamic Descriptor:  Booking 12345

Cardholder Statement Displays:  ABC Painting/Booking 1   
Customer Information Object $mpgCustInfo = new mpgCustInfo();

$mpgTxn->setCustInfo($mpgCustInfo);
Refer below for further breakdown and definition.
AVS Information Object $mpgAvsInfo = new mpgAvsInfo ($avsTemplate);

$mpgTxn->setAvsInfo($mpgAvsInfo);
Refer below for further breakdown and definition.
CVD Information Object $mpgCvdInfo = new mpgCvdInfo ($cvdTemplate);

$mpgTxn->setCvdInfo($mpgCvdInfo);
Refer below for further breakdown and definition.
Recurring Billing Object $mpgRecur = new mpgRecur($recurArray);

$mpgTxn->setRecur($mpgRecur);
Refer below for further breakdown and definition.
COF Info Object $mpgTxn->setCofInfo($cof); Refer to Purchase with Credential on File

mpgCustInfo object mandatory properties

Value Type Limits Set method / Variable Description
Email Address String 60-character alphanumeric $mpgCustInfo->setEmail($email); Customer email address.
Instructions String 100-character alphanumeric $mpgCustInfo->setInstructions($instructions); Instructions or notes.
Billing Information Object $mpgCustInfo->setBilling($billing); Billing information is stored as part of the mpgCustInfo object. A maximum of 1 billing object may be set. They can be written to the object using hash tables.


Refer below for further breakdown and definition.
Shipping Information Object $mpgCustInfo->setShipping($shipping); Shipping information is stored as part of the mpgCustInfo object. A maximum of 1 shipping object may be set. They can be written to the object using hash tables.
Refer below for further breakdown and definition.
Items Array Object $mpgCustInfo->setItems($item); Item information is stored as part of the mpgCustInfo object. Multiple items may be set. They can be written to the object using hash tables.
Refer below for further breakdown and definition.

Setting Billing & Shipping using Hash Tables

Writing billing or shipping information using hash tables is done as follows:

  1. Instantiate an mpgCustInfo object.
  2. Build the hashtable using put methods with the hash table keys in the table below.
  3. Call the mpgCustInfo object's setBilling()/setShipping() method to pass the hashtable information to the mpgCustInfo object
  4. Call the mpgTransaction object's setCustInfo() method to write the CustInfo object (with the billing/shipping information to the transaction object.

Billing & Shipping mandatory values

Value Type Limits Variable/Hash Table Key Description
First Name String 30-character alphanumeric 'first_name' Customer first name
Last Name String 30-character alphanumeric 'last_name' Customer last name
Company Name String 50-character alphanumeric 'company_name' Customer 's company name
Address String 70-character alphanumeric 'address' Customer's address
City String 30-character alphanumeric 'city' Customer's city
Province / State String 30-character alphanumeric 'province' Customer's province or state
Postal / Zip Code String 30-character alphanumeric 'postal_code' Customer's postal or zip code
Country String 30-character alphanumeric 'country' Customer's country
Phone Number String 30-character alphanumeric 'phone_number' Customer's phone number
Fax Number String 30-character alphanumeric 'fax' Customer's fax number
Federal Tax String 10-character alphanumeric 'tax1' Federal tax amount. Amount is not used for calculating total amount.
Provincial / State Tax String 10-character alphanumeric 'tax2' Provincial or state tax amount. Amount is not used for calculating total amount.
Country / Local / Specialty Tax String 10-character alphanumeric 'tax3' County, local or specialty tax amount. Amount is not used for calculating total amount.
Shipping Cost String 10-character alphanumeric 'shipping_cost' Shipping cost. Amount is not used for calculating total amount.

Setting Items using Hash Tables

Writing item information using hash tables is done as follows:

  1. Instantiate an mpgCustInfo object.
  2. Build the hashtable using put methods with the hash table keys in the table below. (The sample code uses a different hash table for each item for clarity purposes. However, the skillful developer can re-use the same one.)
  3. Call the mpgCustInfo object's setItems() method to pass the hashtable information to the mpgCustInfo object
  4. Call the mpgTransaction object's setCustInfo() method to write the mpgCustInfo object (with the item information to the transaction object).

Item mandatory values

Value Type Limits Variable/Hash Table Key Description
Item Name String 45-character alphanumeric 'name' Item name or description.
Item Quantity String 5-character numeric 'quantity' You must send a quantity > 0 or the item will not be added to the item list (i.e. minimum 1, maximum 99999)
Item Product Code String 20-character alphanumeric 'product_code' Item product code or SKU.
Item Extended Amount String 9-character decimal 'extended_amount' Must contain at least 3 digits and 2 penny values.

0.01-999999.99

Vault Response Fields

Value Limits Get Method Description
Data Key 25-character alphanumeric $mpgResponse->getDataKey(); This field is created when a profile is created and a token is returned.

It is a unique profile identifier, and is a required value for all future Vault transactions.
Vault Success true/false $mpgResponse->getResSuccess(); Indicates whether Vault transaction was successful.
Payment Type cc $mpgResponse->getPaymentType(); Indicates the payment type associated with a Vault profile.
Customer ID 30-character alphanumeric $mpgResponse->getResDataCustId(); Returns the customer ID saved in the profile.
Phone Number 30-character alphanumeric $mpgResponse->getResDataPhone(); Returns the phone number saved in the profile.
Email Address 30-character alphanumeric $mpgResponse->getResDataEmail(); Returns the email address saved in the profile.
Note 30-character alphanumeric $mpgResponse->getResDataNote(); Returns the note saved in the profile.
Credit Card Fields
Masked PAN 20-character numeric $mpgResponse->getResDataMaskedPan(); Returns the first 4 last 4 of the card number saved in the profile.
Expiry Date 4-character numeric $mpgResponse->getResDataExpDate(); Returns the expiry date of the card number saved in the profile. YYMM format.
E-Commerce Indicator 1-character numeric $mpgResponse->getResDataCryptType(); Returns the e-commerce indicator saved in the profile.
AVS Street Number 19-character alphanumeric $mpgResponse->getResDataAvsStreetNumber(); Returns the AVS street number saved in the profile. If no other AVS street number is passed in the transaction request, this value will be submitted along with the financial transaction to the issuer.
AVS Street Name 19-character alphanumeric $mpgResponse->getResDataAvsStreetName(); Returns the AVS street name saved in the profile. If no other AVS street number is passed in the transaction request, this value will be submitted along with the financial transaction to the issuer.
AVS Zip/Postal Code 9-character alphanumeric $mpgResponse->getResDataAvsZipcode(); Returns the AVS zip/postal code saved in the profile. If no other AVS street number is passed in the transaction request, this value will be submitted along with the financial transaction to the issuer.

Purchase with Vault and Recurring Billing

NEW!   We now have our Interactive tool for this section.

This transaction uses the data key to identify a previously registered credit card profile. The details saved within the profile are then submitted to perform a Purchase transaction.

The data key may be a temporary one generated using Hosted Tokenization or it may be a permanent one from the Vault.

The Vault feature allows merchants to create customer profiles, edit those profiles, and use them to process transactions without having to enter financial information each time.

The Vault is a complement to the recurring payment module. It securely stores customer account information on Moneris secure servers. This allows merchants to bill customers for routine products or services when an invoice is due.

This transaction allows the merchant to process a Purchase transaction using a data key to reference the card number already on file. In addition, it also registers a new recurring billing profile where going forward Moneris will automatically process the recurring transaction and will bill customers on your behalf based on the billing cycle information you provide.

In addition to instantiating a transaction object and a connection object (as you would for a normal transaction), you must instantiate a Recur object. This object has a number of mandatory properties that must be set.

Any transaction that supports Recurring Billing has a setRecur method. This is used to write the Recurring Billing information to the transaction object before writing the transaction object to the connection object.

Things to consider:

  • To avoid shifting, do not set the start_date after the 28th if the recur_unit is month. To set the billing date for the last day of the month, set recur_unit to eom.

Canada Code Sample

 
require "../../mpgClasses.php";
 
/************************ Request Variables **********************************/
 
$store_id='store5';
$api_token='yesguy';
 
/************************ Transaction Variables ******************************/
 
$data_key='t8RCndWBNFNt4Dx32CCnl2tlz';
$orderid='res-purch-'.date("dmy-G:i:s");
$amount='1.00';
$custid='cust';
$crypt_type='1';
 
/************************** CVD Variables *****************************/
 
$cvd_indicator = '1';
$cvd_value = '198';
 
/********************** CVD Associative Array *************************/
 
$cvdTemplate = array(
                                                                                 'cvd_indicator' => $cvd_indicator,
                     'cvd_value' => $cvd_value
                    );
 
$mpgCvdInfo = new mpgCvdInfo ($cvdTemplate);
 
/************************** Recur Variables *****************************/
 
$recurUnit = 'day';
$startDate = '2015/11/30';
$numRecurs = '4';
$recurInterval = '10';
$recurAmount = '31.00';
$startNow = 'true';
 
/****************************** Recur Array **************************/
 
$recurArray = array('recur_unit'=>$recurUnit,  // (day | week | month)
                                                                                                    'start_date'=>$startDate, //yyyy/mm/dd
                                                                                                    'num_recurs'=>$numRecurs,
                                                                                                    'start_now'=>$startNow,
                                                                                                    'period' => $recurInterval,
                                                                                                    'recur_amount'=> $recurAmount
                                                                                                    );
 
$mpgRecur = new mpgRecur($recurArray);
 
/************************ Transaction Array **********************************/
 
$txnArray=array('type'=>'res_purchase_cc',
                                                                                'data_key'=>$data_key,
                                                'order_id'=>$orderid,
                                                'cust_id'=>$custid,
                                                'amount'=>$amount,
                                                'crypt_type'=>$crypt_type
                                                 );
 
/************************ Transaction Object *******************************/
 
$mpgTxn = new mpgTransaction($txnArray);
$mpgTxn->setCvdInfo($mpgCvdInfo);
$mpgTxn->setRecur($mpgRecur);
 
/******************* Credential on File **********************************/
 
$cof = new CofInfo();
$cof->setPaymentIndicator("R");
$cof->setPaymentInformation("2");
$cof->setIssuerId("168451306048014");
 
$mpgTxn->setCofInfo($cof);
 
/************************ Request Object **********************************/
 
$mpgRequest = new mpgRequest($mpgTxn);
$mpgRequest->setProcCountryCode("CA"); //"US" for sending transaction to US environment
$mpgRequest->setTestMode(true); //false or comment out this line for production transactions
 
/************************ mpgHttpsPost Object ******************************/
 
$mpgHttpPost  =new mpgHttpsPost($store_id,$api_token,$mpgRequest);
 
/************************ Response Object **********************************/
 
$mpgResponse=$mpgHttpPost->getMpgResponse();
 
print("\nDataKey = " . $mpgResponse->getDataKey());
print("\nReceiptId = " . $mpgResponse->getReceiptId());
print("\nReferenceNum = " . $mpgResponse->getReferenceNum());
print("\nResponseCode = " . $mpgResponse->getResponseCode());
print("\nISO = " . $mpgResponse->getISO());
print("\nAuthCode = " . $mpgResponse->getAuthCode());
print("\nMessage = " . $mpgResponse->getMessage());
print("\nTransDate = " . $mpgResponse->getTransDate());
print("\nTransTime = " . $mpgResponse->getTransTime());
print("\nTransType = " . $mpgResponse->getTransType());
print("\nComplete = " . $mpgResponse->getComplete());
print("\nTransAmount = " . $mpgResponse->getTransAmount());
print("\nCardType = " . $mpgResponse->getCardType());
print("\nTxnNumber = " . $mpgResponse->getTxnNumber());
print("\nTimedOut = " . $mpgResponse->getTimedOut());
print("\nAVSResponse = " . $mpgResponse->getAvsResultCode());
print("\nRecurSuccess = " . $mpgResponse->getRecurSuccess());
print("\nResSuccess = " . $mpgResponse->getResSuccess());
print("\nPaymentType = " . $mpgResponse->getPaymentType());
print("\nIssuerId = " . $mpgResponse->getIssuerId());
 
//----------------- ResolveData ------------------------------
 
print("\n\nCust ID = " . $mpgResponse->getResDataCustId());
print("\nPhone = " . $mpgResponse->getResDataPhone());
print("\nEmail = " . $mpgResponse->getResDataEmail());
print("\nNote = " . $mpgResponse->getResDataNote());
print("\nMasked Pan = " . $mpgResponse->getResDataMaskedPan());
print("\nExp Date = " . $mpgResponse->getResDataExpDate());
print("\nCrypt Type = " . $mpgResponse->getResDataCryptType());
print("\nAvs Street Number = " . $mpgResponse->getResDataAvsStreetNumber());
print("\nAvs Street Name = " . $mpgResponse->getResDataAvsStreetName());
print("\nAvs Zipcode = " . $mpgResponse->getResDataAvsZipcode());
 
?>

                

Transaction Values

$txnArray=array('type'=>'res_purchase_cc',... );

$mpgTxn = new mpgTransaction($txnArray);

$mpgRequest = new mpgRequest($mpgTxn);


Purchase object mandatory values

Value Type Limits Set method / Variable Description
Order ID String 50-character alphanumeric 'order_id' Merchant-defined transaction identifier that must be unique for every Purchase, Pre-Authorization and Independent Refund transaction. No two transactions of these types may have the same order ID.

For Refund, Completion and Purchase Correction transactions, the order ID must be the same as that of the original transaction.

The last 10 characters of the order ID are displayed in the “Invoice Number” field on the Merchant Direct Reports. However only letters, numbers and spaces are sent to Merchant Direct.

A minimum of 3 and a maximum of 10 valid characters are sent to Merchant Direct. Only the last characters beginning after any invalid characters are sent. For example, if the order ID is 1234-567890, only 567890 is sent to Merchant Direct.

If the order ID has fewer than 3 characters, it may display a blank or 0000000000 in the Invoice Number field.
Amount String 10-character decimal 'amount' Transaction amount This must contain at least 3 digits, two of which are penny values.

The minimum allowable value is $0.01, and the maximum allowable value is $9999999.99. Transaction amounts of $0.00 are not allowed.
Credit card number String 20-character numeric 'pan' Most credit card numbers today are 16 digits, but some 13-digit numbers are still accepted by some issuers. This field has been intentionally expanded to 20 digits in consideration for future expansion and potential support of private label card ranges.
Expiry date String 4-character numeric

YYMM format.
'expdate' Submit in YYMM format.

Note: This is the reverse of the date displayed on the physical card, which is MMYY.
E-Commerce indicator String 1-character alphanumeric 'crypt_type'

Describes the category of e-commerce transaction being processed. Allowable values are:


  • 1 - Mail Order / Telephone Order—Single
  • 2 - Mail Order / Telephone Order—Recurring
  • 3 - Mail Order / Telephone Order—Instalment
  • 4 - Mail Order / Telephone Order—Unknown classification
  • 5 - Authenticated e-commerce transaction (VBV)
  • 6 - Non-authenticated e-commerce transaction (VBV)
  • 7 - SSL-enabled merchant

In Credential on File transactions where the request field e-commerce indicator is also being sent: the allowable values for e-commerce indicator are dependent on the value sent for payment indicator, as follows:


if payment indicator = R, then allowable values for e-commerce indicator: 2, 5 or 6
if payment indicator = C, then allowable values for e-commerce indicator: 1, 5, 6 or 7
if payment indicator = U, then allowable values for e-commerce indicator: 1 or 7
if payment indicator = Z, then allowable values for e-commerce indicator: 1, 5, 6 or 7

Purchase optional values

VALUE TYPE LIMITS SET METHOD / VARIABLE DESCRIPTION
Status Check Boolean true/false $mpgHttpPost = new mpgHttpsPostStatus($store_id,$api_token,$status_check,$mpgRequest); Status Check is a connection object value that allows merchants to verify whether a previously sent transaction was processed successfully. To submit a Status Check request, resend the original transaction with all the same parameter values, but set the status check value to either true or false. Once set to “true”, the gateway will check the status of a transaction that has an order_id that matches the one passed.
  • If the transaction is found, the gateway will respond with the specifics of that transaction.
  • If the transaction is not found, the gateway will respond with a not found message.
  • Once it is set to “false”, the transaction will process as a new transaction.
Things to consider:
  • The Status Check request should only be used once and immediately (within 2 minutes) after the last transaction that had failed.
  • Do not resend the Status Check request if it has timed out. Additional investigation is required.
Expiry Date String 4-character numeric

YYMM format.
'expdate' The optional Expiry Date applies to Hosted Tokenization transactions. If the expiry date was not collected by Hosted Tokenization solution, then it must be set in the Vault transaction request.
Customer ID String 50-character alphanumeric 'cust_id' This can be used for policy number, membership number, student ID, invoice number.

This field is searchable from the Moneris Merchant Resource Centre.