My Profile_


Purchase Correction

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

Restores the full amount of a previous Purchase, Force Post or Completion transaction to the cardholder's card, and removes any record of it from the cardholder's statement.

This transaction is sometimes referred to as "void".

This transaction can be used against a Purchase 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.

Canada Code Sample

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

$store_id='store5';
$api_token='yesguy';
$orderid='ord-110515-10:53:03';
$txnnumber='31387-0_10';
$dynamic_descriptor='1234';

## step 1) create transaction hash ###
$txnArray=array('type'=>'purchasecorrection',
         'txn_number'=>$txnnumber,
         'order_id'=>$orderid,
         'crypt_type'=>'7',
         'cust_id'=>'customer ID',
         'dynamic_descriptor'=>$dynamic_descriptor
        );



## step 2) create a transaction  object passing the array created in
## step 1.

$mpgTxn = new mpgTransaction($txnArray);

## step 3) create a mpgRequest object passing the transaction object created
## in step 2
$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

## step 4) create mpgHttpsPost object which does an https post ##
$mpgHttpPost  =new mpgHttpsPost($store_id,$api_token,$mpgRequest);

## step 5) get an mpgResponse object ##
$mpgResponse=$mpgHttpPost->getMpgResponse();

## step 6) retrieve data using get methods

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());


?>


                

Transaction Values

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

$mpgTxn = new mpgTransaction($txnArray);

$mpgRequest = new mpgRequest($mpgTxn);

Purchase Correction transaction object mandatory values

Value Type Limits Set method Description
Order ID String 50-character alphanumeric 'order_id' Order ID of the previously registered recurring billing transaction.
Transaction number String 255-character alphanumeric '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.
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 Correction transaction object 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.
Customer ID String 50-character alphanumeric 'cust_id' This can be used for policy number, membership number, student ID, invoice number and so on.

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