Skip to main content

MTS file format specification

This page describes the Westpac MTS file format that PayWay Batch accepts. It details the payment file format (containing card details and amounts to charge) and the rejects file format (which lists the declined transactions).

File format

All files are plain text using the US-ASCII character encoding. Records are separated by the CR LF end-of-line marker.

Data types are listed as:

  • N - numeric 0-9 only
  • A - letters from the English alphabet
  • AN - letters or numbers (alphanumeric)
  • S - spaces only

Unless otherwise noted, N numeric fields are right-justified and padded with leading zeroes and AN alphanumeric fields are left-justified and padded with trailing spaces. Amounts are always expressed in cents, e.g. $125.94 is expressed as 00012594 (assuming the field has length of 8).

MTS payment file

The payment file has the following general structure:

  • File header (one only per file)
  • Batch header (per merchant)
  • Sale/Refund transaction (one or more in each batch)
  • Batch trailer (one only per merchant batch header)
  • File trailer (one only per file)

Payment file header

The file header must be the first record in the file.

No Field Name Position Length Data Type Description
1 Transaction Type 1 1 N Must be 1 to indicate file header.
2 Record Sequence 2-7 6 N Not used - set to any numeric value, e.g. 000000.
3 Facility Link ID (previously known as CDTF ID) 8-11 4 N Not used - set to any numeric value, e.g. 0000.
4 Originating PC ID 12-14 3 AN Transmitting PC ID (default is P01).
5 Desired Settlement Date 15-22 8 N Date of desired settlement in YYYYMMDD format. This date can be 10 days in the past or the future.
6 Creation Sequence 23-24 2 N File Sequence begins at 01 and increments by 1 for each file created on Creation Date.
7 Posting Status 25 1 A O = Original Status
8 Filler 26-80 55 S Spaces

Payment file batch header

This record is used to group together data for a particular merchant facility.

No Field Name Position Length Data Type Description
1 Transaction Type 1 1 N Must be 2 to indicate batch header.
2 Record Sequence 2-7 6 N Not used - set to any numeric value, e.g. 000000.
3 Merchant ID 8-15 8 N 8-digit merchant ID number allocated by Westpac. Use TEST for a test-only facility.
4 Batch Date 16-23 8 N Must be the same as the date in the file header.
5 Batch Sequence Number 24-25 2 N Batch sequence starting 01 and increasing by 1 for each batch in the file.
6 Posting Status 26 1 A O = Original Status
7 Filler 27-80 54 S Spaces

Payment file Sale / Refund transaction

Each batch contains one or more sale or refund transactions.

No Field Name Position Length Data Type Description
1 Transaction Type 1 1 N 3 for sale, 4 for refund.
2 Record Sequence 2-7 6 N Not used - set to any numeric value, e.g. 000000.
3 Merchant ID 8-15 8 AN Must be the same as the merchant ID in the batch header.
4 Card Number 16-34 19 N Card number left justified with trailing spaces. Do not include dashes or spaces between the card number digits.
5 Filler 35-42 8 S Spaces
6 Transaction Amount 43-50 8 N Transaction amount in cents, right justified with zero padding. For example, $125.94 is expressed as 00012594. If you have enabled surcharges in the PayWay website, PayWay will add a surcharge to this amount. Using the above example, if you have a 1% surcharge, PayWay will add $1.26 to the transaction amount.
7 Transaction Source 51 1 A M - Mail order, T - Telephone order, E - eCommerce transaction, R - Recurring transaction
8 Filler 52 1 S Space
9 Authorisation Code 53-58 6 AN If capturing a previous pre-auth transaction, this is the 6 character authorisation code from that pre-auth transaction. Otherwise, leave blank.
10 Merchant Reference Number 59-64 6 AN Your first reference number for this transaction. Populate this field with your system's identifier for this transaction to allow tracing.
11 Card Expiry Date 65-70 6 N The card expiry date in MMYYYY format.
12 Merchant Secondary Reference Number 71-78 8 AN Your second reference number for this transaction. Leave blank if not required.
13 Filler 79-80 2 S Spaces

Note:

  • The Merchant Reference Number and Merchant Secondary Reference Number are shown as concatenated in the PayWay website. For example, if the Merchant Reference Number field is abcde1 and the Merchant Secondary Reference Number is 2fghijkl, the Customer Reference Number field on the screen will show abcde12fghijkl.
  • The Sale Type of 'R' for Recurring transaction (ie MasterCard or Visa Recurring) should be set if a transaction is a recurring transaction for which you hold a valid direct debit agreement from the cardholder. In addition, for Visa Recurring, the first transaction has to be authorised with a valid card expiry date. If the transaction is a one-off transaction, you must set the Sale Type to one of the other given values (i.e. M, T or E). Under no circumstances may you flag a one-off transaction as Recurring.
  • Refunds are a potential avenue for fraud. Check your merchant agreement for information about performing refunds.

Payment file batch trailer

Each batch must have a trailer record following the last transaction in the batch.

No Field Name Position Length Data Type Description
1 Transaction Type 1 1 N Must be 5 to indicate batch trailer.
2 Record Sequence 2-7 6 N Not used - set to any numeric value, e.g. 000000.
3 Merchant ID 8-15 8 AN Must be the same as the merchant ID in the batch header.
4 Batch Transaction Count 16-21 6 N Number of transactions in the batch.
5 Batch Transaction Total Amount 22-31 10 N Sum of batch sales transaction amounts minus sum of batch refund transaction amounts.
6 Batch Amount Sign Indicator 32 1 A C for credit if the above total is positive. D for debit if the above total is negative.
7 Sales Count 33-37 5 N Number of sale transactions in this batch.
8 Sales Total Amount 38-47 10 N Total amount for all sale transactions in this batch.
9 Refunds Count 48-52 5 N Number of refund transactions in this batch.
10 Refunds Total Amount 53-62 10 N Total amount for all refund transactions in this batch.
11 Filler 63-80 18 S Spaces

Payment file trailer

The file trailer record must be the last record in the file.

No Field Name Position Length Data Type Description
1 Transaction Type 1 1 N Must be 6 to indicate file trailer.
2 Record Sequence 2-7 6 N Not used - set to any numeric value, e.g. 000000.
3 Facility Link ID (previously known as CDTF ID) 8-11 4 N Same as file header.
4 Batch Count 12-15 4 N Number of batches present in the file.
5 Transaction Count 16-22 7 N Total number of transactions in the file.
6 Transaction Total Amount 23-33 11 N Sum of all sales transaction amounts minus sum of all refund transaction amounts.
7 File Amount Sign Indicator 34 1 A C - for credit if the above total is positive. D - for debit if the above total is negative.
8 Sales Count 35-40 6 N Number of sale transactions in this file.
9 Sales Total Amount 41-51 11 N Total amount for all sale transactions in this file.
10 Refunds Count 52-57 6 N Number of refund transactions in this file.
11 Refunds Total Amount 58-68 11 N Total amount for all refund transactions in this file.
12 Filler 69-80 12 S Spaces

MTS rejects file

The rejects file contains the list of all transactions that were declined during processing. The file has the following general structure:

  • File header (one only per file)
  • Batch header (per merchant)
  • Sale/ Refund transaction (one or more in each batch)

Rejects file header

The file header will be the first record in the file.

No Field Name Position Length Data Type Description
1 Transaction Type 1 1 N 1 to indicate file header.
2 Error Code 2-4 3 AN Always 000
3 Facility Link ID (previously known as CDTF ID) 5-8 4 N Same as the value specified in the payment file.
4 File Date 9-14 6 N File date from the payment file in YYMMDD format.
5 Deposit Sequence 15-16 2 N File sequence number (matches sequence in the payment file).
6 Posting Status 17 1 A O - Original
7 Processing Date 18-23 6 N File date from the payment file in YYMMDD format.
8 Filler 24-110 87 S Spaces

Rejects batch header

One batch header record will be present for each batch header in the payment file.

No Field Name Position Length Data Type Description
1 Transaction Type 1 1 N 2 to indicate batch header.
2 Error Code 2-4 3 AN Always 000
3 Merchant ID 5-12 8 AN Same as the value specified in the payment file.
4 Merchant Name 13-37 25 AN Merchant's trading name.
5 Merchant Location 38-57 20 AN Merchant's trading location.
6 Merchant State 58-60 3 A Merchant's trading location state.
7 Batch Date 61-66 6 N Batch date from the payment file in YYMMDD format.
8 Batch Sequence 67-68 2 N Batch sequence from the payment file.
9 Posting Status 69 1 N O - Original
10 Filler 70-110 41 S Spaces

Rejects transaction

Each record represents a transaction that was declined during processing.

No Field Name Position Length Data Type Description
1 Transaction Type 1 1 N 3 - Sales, 4 - Refund
2 Error Code 2-4 3 AN 0XX where XX is the 2-character response code from the transaction processing. See online help in the PayWay website for more information. The description of each code is provided in field 11.
3 Merchant ID 5-12 8 AN Same as the value specified in the payment file.
4 Masked Card Number 13-31 19 AN Left justified with trailing spaces. The first 6 and last 3 digits will be present in the form: xxxxxx...xxx
5 Transaction Amount 32-42 11 N Same as the value specified in the payment file. If you have enabled surcharges in the PayWay website, this will be the amount before the surcharge was applied.
6 Transaction Date 43-48 6 N Transaction settlement date in YYMMDD format.
7 Filler 49-64 16 N Zeroes - reserved for future use.
8 Merchant Reference Number 65-70 6 AN Same as the value specified in the payment file.
9 Filler 71 1 N Zero - reserved for future use.
10 Filler 72-77 6 AN ****** - reserved for future use.
11 Error Message 78-102 25 AN Description of why the transaction was declined.
12 Merchant Secondary Reference Number 103-110 8 AN Same as the value specified in the payment file.
Disclaimer

The information contained in this publication is provided for learning purposes only and is subject to change. Revisions may be issued from time to time that encompass changes or additions to this module.

This is a guide only and it is not comprehensive. It does not impinge on or overrule any formal arrangement you may enter into with the Bank. The Bank and its officers shall not have any liability for any losses of any kind incurred in connection with any action, inaction or decision taken in reliance on the information herein or for any inaccuracies, errors or omissions. In this publication references to the "Bank" are to Westpac Banking Corporation ABN 33 007 457 141 and to any of its operating Divisions, including BankSA and St.George.