My Profile_


Batch Close

Takes the funds from all Purchase, Completion and Refund transactions so that they will be deposited or debited the following business day.

For funds to be deposited the following business day, the batch must close before 11pm Eastern Time.

Canada Code Sample

package Canada;

import JavaAPI.*;

public class TestCanadaBatchClose
{
	public static void main(String[] args)
	{
		String store_id = "store5";
		String api_token = "yesguy";
		String ecr_no = "66013455";	//ecr within store
		String processing_country_code = "CA";
		boolean status_check = false;

		BatchClose batchclose = new BatchClose();
		batchclose.setEcrno(ecr_no);

		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(batchclose);
		mpgReq.setStatusCheck(status_check);
		mpgReq.send();

		try
		{			
			Receipt receipt = mpgReq.getReceipt();

			if ((receipt.getReceiptId()).equals("Global Error Receipt") || 
					receipt.getReceiptId().equals("null") || 
					receipt.getReceiptId().equals(""))
			{

				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 = null");
				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());
			}
			else
			{
				for (String ecr : receipt.getTerminalIDs())
				{
					System.out.println("ECR: " + ecr);
					for(String cardType : receipt.getCreditCards(ecr))
					{						
						System.out.println("\tCard Type: " + cardType);

						System.out.println("\t\tPurchase: Count = "
								+ receipt.getPurchaseCount(ecr, cardType)
								+ " Amount = "
								+ receipt.getPurchaseAmount(ecr,
										cardType));

						System.out.println("\t\tRefund: Count = "
								+ receipt.getRefundCount(ecr, cardType)
								+ " Amount = "
								+ receipt.getRefundAmount(ecr, cardType));

						System.out.println("\t\tCorrection: Count = "
								+ receipt.getCorrectionCount(ecr, cardType)
								+ " Amount = "
								+ receipt.getCorrectionAmount(ecr,
										cardType));
					}
				}
			}
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}
                
USA Code Sample

package USA;

import JavaAPI.*;

public class TestUSABatchClose
{
	public static void main(String[] args)
	{
		String store_id = "monusqa002";
		String api_token = "qatoken";
		String ecr_no = "64000003";//ecr within store  "64000001"
		String processing_country_code = "US";
		boolean status_check = false;

		BatchClose batchclose = new BatchClose();
		batchclose.setEcrno(ecr_no);

		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(batchclose);
		mpgReq.setStatusCheck(status_check);
		mpgReq.send();

		try
		{
			Receipt receipt = mpgReq.getReceipt();

			if ((receipt.getReceiptId()).equals("Global Error Receipt"))
			{

				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 = null");
				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());
			}
			else
			{
				for (String ecr : receipt.getTerminalIDs())
				{
					System.out.println("ECR: " + ecr);
					for (String cardType : receipt.getCreditCards(ecr))
					{
						System.out.println("\tCard Type: " + cardType);

						System.out.println("\t\tPurchase: Count = "
								+ receipt.getPurchaseCount(ecr, cardType)
								+ " Amount = "
								+ receipt.getPurchaseAmount(ecr,
									cardType));

						System.out.println("\t\tRefund: Count = "
								+ receipt.getRefundCount(ecr, cardType)
								+ " Amount = "
								+ receipt.getRefundAmount(ecr, cardType));

						System.out.println("\t\tCorrection: Count = "
								+ receipt.getCorrectionCount(ecr, cardType)
								+ " Amount = "
								+ receipt.getCorrectionAmount(ecr,
									cardType));

					}
				}
			}
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}
                

BatchClose transaction object definition

BatchClose batchclose = new BatchClose();

HttpsPostRequest object for Batch Close transaction

HttpsPostRequest mpgReq = new HttpsPostRequest();

mpgReq.setTransaction(batchclose);

BatchClose transaction object mandatory values

Value Type Limits Set method Description
ECR (electronic cash register) number String No limit (value provided byMoneris) batchclose.setEcrno(ecr_no); Electronic cash register number.

BatchClose transaction object optional values

Value Type Limits Set method Description
Status Check Boolean true/false mpgReq.setStatusCheck(status_check);

Batch Close Response Fields

Value Limits Variable Description
Processed Card Type String Array receipt.getCreditCards(ecr_no); Returns all of the processed card types in the current batch for the terminal ID/ECR Number from the request.
Terminals IDs 8 – character alphanumeric receipt.getTerminalIDs(); Returns the terminal ID/ECR Number from the request.
Purchase Count 4 – character numeric receipt.getPurchaseCount(ecr,cardType); Indicates the # of Purchase, ACH debit, Pre-Authorization Completion and Force Post transactions processed. If none were processed in the batch, then 0000 will be returned.
Purchase Amount 11 – character alphanumeric receipt.getPurchaseAmount(ecr,cardType); Indicates the dollar amount processed for Purchase, ACH debit, Pre-Authorization Completion or Force Post transactions. This field begins with a + and is followed by 10 numbers, the first 8 indicate the amount and the last 2 indicate the penny value.
Example, +0000000000 = 0.00 and +0000041625 = 416.25
Refund Count 4 – character numeric receipt.getRefundCount(ecr,cardType); Indicates the # of Refund, Independent Refund or ACH Credit transactions processed. If none were processed in the batch, then 0000 will be returned.
Refund Amount 11 – character alphanumeric receipt.getRefundAmount(ecr,cardType); Indicates the dollar amount processed for Refund, Independent Refund or ACH Credit transactions. This field begins with a + and is followed by 10 numbers, the first 8 indicate the amount and the last 2 indicate the penny value.
Example, +0000000000 = 0.00 and +0000041625 = 416.25
Correction Count 4 – character numeric receipt.getCorrectionCount(ecr,cardType); Indicates the # of Purchase Correction or ACH Reversal transactions processed. If none were processed in the batch, then 0000 will be returned.
Correction Amount 11 – character alphanumeric receipt.getCorrectionAmount(ecr,cardType); Indicates the dollar amount processed for Purchase Correction or ACH Reversal transactions. This field begins with a + and is followed by 10 numbers, the first 8 indicate the amount and the last 2 indicate the penny value.
Example, +0000000000 = 0.00 and +0000041625 = 416.25

Predecessors
  • NA
Successors
  • NA