My Profile_


Encrypted Purchase

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

This transaction allows for the ability to key in data into a Moneris-provided encrypted MSR device and pass the encrypted track 2 value to process a card not present transaction.

Things to consider:

  • This transaction supports manually keyed card not present.
  • For either swiped or manually keyed card present transaction using the encrypted MSR device please refer to Encrypted Mag Swipe Purchase.

Canada Code Sample

package Canada;

import JavaAPI.*;

public class TestCanadaEncPurchase
{
	public static void main(String[] args)
	{
		String store_id = "moneris";
		String api_token = "hurgle";
		java.util.Date createDate = new java.util.Date(); 
		String order_id = "Test"+createDate.getTime();
		String amount = "1.00";
		String crypt = "7";
		String cust_id = "my customer id";
		String processing_country_code = "CA";
		boolean status_check = false;
		String device_type = "idtech_bdk";
		String enc_track2 = "0284008500000000041608B84D1586DEDBA1F0DB3CECD296C41195AFECE7CA8F3A00E6DBA97A4EFDEF05D3935553E9E24B5AEFC7B2330431393035FFFF3141594047A0009A7FB103";

		EncPurchase encpurchase = new EncPurchase();
		encpurchase.setOrderId(order_id);
		encpurchase.setAmount(amount);
		encpurchase.setCustId(cust_id);
		encpurchase.setEncTrack2(enc_track2);
		encpurchase.setDeviceType(device_type);
		encpurchase.setCryptType(crypt);
		encpurchase.setDynamicDescriptor("my descriptor");

		HttpsPostRequest mpgReq = new HttpsPostRequest();
		mpgReq.setProcCountryCode(processing_country_code);
		mpgReq.setTestMode(true); //false or comment out this line for production transactions
		mpgReq.setStoreId(store_id);
		mpgReq.setApiToken(api_token);
		mpgReq.setTransaction(encpurchase);
		mpgReq.setStatusCheck(status_check);
		mpgReq.send();

		try
		{
			Receipt receipt = mpgReq.getReceipt();

			System.out.println("CardType = " + receipt.getCardType());
			System.out.println("TransAmount = " + receipt.getTransAmount());
			System.out.println("TxnNumber = " + receipt.getTxnNumber());
			System.out.println("ReceiptId = " + receipt.getReceiptId());
			System.out.println("TransType = " + receipt.getTransType());
			System.out.println("ReferenceNum = " + receipt.getReferenceNum());
			System.out.println("ResponseCode = " + receipt.getResponseCode());
			System.out.println("Message = " + receipt.getMessage());
			System.out.println("AuthCode = " + receipt.getAuthCode());
			System.out.println("Complete = " + receipt.getComplete());
			System.out.println("TransDate = " + receipt.getTransDate());
			System.out.println("TransTime = " + receipt.getTransTime());
			System.out.println("Ticket = " + receipt.getTicket());
			System.out.println("TimedOut = " + receipt.getTimedOut());
			System.out.println("CardLevelResult = " + receipt.getCardLevelResult());
			System.out.println("MaskedPan = " + receipt.getMaskedPan());
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}

                
USA Code Sample

package USA;

import JavaAPI.*;

public class TestUSAEncPurchase
{
	public static void main(String[] args)
	{
		String store_id = "monusqa002";
		String api_token = "qatoken";
		java.util.Date createDate = new java.util.Date(); 
		String order_id = "Test"+createDate.getTime();
		String amount = "1.00";
		String crypt = "7";
		String cust_id = "my customer id";
		String commcard_invoice = "INVC090";
		String commcard_tax_amount = "1.00";
		String processing_country_code = "US";
		boolean status_check = false;
		String device_type = "idtech";
		String enc_track2 = "0284008500000000041608B84D1586DEDBA1F0DB3CECD296C41195AFECE7CA8F3A00E6DBA97A4EFDEF05D3935553E9E24B5AEFC7B2330431393035FFFF3141594047A0009A7FB103";
		String enc_track3 = 
				"02D901801F4F2800039B%*4924********4030^TESTCARD/MONERIS^***************************************"
				+ "**?*;4924********4030=********************?*A7150C78335A5024949516FDA9A68A91C4FBAB1279DD1DE2283D"
				+ "BEBB2C6B3FDEACF7B5B314219D76C00890F347A9640EFE90023E31622F5FD95C14C0362DD2EAB28ADEB46B8B577DA1A1"
				+ "8B707BCC7E48068EFF1882CFB4B369BDC4BB646C870D6083239860B23837EA91DB3F1D8AD066DAAACE2B2DA18D563E4F"
				+ "1EF997696337B8999E9C707DEC4CB0410B887291CAF2EE449573D01613484B80760742A3506C31415939320000A00028"
				+ "3C5E03";

		EncPurchase encpurchase = new EncPurchase();
		encpurchase.setOrderId(order_id);
		encpurchase.setAmount(amount);
		encpurchase.setCustId(cust_id);
		encpurchase.setEncTrack2(enc_track2);
		encpurchase.setDeviceType(device_type);
		encpurchase.setCryptType(crypt);
		encpurchase.setDynamicDescriptor("my descriptor");
/*
		
		encpurchase.setOrderId(order_id);
		encpurchase.setAmount(amount);
		encpurchase.setEncTrack2(enc_track2);
		encpurchase.setDeviceType(device_type);
		encpurchase.setCryptType(crypt);
		encpurchase.setCommcardInvoice(commcard_invoice);
		encpurchase.setCommcardTaxAmount(commcard_tax_amount);
		*/

		HttpsPostRequest mpgReq = new HttpsPostRequest();
		mpgReq.setProcCountryCode(processing_country_code);
		mpgReq.setTestMode(true); //false or comment out this line for production transactions
		mpgReq.setStoreId(store_id);
		mpgReq.setApiToken(api_token);
		mpgReq.setTransaction(encpurchase);
		mpgReq.setStatusCheck(status_check);
		mpgReq.send();

		try
		{
			Receipt receipt = mpgReq.getReceipt();

			System.out.println("CardType = " + receipt.getCardType());
			System.out.println("TransAmount = " + receipt.getTransAmount());
			System.out.println("TxnNumber = " + receipt.getTxnNumber());
			System.out.println("ReceiptId = " + receipt.getReceiptId());
			System.out.println("TransType = " + receipt.getTransType());
			System.out.println("ReferenceNum = " + receipt.getReferenceNum());
			System.out.println("ResponseCode = " + receipt.getResponseCode());
			System.out.println("Message = " + receipt.getMessage());
			System.out.println("AuthCode = " + receipt.getAuthCode());
			System.out.println("Complete = " + receipt.getComplete());
			System.out.println("TransDate = " + receipt.getTransDate());
			System.out.println("TransTime = " + receipt.getTransTime());
			System.out.println("Ticket = " + receipt.getTicket());
			System.out.println("TimedOut = " + receipt.getTimedOut());
			System.out.println("CardLevelResult = " + receipt.getCardLevelResult());
			System.out.println("MaskedPan = " + receipt.getMaskedPan());
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}

                

Encrypted Purchase - Transaction Values

EncPurchase encpurchase = new EncPurchase();
HttpsPostRequest mpgReq = new HttpsPostRequest();
mpgReq.setTransaction(encpurchase);

Encrypted Purchase object mandatory values

VALUE TYPE LIMITS SET METHOD DESCRIPTION
Order ID String 50-character alphanumeric encpurchase.setOrderId(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.   Canada: 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.   US: The last 32 characters of the order ID are sent on to the Client Line settlement reports.   For either countries, If the order ID has fewer than 3 characters, it may display a blank or 0000000000 in the Invoice Number field.
Amount String 9-character decimal encpurchase.setAmount(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 $999999.99. Transaction amounts of $0.00 are not allowed.
Encrypted Track 2 data String   encpurchase.setEncTrack2 (enc_track2); String that is retrieved by swiping or keying in a credit card number through a Moneris-provided encrypted mag swipe card reader. It is part of an encrypted keyed or swiped transaction only. This string must be retrieved by a specific device. (See Device Type below for the list of current available devices.)
Device Type String 30 – character alphanumeric encpurchase.setDeviceType (device_type); Type of encrypted mag swipe reader that was used to read the credit card. This must be a Moneris-provided device so that the values are properly encrypted and decrypted. This field is case-sensitive. Available values are: "idtech".
E-Commerce indicator String 1-character alphanumeric encpurchase.setCryptType(crypt); Supported 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
  • 8 - Non-secure transaction (web- or email-based)
  • 9 - SET non-authenticated transaction
 

Encrypted Purchase optional values

VALUE TYPE LIMITS SET METHOD DECRIPTION
Status Check Boolean true/false mpgReq.setStatusCheck (status_check); 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 encpurchase.setCustId(cust_id); This can be used for policy number, membership number, student ID, or invoice number. This field is searchable from the Moneris Merchant Resource Centre.
Dynamic descriptor String 20-character alphanumeric encpurchase.setDynamicDescriptor ("my descriptor"); Merchant defined description sent on a per-transaction basis that will appear on the credit card statement appended to the merchant’s business name. 
The combined length of the merchant’s business name and dynamic_descriptor may not exceed 25 characters.
Commercial card invoice String 17-character alphanumeric encpurchase.setCommcardInvoice (commcard_invoice); Available to US integrations only. Level 2 Invoice Number for the transaction used for Corporate Credit Card transactions (Commercial Purchasing Cards). Characters allowed for commcard_invoice: a-z A-Z 0-9 spaces
Commercial card tax amount String 9-character decimal encpurchase.setCommcardTaxAmount (commcard_tax_amount); Available to US integrations only. Level 2 Tax Amount of the transaction used for Corporate Credit Card transactions (Commercial Purchasing Cards). This must contain 3 digits with two penny values. The minimum value passed can be 0.00 and the maximum is 9999999.99
AVS Information Object   AvsInfo avsCheck = new AvsInfo();
encpurchase.setAvsInfo(avsCheck);
Refer below for further breakdown and definition.
CVD Information Object   CvdInfo cvdCheck = new CvdInfo();
encpurchase.setCvdInfo(cvdCheck);
Refer below for further breakdown and definition.
Customer Information Object   CustInfo customer = new CustInfo(); encpurchase.setCustInfo(customer); Refer below for further breakdown and definition.
Recurring Billing Object   Recur recurring_cycle = new Recur(recur_unit, start_now, start_date, num_recurs, period, recur_amount); encpurchase.setRecur(recurring_cycle); Refer below for further breakdown and definition.

Predecessors
  • None
Successors

Encrypted Purchase with Customer Information

This transaction allows for the ability to key in data into a Moneris-provided encrypted MSR device and pass the encrypted track 2 value to process a card not present transaction.

The Customer Information object is an optional add-on to a number of transactions. 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.

In addition to instantiating a transaction object and a connection object (as you would for a normal transaction), you must instantiate a CustInfo object. Any transaction that supports CustInfo has a setCustInfo method. This is used to write the customer information to the transaction object.

The Customer Information object holds three types of information:

  • Miscellaneous customer information properties
  • Billing/Shipping information
  • Item information

Things to consider:

  • If you send characters that are not included in the allowed list, these extra transaction details may not be stored.
  • All fields are alphanumeric and allow the following characters: a-z A-Z 0-9 _ - : . @ $ = /
  • All French accents should be encoded as HTML entities, such as é
  • The data sent in Billing and Shipping Address fields will not be used for any address verification.

Canada Code Sample

package Canada;

import JavaAPI.*;

public class TestCanadaEncPurchaseCustInfo
{
	public static void main(String[] args)
	{
		String store_id = "moneris";
		String api_token = "hurgle";
		java.util.Date createDate = new java.util.Date(); 
		String order_id = "Test"+createDate.getTime();
		String amount = "5.00";
		String crypt = "7";
		String device_type = "idtech_bdk";
		String enc_track2 = "02840085000000000416EA7637C390587C593F32E83AFC176194B43F34B8F898BCF7715270F280B3804F25340C85C7C3D36138780D880431393035FFFF3141594047A0009B04AE03";
		
		String processing_country_code = "CA";
		boolean status_check = false;


		/********************* Billing/Shipping Variables ****************************/

		String first_name = "Bob";
		String last_name = "Smith";
		String company_name = "ProLine Inc.";
		String address = "623 Bears Ave";
		String city = "Chicago";
		String province = "Illinois";
		String postal_code = "M1M2M1";
		String country = "Canada";
		String phone = "777-999-7777";
		String fax = "777-999-7778";
		String tax1 = "10.00";
		String tax2 = "5.78";
		String tax3 = "4.56";
		String shipping_cost = "10.00";

		/********************* Order Line Item Variables *****************************/

		String[] item_description = new String[] { "Chicago Bears Helmet", "Soldier Field Poster" };
		String[] item_quantity = new String[] { "1", "1" };
		String[] item_product_code = new String[] { "CB3450", "SF998S" };
		String[] item_extended_amount = new String[] { "150.00", "19.79" };

		/********************** Customer Information Object **************************/

		CustInfo customer = new CustInfo();

		/********************** Set Customer Billing Information **********************/

		customer.setBilling(first_name, last_name, company_name, address, city,
				province, postal_code, country, phone, fax, tax1, tax2,
				tax3, shipping_cost);

		/******************** Set Customer Shipping Information ***********************/

		customer.setShipping(first_name, last_name, company_name, address, city,
				province, postal_code, country, phone, fax, tax1, tax2,
				tax3, shipping_cost);

		/***************************** Order Line Items  ******************************/

		customer.setItem(item_description[0], item_quantity[0],
				item_product_code[0], item_extended_amount[0]);

		customer.setItem(item_description[1], item_quantity[1],
				item_product_code[1], item_extended_amount[1]);

		
		EncPurchase encpurchase = new EncPurchase();
		encpurchase.setOrderId(order_id);
		encpurchase.setAmount(amount);
		encpurchase.setEncTrack2(enc_track2);
		encpurchase.setDeviceType(device_type);
		encpurchase.setCryptType(crypt);
		encpurchase.setCustInfo(customer);

		HttpsPostRequest mpgReq = new HttpsPostRequest();
		mpgReq.setProcCountryCode(processing_country_code);
		mpgReq.setTestMode(true); //false or comment out this line for production transactions
		mpgReq.setStoreId(store_id);
		mpgReq.setApiToken(api_token);
		mpgReq.setTransaction(encpurchase);
		mpgReq.setStatusCheck(status_check);
		mpgReq.send();

		try
		{
			Receipt receipt = mpgReq.getReceipt();

			System.out.println("CardType = " + receipt.getCardType());
			System.out.println("TransAmount = " + receipt.getTransAmount());
			System.out.println("TxnNumber = " + receipt.getTxnNumber());
			System.out.println("ReceiptId = " + receipt.getReceiptId());
			System.out.println("TransType = " + receipt.getTransType());
			System.out.println("ReferenceNum = " + receipt.getReferenceNum());
			System.out.println("ResponseCode = " + receipt.getResponseCode());
			System.out.println("ISO = " + receipt.getISO());
			System.out.println("BankTotals = " + receipt.getBankTotals());
			System.out.println("Message = " + receipt.getMessage());
			System.out.println("AuthCode = " + receipt.getAuthCode());
			System.out.println("Complete = " + receipt.getComplete());
			System.out.println("TransDate = " + receipt.getTransDate());
			System.out.println("TransTime = " + receipt.getTransTime());
			System.out.println("Ticket = " + receipt.getTicket());
			System.out.println("TimedOut = " + receipt.getTimedOut());
			System.out.println("CardLevelResult = " + receipt.getCardLevelResult());
			System.out.println("MaskedPan = " + receipt.getMaskedPan());
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}

                
USA Code Sample

package USA;

import JavaAPI.*;

public class TestUSAEncPurchaseCustInfo
{
	public static void main(String[] args)
	{
		String store_id = "monusqa002";
		String api_token = "qatoken";
		java.util.Date createDate = new java.util.Date(); 
		String order_id = "Test"+createDate.getTime();
		String amount = "5.00";
		String crypt = "7";
		String commcard_invoice = "INVC090";
		String commcard_tax_amount = "1.00";
		String device_type = "idtech";
		String enc_track2 = "02840085000000000416EA7637C390587C593F32E83AFC176194B43F34B8F898BCF7715270F280B3804F25340C85C7C3D36138780D880431393035FFFF3141594047A0009B04AE03";
		
		String processing_country_code = "US";
		boolean status_check = false;

		EncPurchase encpurchase = new EncPurchase();
		encpurchase.setOrderId(order_id);
		encpurchase.setAmount(amount);
		encpurchase.setEncTrack2(enc_track2);
		encpurchase.setDeviceType(device_type);
		encpurchase.setCryptType(crypt);
		encpurchase.setCommcardInvoice(commcard_invoice);
		encpurchase.setCommcardTaxAmount(commcard_tax_amount);


		/********************* Billing/Shipping Variables ****************************/

		String first_name = "Bob";
		String last_name = "Smith";
		String company_name = "ProLine Inc.";
		String address = "623 Bears Ave";
		String city = "Chicago";
		String province = "Illinois";
		String postal_code = "M1M2M1";
		String country = "Canada";
		String phone = "777-999-7777";
		String fax = "777-999-7778";
		String tax1 = "10.00";
		String tax2 = "5.78";
		String tax3 = "4.56";
		String shipping_cost = "10.00";

		/********************* Order Line Item Variables *****************************/

		String[] item_description = new String[] { "Chicago Bears Helmet", "Soldier Field Poster" };
		String[] item_quantity = new String[] { "1", "1" };
		String[] item_product_code = new String[] { "CB3450", "SF998S" };
		String[] item_extended_amount = new String[] { "150.00", "19.79" };

		/********************** Customer Information Object **************************/

		CustInfo customer = new CustInfo();

		/********************** Set Customer Billing Information **********************/

		customer.setBilling(first_name, last_name, company_name, address, city,
				province, postal_code, country, phone, fax, tax1, tax2,
				tax3, shipping_cost);

		/******************** Set Customer Shipping Information ***********************/

		customer.setShipping(first_name, last_name, company_name, address, city,
				province, postal_code, country, phone, fax, tax1, tax2,
				tax3, shipping_cost);

		/***************************** Order Line Items  ******************************/

		customer.setItem(item_description[0], item_quantity[0],
				item_product_code[0], item_extended_amount[0]);

		customer.setItem(item_description[1], item_quantity[1],
				item_product_code[1], item_extended_amount[1]);

		encpurchase.setCustInfo(customer);

		HttpsPostRequest mpgReq = new HttpsPostRequest();
		mpgReq.setProcCountryCode(processing_country_code);
		mpgReq.setTestMode(true); //false or comment out this line for production transactions
		mpgReq.setStoreId(store_id);
		mpgReq.setApiToken(api_token);
		mpgReq.setTransaction(encpurchase);
		mpgReq.setStatusCheck(status_check);
		mpgReq.send();

		try
		{
			Receipt receipt = mpgReq.getReceipt();

			System.out.println("CardType = " + receipt.getCardType());
			System.out.println("TransAmount = " + receipt.getTransAmount());
			System.out.println("TxnNumber = " + receipt.getTxnNumber());
			System.out.println("ReceiptId = " + receipt.getReceiptId());
			System.out.println("TransType = " + receipt.getTransType());
			System.out.println("ReferenceNum = " + receipt.getReferenceNum());
			System.out.println("ResponseCode = " + receipt.getResponseCode());
			System.out.println("ISO = " + receipt.getISO());
			System.out.println("BankTotals = " + receipt.getBankTotals());
			System.out.println("Message = " + receipt.getMessage());
			System.out.println("AuthCode = " + receipt.getAuthCode());
			System.out.println("Complete = " + receipt.getComplete());
			System.out.println("TransDate = " + receipt.getTransDate());
			System.out.println("TransTime = " + receipt.getTransTime());
			System.out.println("Ticket = " + receipt.getTicket());
			System.out.println("TimedOut = " + receipt.getTimedOut());
			System.out.println("CardLevelResult = " + receipt.getCardLevelResult());
			System.out.println("MaskedPan = " + receipt.getMaskedPan());
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}

                

Encrypted Purchase with Customer Information - Transaction Values

EncPurchase encpurchase = new EncPurchase();

HttpsPostRequest mpgReq = new HttpsPostRequest();

mpgReq.setTransaction(encpurchase);

Encrypted Purchase with Customer Information mandatory values

VALUE TYPE LIMITS SET METHOD DESCRIPTION
Order ID String 50-character alphanumeric encpurchase.setOrderId(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.   Canada: 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.   US: The last 32 characters of the order ID are sent on to the Client Line settlement reports.   For either countries, If the order ID has fewer than 3 characters, it may display a blank or 0000000000 in the Invoice Number field.
Amount String 9-character decimal encpurchase.setAmount(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 $999999.99. Transaction amounts of $0.00 are not allowed.
Encrypted Track 2 data String   encpurchase.setEncTrack2 (enc_track2); String that is retrieved by swiping or keying in a credit card number through a Moneris-provided encrypted mag swipe card reader. It is part of an encrypted keyed or swiped transaction only. This string must be retrieved by a specific device. (See Device Type below for the list of current available devices.)
Device Type String 30 – character alphanumeric encpurchase.setDeviceType (device_type); Type of encrypted mag swipe reader that was used to read the credit card. This must be a Moneris-provided device so that the values are properly encrypted and decrypted. This field is case-sensitive. Available values are: "idtech".
E-Commerce indicator String 1-character alphanumeric encpurchase.setCryptType(crypt); Supported 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
  • 8 - Non-secure transaction (web- or email-based)
  • 9 - SET non-authenticated transaction
 

Encrypted Purchase with Customer Information optional values

VALUE TYPE LIMITS SET METHOD DECRIPTION
Status Check Boolean true/false mpgReq.setStatusCheck (status_check); 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 encpurchase.setCustId(cust_id); This can be used for policy number, membership number, student ID, or invoice number. This field is searchable from the Moneris Merchant Resource Centre.
Dynamic descriptor String 20-character alphanumeric encpurchase.setDynamicDescriptor ("my descriptor"); Merchant defined description sent on a per-transaction basis that will appear on the credit card statement appended to the merchant’s business name. 
The combined length of the merchant’s business name and dynamic_descriptor may not exceed 25 characters.
Commercial card invoice String 17-character alphanumeric encpurchase.setCommcardInvoice (commcard_invoice); Available to US integrations only. Level 2 Invoice Number for the transaction used for Corporate Credit Card transactions (Commercial Purchasing Cards). Characters allowed for commcard_invoice: a-z A-Z 0-9 spaces
Commercial card tax amount String 9-character decimal encpurchase.setCommcardTaxAmount (commcard_tax_amount); Available to US integrations only. Level 2 Tax Amount of the transaction used for Corporate Credit Card transactions (Commercial Purchasing Cards). This must contain 3 digits with two penny values. The minimum value passed can be 0.00 and the maximum is 9999999.99
AVS Information Object   AvsInfo avsCheck = new AvsInfo();
encpurchase.setAvsInfo(avsCheck);
Refer below for further breakdown and definition.
CVD Information Object   CvdInfo cvdCheck = new CvdInfo();
encpurchase.setCvdInfo(cvdCheck);
Refer below for further breakdown and definition.
Customer Information Object   CustInfo customer = new CustInfo(); encpurchase.setCustInfo(customer); Refer below for further breakdown and definition.
Recurring Billing Object   Recur recurring_cycle = new Recur(recur_unit, start_now, start_date, num_recurs, period, recur_amount); encpurchase.setRecur(recurring_cycle); Refer below for further breakdown and definition.

CustInfo object mandatory properties

VALUE TYPE LIMITS SET METHOD DECRIPTION
Email Address String 60-character alphanumeric customer.setEmail("nick@widget.com"); Customer email address.
Instructions String 100-character alphanumeric customer.setInstructions("Rush!"); Instructions or notes.
Billing Information Object   customer.setBilling(first_name, last_name, company_name, address, city, province, postal_code, country, phone, fax, tax1, tax2, tax3, shipping_cost);  Billing information is stored as part of the CustInfo object. A maximum of 1 billing object may be set. Refer below for further breakdown and definition.
Shipping Information Object   customer.setShipping(first_name, last_name, company_name, address, city, province, postal_code, country, phone, fax, tax1, tax2, tax3, shipping_cost);  Shipping information is stored as part of the CustInfo object. A maximum of 1 shipping object may be set. Refer below for further breakdown and definition.
Items Array Object   customer.setItem(item_description[0], item_quantity[0], item_product_code[0], item_extended_amount[0]);  Item information is stored as part of the CustInfo object. Multiple items may be set. Refer below for further breakdown and definition.

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" 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.

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

Predecessors
  • None
Successors

Encrypted Purchase with CVD and AVS

This transaction allows for the ability to key in data into a Moneris-provided encrypted MSR device and pass the encrypted track 2 value to process a card not present transaction.

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 front. 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 response 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 or declined 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 and American Express.
  • 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 and AVS Result Code tables.

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.

Canada Code Sample

package Canada;

import JavaAPI.*;

public class TestCanadaEncPurchaseEfraud
{
	public static void main(String[] args)
	{
		String store_id = "moneris";
		String api_token = "hurgle";
		java.util.Date createDate = new java.util.Date(); 
		String order_id = "Test"+createDate.getTime();
		String amount = "5.00";
		String crypt = "7";
		String processing_country_code = "CA";
		boolean status_check = false;
		String device_type = "idtech_bdk";
		String enc_track2 = "0284008500000000041608B84D1586DEDBA1F0DB3CECD296C41195AFECE7CA8F3A00E6DBA97A4EFDEF05D3935553E9E24B5AEFC7B2330431393035FFFF3141594047A0009A7FB103";
		
		AvsInfo avsCheck = new AvsInfo();
		avsCheck.setAvsStreetNumber("212");
		avsCheck.setAvsStreetName("Payton Street");
		avsCheck.setAvsZipCode("M1M1M1");

		CvdInfo cvdCheck = new CvdInfo();
		cvdCheck.setCvdIndicator("1");
		cvdCheck.setCvdValue("099");

		EncPurchase encpurchase = new EncPurchase();
		encpurchase.setOrderId(order_id);
		encpurchase.setAmount(amount);
		encpurchase.setEncTrack2(enc_track2);
		encpurchase.setDeviceType(device_type);
		encpurchase.setCryptType(crypt);
		encpurchase.setAvsInfo(avsCheck);
		encpurchase.setCvdInfo(cvdCheck);

		HttpsPostRequest mpgReq = new HttpsPostRequest();
		mpgReq.setProcCountryCode(processing_country_code);
		mpgReq.setTestMode(true); //false or comment out this line for production transactions
		mpgReq.setStoreId(store_id);
		mpgReq.setApiToken(api_token);
		mpgReq.setTransaction(encpurchase);
		mpgReq.setStatusCheck(status_check);
		mpgReq.send();

		try
		{
			Receipt receipt = mpgReq.getReceipt();

			System.out.println("CardType = " + receipt.getCardType());
			System.out.println("TransAmount = " + receipt.getTransAmount());
			System.out.println("TxnNumber = " + receipt.getTxnNumber());
			System.out.println("ReceiptId = " + receipt.getReceiptId());
			System.out.println("TransType = " + receipt.getTransType());
			System.out.println("ReferenceNum = " + receipt.getReferenceNum());
			System.out.println("ResponseCode = " + receipt.getResponseCode());
			System.out.println("ISO = " + receipt.getISO());
			System.out.println("BankTotals = " + receipt.getBankTotals());
			System.out.println("Message = " + receipt.getMessage());
			System.out.println("AuthCode = " + receipt.getAuthCode());
			System.out.println("Complete = " + receipt.getComplete());
			System.out.println("TransDate = " + receipt.getTransDate());
			System.out.println("TransTime = " + receipt.getTransTime());
			System.out.println("Ticket = " + receipt.getTicket());
			System.out.println("TimedOut = " + receipt.getTimedOut());
			System.out.println("Avs Response = " + receipt.getAvsResultCode());
			System.out.println("Cvd Response = " + receipt.getCvdResultCode());
			System.out.println("CardLevelResult = " + receipt.getCardLevelResult());
			System.out.println("MaskedPan = " + receipt.getMaskedPan());
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}

                
USA Code Sample

package USA;

import JavaAPI.*;

public class TestUSAEncPurchaseEfraud
{
	public static void main(String[] args)
	{
		String store_id = "monusqa002";
		String api_token = "qatoken";
		java.util.Date createDate = new java.util.Date(); 
		String order_id = "Test"+createDate.getTime();
		String amount = "5.00";
		String crypt = "7";
		String commcard_invoice = "INV98798";
		String commcard_tax_amount = "1.00";
		String processing_country_code = "US";
		boolean status_check = false;
		String device_type = "idtech";
		String enc_track2 = "0284008500000000041608B84D1586DEDBA1F0DB3CECD296C41195AFECE7CA8F3A00E6DBA97A4EFDEF05D3935553E9E24B5AEFC7B2330431393035FFFF3141594047A0009A7FB103";
		
		AvsInfo avsCheck = new AvsInfo();
		avsCheck.setAvsStreetNumber("212");
		avsCheck.setAvsStreetName("Payton Street");
		avsCheck.setAvsZipCode("M1M1M1");

		CvdInfo cvdCheck = new CvdInfo();
		cvdCheck.setCvdIndicator("1");
		cvdCheck.setCvdValue("099");

		EncPurchase encpurchase = new EncPurchase();
		encpurchase.setOrderId(order_id);
		encpurchase.setAmount(amount);
		encpurchase.setEncTrack2(enc_track2);
		encpurchase.setDeviceType(device_type);
		encpurchase.setCryptType(crypt);
		encpurchase.setCommcardInvoice(commcard_invoice);
		encpurchase.setCommcardTaxAmount(commcard_tax_amount);
		encpurchase.setAvsInfo(avsCheck);
		encpurchase.setCvdInfo(cvdCheck);

		HttpsPostRequest mpgReq = new HttpsPostRequest();
		mpgReq.setProcCountryCode(processing_country_code);
		mpgReq.setTestMode(true); //false or comment out this line for production transactions
		mpgReq.setStoreId(store_id);
		mpgReq.setApiToken(api_token);
		mpgReq.setTransaction(encpurchase);
		mpgReq.setStatusCheck(status_check);
		mpgReq.send();

		try
		{
			Receipt receipt = mpgReq.getReceipt();

			System.out.println("CardType = " + receipt.getCardType());
			System.out.println("TransAmount = " + receipt.getTransAmount());
			System.out.println("TxnNumber = " + receipt.getTxnNumber());
			System.out.println("ReceiptId = " + receipt.getReceiptId());
			System.out.println("TransType = " + receipt.getTransType());
			System.out.println("ReferenceNum = " + receipt.getReferenceNum());
			System.out.println("ResponseCode = " + receipt.getResponseCode());
			System.out.println("ISO = " + receipt.getISO());
			System.out.println("BankTotals = " + receipt.getBankTotals());
			System.out.println("Message = " + receipt.getMessage());
			System.out.println("AuthCode = " + receipt.getAuthCode());
			System.out.println("Complete = " + receipt.getComplete());
			System.out.println("TransDate = " + receipt.getTransDate());
			System.out.println("TransTime = " + receipt.getTransTime());
			System.out.println("Ticket = " + receipt.getTicket());
			System.out.println("TimedOut = " + receipt.getTimedOut());
			System.out.println("Avs Response = " + receipt.getAvsResultCode());
			System.out.println("Cvd Response = " + receipt.getCvdResultCode());
			System.out.println("CardLevelResult = " + receipt.getCardLevelResult());
			System.out.println("MaskedPan = " + receipt.getMaskedPan());
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}

                

Encrypted Purchase with CVD and AVS - Transaction Values

EncPurchase encpurchase = new EncPurchase();

HttpsPostRequest mpgReq = new HttpsPostRequest();

mpgReq.setTransaction(encpurchase);

Encrypted Purchase with CVD and AVS mandatory values

VALUE TYPE LIMITS SET METHOD DESCRIPTION
Order ID String 50-character alphanumeric encpurchase.setOrderId(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.   Canada: 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.   US: The last 32 characters of the order ID are sent on to the Client Line settlement reports.   For either countries, If the order ID has fewer than 3 characters, it may display a blank or 0000000000 in the Invoice Number field.
Amount String 9-character decimal encpurchase.setAmount(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 $999999.99. Transaction amounts of $0.00 are not allowed.
Encrypted Track 2 data String   encpurchase.setEncTrack2 (enc_track2); String that is retrieved by swiping or keying in a credit card number through a Moneris-provided encrypted mag swipe card reader. It is part of an encrypted keyed or swiped transaction only. This string must be retrieved by a specific device. (See Device Type below for the list of current available devices.)
Device Type String 30 – character alphanumeric encpurchase.setDeviceType (device_type); Type of encrypted mag swipe reader that was used to read the credit card. This must be a Moneris-provided device so that the values are properly encrypted and decrypted. This field is case-sensitive. Available values are: "idtech".
E-Commerce indicator String 1-character alphanumeric encpurchase.setCryptType(crypt); Supported 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
  • 8 - Non-secure transaction (web- or email-based)
  • 9 - SET non-authenticated transaction
 

Encrypted Purchase with CVD and AVS optional values

VALUE TYPE LIMITS SET METHOD DECRIPTION
Status Check Boolean true/false mpgReq.setStatusCheck (status_check); 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 encpurchase.setCustId(cust_id); This can be used for policy number, membership number, student ID, or invoice number. This field is searchable from the Moneris Merchant Resource Centre.
Dynamic descriptor String 20-character alphanumeric encpurchase.setDynamicDescriptor ("my descriptor"); Merchant defined description sent on a per-transaction basis that will appear on the credit card statement appended to the merchant’s business name. 
The combined length of the merchant’s business name and dynamic_descriptor may not exceed 25 characters.
Commercial card invoice String 17-character alphanumeric encpurchase.setCommcardInvoice (commcard_invoice); Available to US integrations only. Level 2 Invoice Number for the transaction used for Corporate Credit Card transactions (Commercial Purchasing Cards). Characters allowed for commcard_invoice: a-z A-Z 0-9 spaces
Commercial card tax amount String 9-character decimal encpurchase.setCommcardTaxAmount (commcard_tax_amount); Available to US integrations only. Level 2 Tax Amount of the transaction used for Corporate Credit Card transactions (Commercial Purchasing Cards). This must contain 3 digits with two penny values. The minimum value passed can be 0.00 and the maximum is 9999999.99
AVS Information Object   AvsInfo avsCheck = new AvsInfo();
encpurchase.setAvsInfo(avsCheck);
Refer below for further breakdown and definition.
CVD Information Object   CvdInfo cvdCheck = new CvdInfo();
encpurchase.setCvdInfo(cvdCheck);
Refer below for further breakdown and definition.
Customer Information Object   CustInfo customer = new CustInfo(); encpurchase.setCustInfo(customer); Refer below for further breakdown and definition.
Recurring Billing Object   Recur recurring_cycle = new Recur(recur_unit, start_now, start_date, num_recurs, period, recur_amount); encpurchase.setRecur(recurring_cycle); Refer below for further breakdown and definition.

CvdInfo object mandatory values

VALUE TYPE LIMITS SET METHOD DESCRIPTION
CVD indicator String 1-character numeric cvdCheck.setCvdIndicator("1"); 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 cvdCheck.setCvdValue("099"); 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 DESCRIPTION
AVS street number String 19-character alphanumeric1 avsCheck.setAvsStreetNumber("212"); Cardholder street number.
AVS street name String See AVS street number avsCheck.setAvsStreetName("Payton Street"); Cardholder street name.
AVS zip/postal code String 9-character alphanumeric avsCheck.setAvsZipCode("M1M1M1"); Cardholder zip/postal code.
 

CVD and AVS Response Fields

VALUE LIMITS GET METHOD DESCRIPTION
CVD result code 2-character alphanumeric receipt.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 receipt.getAvsResultCode(); Indicates the address verification result. For a full list of possible response codes refer to the AVS Result Code table.

Predecessors
  • None
Successors

Encrypted Purchase with Recurring Billing

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

This transaction allows for the ability to key in data into a Moneris-provided encrypted MSR device and pass the encrypted track 2 value to process a card not present transaction.

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.

USA Code Sample

package USA;

import JavaAPI.*;

public class TestUSAEncPurchaseRecur
{
	public static void main(String[] args)
	{
		String store_id = "monusqa002";
		String api_token = "qatoken";
		java.util.Date createDate = new java.util.Date(); 
		String order_id = "Test"+createDate.getTime();
		String amount = "5.00";
		String crypt = "7";
		String commcard_invoice = "INVC090";
		String commcard_tax_amount = "1.00";
		String processing_country_code = "US";
		boolean status_check = false;
		String device_type = "idtech";
		String enc_track2 = "0284008500000000041608B84D1586DEDBA1F0DB3CECD296C41195AFECE7CA8F3A00E6DBA97A4EFDEF05D3935553E9E24B5AEFC7B2330431393035FFFF3141594047A0009A7FB103";
		

		/************************* Recur Variables **********************************/

		String recur_unit = "month";
		String start_now = "true";
		String start_date = "2018/12/01";
		String num_recurs = "12";
		String period = "1";
		String recur_amount = "30.00";

		/************************* Recur Object Option1 ******************************/

		Recur recurring_cycle = new Recur(recur_unit, start_now, start_date,
				num_recurs, period, recur_amount);

		EncPurchase encpurchase = new EncPurchase();
		encpurchase.setOrderId(order_id);
		encpurchase.setAmount(amount);
		encpurchase.setEncTrack2(enc_track2);
		encpurchase.setDeviceType(device_type);
		encpurchase.setCryptType(crypt);
		encpurchase.setCommcardInvoice(commcard_invoice);
		encpurchase.setCommcardTaxAmount(commcard_tax_amount);
		encpurchase.setRecur(recurring_cycle);

		HttpsPostRequest mpgReq = new HttpsPostRequest();
		mpgReq.setProcCountryCode(processing_country_code);
		mpgReq.setTestMode(true); //false or comment out this line for production transactions
		mpgReq.setStoreId(store_id);
		mpgReq.setApiToken(api_token);
		mpgReq.setTransaction(encpurchase);
		mpgReq.setStatusCheck(status_check);
		mpgReq.send();

		try
		{
			Receipt receipt = mpgReq.getReceipt();

			System.out.println("CardType = " + receipt.getCardType());
			System.out.println("TransAmount = " + receipt.getTransAmount());
			System.out.println("TxnNumber = " + receipt.getTxnNumber());
			System.out.println("ReceiptId = " + receipt.getReceiptId());
			System.out.println("TransType = " + receipt.getTransType());
			System.out.println("ReferenceNum = " + receipt.getReferenceNum());
			System.out.println("ResponseCode = " + receipt.getResponseCode());
			System.out.println("ISO = " + receipt.getISO());
			System.out.println("BankTotals = " + receipt.getBankTotals());
			System.out.println("Message = " + receipt.getMessage());
			System.out.println("AuthCode = " + receipt.getAuthCode());
			System.out.println("Complete = " + receipt.getComplete());
			System.out.println("TransDate = " + receipt.getTransDate());
			System.out.println("TransTime = " + receipt.getTransTime());
			System.out.println("Ticket = " + receipt.getTicket());
			System.out.println("TimedOut = " + receipt.getTimedOut());
			System.out.println("Recur Success = " + receipt.getRecurSuccess());
			System.out.println("CardLevelResult = " + receipt.getCardLevelResult());
			System.out.println("MaskedPan = " + receipt.getMaskedPan());
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}

                

Encrypted Purchase with Recurring Billing - Transaction Values

EncPurchase encpurchase = new EncPurchase();

HttpsPostRequest mpgReq = new HttpsPostRequest();

mpgReq.setTransaction(encpurchase);

Encrypted Purchase with Recurring Billing mandatory values

VALUE TYPE LIMITS SET METHOD DESCRIPTION
Order ID String 50-character alphanumeric encpurchase.setOrderId(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.   Canada: 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.   US: The last 32 characters of the order ID are sent on to the Client Line settlement reports.   For either countries, If the order ID has fewer than 3 characters, it may display a blank or 0000000000 in the Invoice Number field.
Amount String 9-character decimal encpurchase.setAmount(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 $999999.99. Transaction amounts of $0.00 are not allowed.
Encrypted Track 2 data String   encpurchase.setEncTrack2 (enc_track2); String that is retrieved by swiping or keying in a credit card number through a Moneris-provided encrypted mag swipe card reader. It is part of an encrypted keyed or swiped transaction only. This string must be retrieved by a specific device. (See Device Type below for the list of current available devices.)
Device Type String 30 – character alphanumeric encpurchase.setDeviceType (device_type); Type of encrypted mag swipe reader that was used to read the credit card. This must be a Moneris-provided device so that the values are properly encrypted and decrypted. This field is case-sensitive. Available values are: "idtech".
E-Commerce indicator String 1-character alphanumeric encpurchase.setCryptType(crypt); Supported 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
  • 8 - Non-secure transaction (web- or email-based)
  • 9 - SET non-authenticated transaction
 

Encrypted Purchase with Recurring Billing optional values

VALUE TYPE LIMITS SET METHOD DECRIPTION
Status Check Boolean true/false mpgReq.setStatusCheck (status_check); 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 encpurchase.setCustId(cust_id); This can be used for policy number, membership number, student ID, or invoice number. This field is searchable from the Moneris Merchant Resource Centre.
Dynamic descriptor String 20-character alphanumeric encpurchase.setDynamicDescriptor ("my descriptor"); Merchant defined description sent on a per-transaction basis that will appear on the credit card statement appended to the merchant’s business name. 
The combined length of the merchant’s business name and dynamic_descriptor may not exceed 25 characters.
Commercial card invoice String 17-character alphanumeric encpurchase.setCommcardInvoice (commcard_invoice); Available to US integrations only. Level 2 Invoice Number for the transaction used for Corporate Credit Card transactions (Commercial Purchasing Cards). Characters allowed for commcard_invoice: a-z A-Z 0-9 spaces
Commercial card tax amount String 9-character decimal encpurchase.setCommcardTaxAmount (commcard_tax_amount); Available to US integrations only. Level 2 Tax Amount of the transaction used for Corporate Credit Card transactions (Commercial Purchasing Cards). This must contain 3 digits with two penny values. The minimum value passed can be 0.00 and the maximum is 9999999.99
AVS Information Object   AvsInfo avsCheck = new AvsInfo();
encpurchase.setAvsInfo(avsCheck);
Refer below for further breakdown and definition.
CVD Information Object   CvdInfo cvdCheck = new CvdInfo();
encpurchase.setCvdInfo(cvdCheck);
Refer below for further breakdown and definition.
Customer Information Object   CustInfo customer = new CustInfo(); encpurchase.setCustInfo(customer); Refer below for further breakdown and definition.
Recurring Billing Object   Recur recurring_cycle = new Recur(recur_unit, start_now, start_date, num_recurs, period, recur_amount); encpurchase.setRecur(recurring_cycle); Refer below for further breakdown and definition.

Recurring object mandatory values

VALUE TYPE LIMITS ARGUMENT NAME IN EXAMPLE 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 If 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 repeatedly based on the interval defined by period and recur_unit.

Recurring Billing Response Fields

VALUE LIMITS GET METHOD DESCRIPTION
Recurring billing success true/false receipt.getRecurSuccess(); Indicates whether the recurring billing transaction has been successfully set up for future billing.

Predecessors
  • None
Successors
  • Purchase Correction ( API | Batch )
  • Refund ( API | Batch )
  • Vault Tokenize Credit Card ( API )
  • Recurring Billing Update ( API )

Encrypted Mag Swipe Purchase

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

This transaction allows for the ability to swipe or key in data into a Moneris-provided encrypted MSR device and pass the encrypted track 2 value to process a card present transaction.

Things to consider:

  • This transaction supports both swiped card present & manually keyed card present
  • For manually keyed card not present transaction using the encrypted MSR device please refer to Encrypted Purchase.

USA Code Sample

package USA;

import JavaAPI.*;

public class TestUSAEncTrack2Purchase
{
	public static void main(String[] args)
	{
		String store_id = "monusqa002";
		String api_token = "qatoken";
		java.util.Date createDate = new java.util.Date(); 
		String order_id = "Test"+createDate.getTime();
		String cust_id = "LBriggs";
		String amount = "1.00";
		String pos_code = "00";
		String device_type = "idtech";
		String processing_country_code = "US";
		boolean status_check = false;
		String dynamic_descriptor = "my descriptor";

		String enc_track2 =
				"02D901801F4F2800039B%*4924********4030^TESTCARD/MONERIS^***************************************"
				+ "**?*;4924********4030=********************?*A7150C78335A5024949516FDA9A68A91C4FBAB1279DD1DE2283D"
				+ "BEBB2C6B3FDEACF7B5B314219D76C00890F347A9640EFE90023E31622F5FD95C14C0362DD2EAB28ADEB46B8B577DA1A1"
				+ "8B707BCC7E48068EFF1882CFB4B369BDC4BB646C870D6083239860B23837EA91DB3F1D8AD066DAAACE2B2DA18D563E4F"
				+ "1EF997696337B8999E9C707DEC4CB0410B887291CAF2EE449573D01613484B80760742A3506C31415939320000A00028"
				+ "3C5E03";
		
		EncTrack2Purchase encpurchase = new EncTrack2Purchase();
		encpurchase.setOrderId(order_id);
		encpurchase.setCustId(cust_id);
		encpurchase.setAmount(amount);
		encpurchase.setEncTrack2(enc_track2);
		encpurchase.setPosCode(pos_code);
		encpurchase.setDeviceType(device_type);
		encpurchase.setDynamicDescriptor(dynamic_descriptor);

		AvsInfo avsCheck = new AvsInfo();
		avsCheck.setAvsStreetNumber("212");
		avsCheck.setAvsStreetName("Payton Street");
		avsCheck.setAvsZipCode("M1M1M1");

		encpurchase.setAvsInfo(avsCheck);

		HttpsPostRequest mpgReq = new HttpsPostRequest();
		mpgReq.setProcCountryCode(processing_country_code);
		mpgReq.setTestMode(true); //false or comment out this line for production transactions
		mpgReq.setStoreId(store_id);
		mpgReq.setApiToken(api_token);
		mpgReq.setTransaction(encpurchase);
		mpgReq.setStatusCheck(status_check);
		mpgReq.send();

		try
		{
			Receipt receipt = mpgReq.getReceipt();

			System.out.println("CardType = " + receipt.getCardType());
			System.out.println("TransAmount = " + receipt.getTransAmount());
			System.out.println("TxnNumber = " + receipt.getTxnNumber());
			System.out.println("ReceiptId = " + receipt.getReceiptId());
			System.out.println("TransType = " + receipt.getTransType());
			System.out.println("ReferenceNum = " + receipt.getReferenceNum());
			System.out.println("ResponseCode = " + receipt.getResponseCode());
			System.out.println("BankTotals = " + receipt.getBankTotals());
			System.out.println("Message = " + receipt.getMessage());
			System.out.println("AuthCode = " + receipt.getAuthCode());
			System.out.println("Complete = " + receipt.getComplete());
			System.out.println("TransDate = " + receipt.getTransDate());
			System.out.println("TransTime = " + receipt.getTransTime());
			System.out.println("Ticket = " + receipt.getTicket());
			System.out.println("TimedOut = " + receipt.getTimedOut());
			System.out.println("MaskedPan = " + receipt.getMaskedPan());
			System.out.println("CardLevelResult = " + receipt.getCardLevelResult());
			System.out.println("AVS Response = " + receipt.getAvsResultCode());
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}

                

Encrypted Mag Swipe Purchase - Transaction Values

EncTrack2Purchase encpurchase = new EncTrack2Purchase();

HttpsPostRequest mpgReq = new HttpsPostRequest();

mpgReq.setTransaction(encpurchase);

Encrypted Mag Swipe Purchase object mandatory values

VALUE TYPE LIMITS SET METHOD DESCRIPTION
Order ID String 50-character alphanumeric encpurchase.setOrderId(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.   Canada: 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.   US: The last 32 characters of the order ID are sent on to the Client Line settlement reports.   For either countries, If the order ID has fewer than 3 characters, it may display a blank or 0000000000 in the Invoice Number field.
Amount String 9-character decimal encpurchase.setAmount(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 $999999.99. Transaction amounts of $0.00 are not allowed.
Encrypted Track 2 data String   encpurchase.setEncTrack2 (enc_track2); String that is retrieved by swiping or keying in a credit card number through a Moneris-provided encrypted mag swipe card reader. It is part of an encrypted keyed or swiped transaction only. This string must be retrieved by a specific device. (See Device Type below for the list of current available devices.)
Device Type String 30 – character alphanumeric encpurchase.setDeviceType (device_type); Type of encrypted mag swipe reader that was used to read the credit card. This must be a Moneris-provided device so that the values are properly encrypted and decrypted. This field is case-sensitive. Available values are: ·         "idtech" – applicable to US ·         "idtech_bdk" – applicable to Canada
POS Code String 2-character numeric encpurchase.setPosCode(pos_code); Supported values are:
  • 00 - normal presentment situations
  • 71 - If a Pre-Authorization transaction was card-present and keyed-in, then the POS code for the corresponding Completion transaction is 71.
  • 27 - In an unmanned kiosk environment where the card is present
If the solution is not “merchant and cardholder present”, contact Moneris for the proper POS code.

Encrypted Mag Swipe Purchase optional values

VALUE TYPE LIMITS SET METHOD DECRIPTION
Status Check Boolean true/false mpgReq.setStatusCheck (status_check); 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 encpurchase.setCustId(cust_id); This can be used for policy number, membership number, student ID, or invoice number. This field is searchable from the Moneris Merchant Resource Centre.
Dynamic descriptor String 20-character alphanumeric encpurchase.setDynamicDescriptor ("my descriptor"); Merchant defined description sent on a per-transaction basis that will appear on the credit card statement appended to the merchant’s business name. 
The combined length of the merchant’s business name and dynamic_descriptor may not exceed 25 characters.

Predecessors
  • None
Successors
  • Mag Swipe Purchase Correction ( API )
  • Mag Swipe Refund ( API )
  • Vault Tokenize Credit Card ( API )