Cardlink file format specification
This page describes the Cardlink batch file format that PayWay Batch accepts. It details the payment file format (containing card details and amounts to charge), and the report file format.
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 onlyA
- letters from the English alphabetAN
- 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).
Cardlink payment file
The payment file has the following general structure:
- File header (one only per file)
- Sale/ Refund transaction (one or more in each file)
- 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 H to indicate file header. |
2 | Filler | 2 | 1 | S |
Space |
3 | Desired Settlement Date | 3-10 | 8 | N |
Date of desired settlement in YYYYMMDD format. This date can be 10 days in the past or the future. |
4 | Merchant ID | 11-18 | 8 | AN |
8-digit merchant ID number allocated by Westpac. Use "TEST " for a test-only facility. |
5 | Filler | 19 | 1 | S |
Space |
6 | Merchant Name | 20-41 | 22 | AN |
Your company's trading name. |
7 | Value Flag | 42 | 1 | A |
Y - Normal sale transactions. Space - Preauth Mode - All sale transactions are converted to preauths. C - Clear Only Mode - All sale transactions are processed without further authorisation. Each transaction must have an Authorisation Code. |
8 | Filler | 43-69 | 27 | S |
Spaces |
Payment file Sale / Refund transaction
Each file contains one or more sale or refund transactions.
No | Field Name | Position | Length | Data Type | Description |
---|---|---|---|---|---|
1 | Card Number | 1-16 | 16 | N |
Card number left justified with trailing spaces. Do not include dashes or spaces between the card number digits. |
2 | Filler | 17 | 1 | S | Space |
3 | Card Expiry Date | 18-21 | 4 | N |
The card expiry date in MMYY format. |
4 | Filler | 22 | 1 | S |
Space |
5 | Transaction Amount | 23-31 | 9 | N |
Transaction amount in cents, right justified with zero padding. For example, $125.94 is expressed as 000012594 . 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. |
6 | Amount Sign | 32 | 1 | A |
Space - Sale, Minus - - Refund |
7 | Transaction Source | 33 | 1 | A |
M - Mail order, T - Telephone order, E - eCommerce transaction, R - Recurring transaction. |
8 | Filler | 34 | 1 | S |
Space |
9 | Authorisation Code | 35-40 | 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 | Filler | 41-49 | 9 | S |
Spaces |
11 | Merchant Reference Number | 50-69 | 20 | AN |
Your reference number for this transaction. Populate this field with your systems identifier for this transaction to allow tracing. |
12 | Filler | 70-74 | 5 | 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 T to indicate file trailer. |
2 | Filler | 2 | 1 | S |
Space |
3 | Transaction Count | 3-8 | 6 | N |
Total number of transactions in the file. |
4 | Filler | 9-55 | 47 | S |
Spaces |
Result file
The result file is a ZIP that contains two files:
- DECLINE.DAT: Contains all the declined transactions from the original payment file
- ALL.DAT: Contains all transactions from the payment file with the sequence preserved, and the transaction results inserted
Both of the files have the same structure as the payment file. Each file has the following general structure:
- File header (one only per file)
- Sale/ Refund transaction (one or more in each batch)
- File trailer (one only per file)
Result 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 |
Always H to indicate file header. |
2 | Filler | 2 | 1 | S |
Space |
3 | Facility Link ID (previously known as CDTF ID) | 3-10 | 8 | N |
Date from the payment file header. |
4 | Merchant ID | 11-18 | 8 | AN |
Merchant ID from the payment file header. |
5 | Filler | 19 | 1 | S |
Space |
6 | Merchant Name | 20-41 | 22 | AN |
Your companys trading name. |
7 | Value Flag | 42 | 1 | A |
Y - Normal sale transactions. Space - Preauth Mode - All sale transactions are converted to preauths. C - Clear Only Mode - All sale transactions are processed without further authorisation. Each transaction must have an Authorisation Code. |
8 | Filler | 43-69 | 27 | S |
Spaces |
Result file Sale / Refund transaction
Each file contains one or more sale or refund transactions.
No | Field Name | Position | Length | Data Type | Description |
---|---|---|---|---|---|
1 | Masked Card Number | 1-16 | 16 | N |
Left justified with trailing spaces. The first 6 and last 3 digits will be present in the form: xxxxxx...xxx |
2 | Filler | 17 | 1 | S |
Space |
3 | Card Expiry Date | 18-21 | 4 | N |
The card expiry date in MMYY format. |
4 | Filler | 22 | 1 | S |
Space |
5 | Transaction Amount | 23-31 | 9 | N |
Transaction amount in cents, right justified with zero padding. For example, $125.94 is expressed as 000012594 . If you have enabled surcharges in the PayWay website, this will be the amount before the surcharge was applied. |
6 | Amount Sign | 32 | 1 | A |
Space - Sale, Minus - - Refund |
7 | Transaction Source | 33 | 1 | A |
M - Mail order, T - Telephone order, E - eCommerce transaction, R - Recurring transaction |
8 | Filler | 34 | 1 | S |
Space |
9 | Authorisation Code or Decline Reason | 35-49 | 15 | AN |
If the transaction was approved, the 6-character authorisation code will appear here, left justified with trailing spaces. Otherwise, the decline reason will appear, e.g. INV CARD NUMBER , EXPIRED CARD , DECLINED |
10 | Merchant Reference Number | 50-69 | 20 | AN |
Your reference number from the payment file. |
11 | Filler | 70-74 | 5 | S |
Spaces |
Result 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 |
Always T to indicate file trailer. |
2 | Filler | 2 | 1 | S |
Space |
3 | Transaction Count | 3-8 | 6 | N |
Total number of transactions in the file. |
4 | Filler | 9 | 1 | S |
Space |
5 | Value Submitted | 10-20 | 11 | N |
Total value of the payment file in cents. |
6 | Filler | 21 | 1 | S |
Space |
7 | Legend | 22-43 | 22 | A |
Always TOTAL VALUE CREATED IS |
8 | Value Created | 44-54 | 11 | N |
Total value of approved transactions from the payment file in cents. |