Build a CPA-005 EFT Payment File
Skill: Convert a payment batch into a CPA Standard 005 EFT file
Region: Canada Category: Payments — Automated Funds Transfer (AFT) / EFT Does: Takes a batch of payment instructions (payroll deposits, supplier payments, pre-authorized debits) and produces the CPA Standard 005 Electronic Funds Transfer (EFT/AFT) file — the fixed-width record file made up of an A (header), one or more C (credit) and/or D (debit) detail records, and a Z (trailer), that an originator uploads to its financial institution for clearing through Payments Canada's Automated Clearing Settlement System (ACSS). Standard: Payments Canada (CPA) Standard 005 — Standards for the Exchange of Financial Data on AFT Files
This is a fixed-width flat file, not XML or JSON: every field sits at an exact column position inside a 1464-character logical record and is space- or zero-padded. Most financial institutions layer their own profile on top of CPA-005 (file naming, originator/data-centre numbers, record-length and segment-count limits, allowed transaction codes, test vs. production flags). Always validate against your FI's AFT/EFT specification before transmitting — column rules below follow the base CPA-005 standard but FI variations are common.
When this applies
- You are an originator (employer, biller, payer) that has signed an AFT agreement with a Canadian financial institution and been assigned an originator (client) number and one or more logical record / data-centre identifiers.
- You need to move money to (credit) or from (debit) Canadian bank accounts in CAD (or USD via the equivalent USD stream): direct-deposit payroll, vendor payables, government remittances, pre-authorized debits.
- The file clears through the ACSS; settlement happens on the due date you encode, subject to your FI's cut-off times and the file-creation lead time.
- Not for: wire transfers (use the FI's wire/SWIFT channel), Interac e-Transfer, or real-time rail payments. Those are separate systems.
Conversion procedure
- Read the source. Accept a CSV/JSON/spreadsheet payment register, or pasted key-value text. Each row is one payment: payee name, institution number, transit (branch) number, account number, amount, due/payment date, and credit-vs-debit direction. Header-level inputs (originator number, originator short name, file creation number, return institution/transit/account, currency) are supplied once.
- Extract fields. Pull every value in the field map below. If the originator number, an institution/transit/account, an amount, or the due date is missing or ambiguous, stop and ask — never invent a transit or account number.
- Normalize identifiers. Strip hyphens/spaces from institution, transit, and account numbers. Institution number = 3 digits; transit (branch) = 5 digits; together they form the 9-digit routing point. Right-justify the account number and zero-fill to 12 positions. Upper-case and pad/truncate names to their fixed widths.
- Convert amounts to cents. Amounts are whole cents with no decimal point:
$1,234.56→0000000123456(10 digits, zero-filled). Never write a dollar sign, comma, or period. - Encode the due date in Julian. The due (payment) date is
0YYDDD— a leading0, the last two digits of the year, and the 3-digit day-of-year (001–366). Same format for the file creation date in the header. - Assemble the records. One A header, then C/D detail records (each detail record holds up to 6 transaction segments), then one Z trailer. Number every logical record sequentially. Reference the document structure and worked example as the template.
- Compute the trailer. Sum the credit count/value and debit count/value across all detail segments and write them into the Z record. Reference the calculation rules.
- Validate. Work through the validation checklist; confirm record length and against your FI's AFT spec before upload.
Source → CPA-005 field map
A — File Header record (one per file)
| From the source | → A-record field (position) |
|---|---|
Logical record type = A |
Record Type, pos 1 |
Sequence number 0000000001 |
Logical Record Count, pos 2–10 |
| Originator (client) number | Originator's Account / Client Number, pos 11–20 |
| File creation number (sequential per file) | File Creation Number, pos 21–24 |
File creation date → 0YYDDD |
Creation Date (Julian), pos 25–30 |
| FI data-centre / destination number | Destination Data Centre, pos 31–35 |
| (reserved / FI-defined) | Reserved, pos 36–1464 |
C — Credit detail record / D — Debit detail record (repeatable; up to 6 segments each)
| From the source | → Detail-segment field |
|---|---|
Record type C (credit) or D (debit) |
Record Type, pos 1 |
| Sequence number | Logical Record Count, pos 2–10 |
| Originator (client) number | Originator's Client Number, pos 11–20 |
| File creation number | File Creation Number, pos 21–24 |
| Transaction (CPA) code | Transaction Type Code (first field of each segment) |
| Amount in cents (10 digits) | Amount |
Due/payment date → 0YYDDD |
Due Date (Julian) |
| Institution number (3) + transit (5) | Payee/Payor Institution + Transit |
| Bank account number (≤12, right-justified) | Account Number |
| Originator short name | Originator's Short Name |
| Payee/payor name | Payee/Payor Name |
| Originator (long) name | Originator's Long Name |
| Originator-assigned reference / cross-ref | Originator's Reference Number / Cross-Reference No. |
| Return institution + transit + account | Institution/Transit/Account for Returns |
Z — File Trailer record (one per file)
| From the source | → Z-record field (position) |
|---|---|
Record type Z |
Record Type, pos 1 |
| Sequence number | Logical Record Count, pos 2–10 |
| Originator (client) number | Originator's Client Number, pos 11–20 |
| File creation number | File Creation Number, pos 21–24 |
| Σ debit amounts (cents, 14 digits) | Total Value of Debit Transactions |
| Count of debit transactions (8 digits) | Total Number of Debit Transactions |
| Σ credit amounts (cents, 14 digits) | Total Value of Credit Transactions |
| Count of credit transactions (8 digits) | Total Number of Credit Transactions |
Document structure
CPA-005 AFT FILE (each logical record = 1464 characters)
├── A File Header record (exactly one, first)
│ record type · seq · originator no. · file creation no. · creation date (Julian) · destination DC
├── C Credit detail record(s) (zero or more — money OUT to payees, e.g. payroll/vendor)
│ │ header fields (type · seq · originator no. · file creation no.)
│ └── 1–6 transaction segments, each:
│ txn code · amount (cents) · due date (Julian) · institution · transit · account
│ · originator short name · payee name · originator long name · reference · return inst/transit/acct
├── D Debit detail record(s) (zero or more — money IN, e.g. pre-authorized debits)
│ └── same segment layout as C (1–6 segments per record)
└── Z File Trailer record (exactly one, last)
record type · seq · originator no. · file creation no. · total debit value/count · total credit value/count
- A file may contain only C, only D, or a mix; the Z trailer always reports both credit and debit totals (zero where absent).
- Each C/D logical record packs up to 6 transaction segments; start a new C/D record for transactions 7, 13, 19, …
- Logical records are fixed at 1464 characters; FIs differ on whether records are newline-terminated or one continuous stream — follow the FI spec.
Code tables
Record types
| Code | Record |
|---|---|
A |
File header (logical record 1) |
C |
Credit (forward) detail — money paid to a payee |
D |
Debit detail — money pulled from a payor (pre-authorized debit) |
Z |
File trailer (totals) |
Transaction (CPA) codes — selected
| Code | Meaning |
|---|---|
200 |
Payroll deposit (regular) |
230 |
Pension |
250 |
Dividends |
300 |
Vendor / supplier payment (business payable) |
330 |
Annuity |
430 |
Pre-authorized debit — insurance |
450 |
Pre-authorized debit — utilities / regular bill payment |
460 |
Pre-authorized debit — recurring (other) |
470 |
Federal government payment |
Transaction codes are 3-digit CPA codes; the full list lives in CPA Standard 007 / your FI's AFT spec. Use the code your FI maps to the payment's purpose — credits (200–299) on C records, debits (400–499) on D records, government codes per the FI.
Routing components
| Component | Width | Notes |
|---|---|---|
| Institution number | 3 | e.g. 001 RBC, 002 BMO, 003 Scotiabank, 004 TD, 006 National Bank, 010 CIBC, 016 HSBC, 815 Desjardins |
| Transit (branch) number | 5 | the branch's MICR transit |
| Account number | ≤12 | right-justified, zero-filled to field width |
Calculation rules
- Amounts are integer cents.
amount_cents = round(dollars × 100); written zero-filled, right-justified, no separators.$2,500.00→0000250000. - Due date (Julian) =
0+YY(last two digits of year) +DDD(ordinal day-of-year, 001–366).2026-03-16→ day 075 →026075. The file creation date in the A record uses the same0YYDDDform. - Trailer credit total = Σ of every C-segment amount (in cents); trailer credit count = number of C-segments. Likewise for debit total/count from D-segments.
- Reconcile: total transaction count in the trailer must equal the number of C-segments + D-segments actually written; total value must equal the summed segment amounts. Recompute — never copy a register subtotal blindly; flag any mismatch with the source.
- Account number right-justified, zero-filled; institution/transit left-zero-padded to 3/5 digits. Names upper-cased, left-justified, space-padded (truncate to field width — typically 30 for the long name, 15 for the short name).
- One file = one currency. CAD and USD streams are separate files with separate originator numbers.
Worked example (end-to-end)
Originator ACME PAYROLL (client number 0123456789, short name ACME PAY), file creation number 0001, file created 2026-03-13 (day 072 → Julian 026072), destination data centre 00510. One payroll credit (txn code 200) of $2,500.00 due 2026-03-16 (day 075 → 026075) to JANE Q SAMPLE, account 001-12345-000123456789, with return account 001-12345-000999888777.
The trailer reports 1 credit transaction totalling 250000 cents, 0 debits.
A000000001012345678900010260720051000000000000000000000000000000000000000000000000000000000000000000
C000000002012345678900010002000000250000026075001123450001234567890000ACME PAY JANE Q SAMPLE ACME PAYROLL PAYRUN-2026-06 0011234500009998887770000000000000000000000000
Z000000003012345678900010000000000000000000000000000000025000000000001000000000000000000000000000000
Field walk-through (key positions):
- A record —
A· seq000000001· originator0123456789· file creation0001· creation date026072· destination DC00510· rest space/zero-filled to 1464. - C record —
C· seq000000002· originator0123456789· file creation0001· then segment 1: txn code200· amount0000250000(= 250000 cents = $2,500.00) · due date026075· institution001· transit12345· account000123456789· short nameACME PAY· payeeJANE Q SAMPLE· long nameACME PAYROLL· referencePAYRUN-2026-06· return institution001/ transit12345/ account000999888777· remaining 5 segments and tail zero/space-filled. - Z record —
Z· seq000000003· originator0123456789· file creation0001· total debit value00000000000000· total debit count00000000· total credit value00000000250000(= $2,500.00) · total credit count00000001.
Normalisations shown: $2,500.00 → 0000250000 (cents, no separators); 2026-03-16 → Julian 026075; account 123456789 → 000123456789 (right-justified, 12); names upper-cased and space-padded; institution/transit zero-padded to 001/12345. (The blocks above are illustrative widths; the real record is exactly 1464 characters — pad each field to its FI-specified column before upload.)
Validation checklist
- All required fields extracted; AI asked about anything missing or ambiguous (no invented transit, institution, or account numbers)
- Exactly one A header (logical record 1) and exactly one Z trailer (last record)
- Record type letters correct:
Cfor credits (txn 2xx),Dfor debits (txn 4xx); each C/D record ≤ 6 transaction segments - Logical record count increments sequentially in positions 2–10 of every record
- Originator (client) number and file creation number identical across A, C/D, and Z records
- Amounts in integer cents, zero-filled, no decimal point / comma / dollar sign
- Due dates and creation date in Julian
0YYDDD(day-of-year 001–366) - Institution (3) + transit (5) + account (≤12, right-justified, zero-filled) normalised; return institution/transit/account present
- Z trailer credit value/count and debit value/count reconcile to the summed C/D segments; recomputed totals match the source or discrepancy flagged
- Each logical record is exactly 1464 characters; file naming, data-centre numbers, transaction codes, and test/production flag validated against your FI's AFT/EFT specification before upload
Last updated: 2026-06-13 — verify the CPA Standard 005 record layout, transaction-code list, and your financial institution's AFT/EFT file specification (record length, field positions, originator/data-centre numbers, cut-off times) before use.