My Profile_


Mag Swipe Purchase Correction

Restores the full amount of a previous Purchase, Force Post or Pre-Authorization Completion transaction to the cardholder's card, and removes any record of it from the cardholder's statement. This transaction only applies if the original transaction was processed as a mag swipe or encrypted mag swipe transaction.

This transaction is sometimes referred to as "void" or "correction". 

This transaction can be used against a Purchase, Force Post or Completion transaction that occurred same day provided that the batch containing the original transaction remains open. When using the automated closing feature, Batch Close occurs daily between 10 and 11pm Eastern Time. 

 If the batch has already closed, please refer to Mag Swipe Refund.

Canada Code Sample

package Canada;

import JavaAPI.*;

public class TestCanadaTrack2PurchaseCorrection
{
	public static void main(String[] args)
	{
		String store_id = "store1";
		String api_token = "yesguy";
		String order_id = "Test1432090631783";
		String txn_number = "16522-0_10";
		String dynamic_descriptor = "123456";
		String cust_id = "my customer id";
		String processing_country_code = "CA";
		boolean status_check = false;

		Track2PurchaseCorrection track2void = new Track2PurchaseCorrection();
		track2void.setOrderId(order_id);
		track2void.setCustId(cust_id);
		track2void.setTxnNumber(txn_number);
		track2void.setDynamicDescriptor(dynamic_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(track2void);
		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("StatusCode = " + receipt.getStatusCode());
			//System.out.println("StatusMessage = " + receipt.getStatusMessage());
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}

                
USA Code Sample

package USA;

import JavaAPI.*;

public class TestUSATrack2PurchaseCorrection
{
	public static void main(String[] args)
	{
		String store_id = "monusqa002";
		String api_token = "qatoken";
		String order_id = "Test1432092066726";
		String txn_number = "837881-0_25";
		String dynamic_descriptor = "123456";
		String cust_id = "my customer id";
		String processing_country_code = "US";
		boolean status_check = false;

		Track2PurchaseCorrection track2void = new Track2PurchaseCorrection();
		track2void.setOrderId(order_id);
		track2void.setTxnNumber(txn_number);
		track2void.setCustId(cust_id);
		track2void.setDynamicDescriptor(dynamic_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(track2void);
		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("StatusCode = " + receipt.getStatusCode());
			//System.out.println("StatusMessage = " + receipt.getStatusMessage());
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}

                

Mag Swipe Purchase Correction - Transaction Values

Track2PurchaseCorrection track2purchasecorrection = new Track2PurchaseCorrection();

HttpsPostRequest mpgReq = new HttpsPostRequest();

mpgReq.setTransaction(track2purchasecorrection);

Mag Swipe Purchase Correction object mandatory values

Value Type Limits Set Method Description
Order ID String 50-character alphanumeric track2purchasecorrection.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.
Transaction Number String 255-character alphanumeric track2purchasecorrection.setTxnNumber(txn_number); Used when performing follow-on transactions. (That is, Completion, Purchase Correction or Refund.) This must be the value that was returned as the transaction number in the response of the original transaction.

When performing a Completion, this value must reference the Pre-Authorization. When performing a Refund or a Purchase Correction, this value must reference the Completion or the Purchase.

Mag Swipe Purchase Correction optional values

Value Type Limits Set Method Description
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 track2purchasecorrection.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 track2purchasecorrection.setDynamicDescriptor("2134565"); 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
  • Mag Swipe Purchase ( API )
  • Encrypted Mag Swipe Purchase ( API )
  • Mag Swipe Force Post ( API )
  • Encrypted Mag Swipe Force Post ( API )
  • Mag Swipe Completion ( API )
Successors
  • Tokenize ( API )