Custom file layouts

Describe your bank's own payment file — its columns, their order and how each value is written — with the Custom format.

When your bank's bulk payment import isn't one of the listed formats (Standard 18, Barclays, NatWest, Allica Bank), set format to Custom and send the file's layout as fileLayout on create or update. Every payment file for the pay schedule is then written in it.

Example

{
  "method": "BACS",
  "format": "Custom",
  "reference": "SAL {period}",
  "bacs": { "sortCode": "123456", "accountNumber": "12345678" },
  "fileLayout": {
    "name": "Our bank's bulk payments",
    "extension": "csv",
    "rowFormat": "Delimited",
    "delimiter": ",",
    "headingRow": false,
    "columns": [
      { "field": "PayeeSortCode", "sortCode": "Dashed" },
      { "field": "PayeeAccountNumber", "accountNumber": "Digits" },
      { "field": "PayeeAccountNameAsEntered", "characterSet": "Bacs", "maxLength": 18 },
      { "field": "Amount", "amount": "Pounds" },
      { "field": "Blank" },
      { "field": "Reference", "characterSet": "Bacs", "maxLength": 18 }
    ]
  }
}

That layout writes one row per payment:

30-91-54,1335816,Mrs Leona Macauley,927.71,,SAL 8

How a layout works

  • The layout's extension (csv or txt) is the file format; fileFormat is not needed.
  • rowFormat is Delimited, with values separated by delimiter (a comma when left out), or FixedWidth, with every column padded to its width.
  • columns lists the row's columns in order. Each names a field: PayeeSortCode, PayeeAccountNumber, PayeeAccountName (the name in upper-case Bacs characters), PayeeAccountNameAsEntered, Amount, Reference, PaymentDate, EmployeeId, Literal (fixed text) or Blank.
  • A column takes only the options for its field: sortCode (Digits, Dashed, Spaced), accountNumber (PaddedToEight, Digits), amount (Pounds, PoundsTrimmed, Pence), dateFormat for PaymentDate, literal for Literal, plus heading, case, characterSet, trim, maxLength, width, align and pad. Options left out take their defaults.
  • A layout needs exactly one PayeeSortCode, PayeeAccountNumber and Amount column, and a name column, and a heading on every column when headingRow is true.
  • Limits: 1 to 100 columns, text up to 100 characters, a delimiter up to 5 characters, width and maxLength 1 to 1000. A fixed-width sort code, account number or amount column must be wide enough for every valid payment: 6 (8 with separators), 8, and 11 (10 in pence).

Starting from a bank format

List available payment configurations returns fileLayouts on each format: that format's own layout, with a stable id such as barclays-csv, ready to copy into a Custom layout and adjust. A pay schedule's own layout answers id: null.

Changing or removing a layout

  • An update without fileLayout keeps the stored layout.
  • Changing format away from Custom removes it; fileLayout with any other format is refused.
  • A changed layout makes the latest locked pay run's file out of date, as a changed bank does: rebuild it to get it in the new layout. Renaming the layout changes nothing in the file.

When a layout is refused

An invalid layout answers 400 (createOrganisationPaymentConfigInvalidFileLayout or updateOrganisationPaymentConfigInvalidFileLayout) with one entry in validationIssues per problem. Each names the field (for example fileLayout.columns[2].width, counting from zero) and a reasonToken to branch on. The reason text may change; the tokens do not.

reasonTokenMeaning
fileLayoutValueRequiredA required value is missing
fileLayoutValueNotAllowedA value is not one of those allowed
fileLayoutColumnsOutOfRangeFewer than 1 or more than 100 columns
fileLayoutNeedsExactlyOneColumnNot exactly one sort code, account number or amount column
fileLayoutNeedsNameColumnNo name column
fileLayoutDelimiterInvalidThe delimiter is empty, too long, or holds a quote or line break
fileLayoutHeadingRowNotAllowedA fixed-width layout with a heading row
fileLayoutColumnNeedsWidthA fixed-width column without a width
fileLayoutColumnNeedsHeadingA column without a heading, in a layout with a heading row
fileLayoutColumnNeedsLiteralA Literal column without its text
fileLayoutLengthOutOfRangeA width or maximum length outside 1 to 1000
fileLayoutColumnTooNarrowA fixed-width figure column too narrow for a valid payment
fileLayoutTextTooLongA name, heading or literal over 100 characters
fileLayoutPadInvalidA pad that is not a single character
📘

New values may be added

The layout's sets, such as field, may gain values. Treat one you don't recognise as unknown rather than failing: show it by name, and send it back unchanged.