---
source: https://carbone.io/examples/positive-pay-file-csv/
title: "Positive Pay File Generator: Check Issue CSV | Carbone"
description: "Generate a positive pay file from your AP check run with the Carbone API: a CSV template writes the issue and void records, count and totals for your bank."
generated_at: "2026-11-17"
---

# Positive Pay file

Issued and voided checks, ready to send to your bank

[![Positive Pay file: CSV generated from a CSV template and JSON data](/examples/positive-pay-file-csv/thumb-result.webp)](/examples/positive-pay-file-csv/result.csv "Download the generated document")

[Download template](/examples/positive-pay-file-csv/template.csv)

[Sample data](/examples/positive-pay-file-csv/data.json)

[Download the generated CSV](/examples/positive-pay-file-csv/result.csv)

- **Template:** CSV
- **Export as:** CSV
- **Carbone:** 5.4+

Features

-   [Loop](/documentation/design/repetitions/with-arrays.md)
-   [Aggregation](/documentation/design/computation/aggregation.md)
-   [Filter](/documentation/design/repetitions/filtering.md)
-   [Condition](/documentation/design/conditions/overview.md)
-   [Date format](/documentation/design/formatters/date.md)
-   [Number format](/documentation/design/formatters/number.md)

## Generate Positive Pay files from your AP system

Positive Pay is a check fraud control. The company sends its bank the list of the checks it issued, and the bank pays only the checks that match: same account, check number and amount, and for payee Positive Pay the same payee name. Accounts payable and treasury teams send this file after every check run, often every business day, and many rebuild it by hand from a spreadsheet. Your ERP or AP system sends the check register to the Carbone API as JSON and gets back the CSV to upload to the bank portal or SFTP. In this example, a fictional manufacturer, Tarnbury Industrial Supply, reports 20 checks of two bank accounts, including two voids.

Banks publish their own Positive Pay specifications: fixed-width or delimited, with or without header and trailer, with their own date formats and issue codes. This layout follows the common structure of these files: a header record, one detail record per check, and a trailer with counts and control totals. Many banks accept only the detail records, or one column header line, in a file uploaded to their portal, and accept a header and trailer only for direct transmission, so confirm with your bank which records it expects. The field order, MMDDYYYY dates, decimal amounts, `I` and `V` codes and payee name in the last column are the most common choices in the specifications that US banks publish. Start from the specification of your own bank, and adapt the columns and codes in the template. ACH Positive Pay is another service, which filters debits instead of checks and does not use this file.

In this example, you will:

-   write one detail record per check, in a loop on the check register;
-   write the issue date as MMDDYYYY and the amount with two decimals and no thousands separator;
-   send the void checks with the `V` code, in the same loop as the issued checks;
-   compute the trailer with aggregators: record count, issued and void counts and amounts;
-   quote the payee names that contain commas or quotes.

## Positive Pay file format

The first value of each line is its record type:

| Record | Fields |
| --- | --- |
| `H` header | Record type, company ID assigned by the bank, bank routing number, file date, file sequence number |
| `D` detail | Record type, account number, check number, issue code `I` for issued or `V` for void, issue date, amount, payee name |
| `T` trailer | Record type, number of detail records, number of issued checks, total of issued checks, number of void checks, total of void checks |

The bank uses the account number, the check number and the amount to match a presented check, and the payee name when the service checks payees. A `V` record tells the bank to reject the check if it is presented. The account numbers, the company ID and the routing number of this example are fictional.

## Positive Pay file example

### Template

```text
{o.lang=en-us}H,{d.companyId},{d.bankRouting},{d.fileDate:formatD('MMDDYYYY')},{d.fileSequence}
{d.checks[i].number:print(D)},{d.checks[i].account},{d.checks[i].number},{d.checks[i].code},{d.checks[i].issueDate:formatD('MMDDYYYY')},{d.checks[i].amount:formatN(2):replace(',', '')},"{d.checks[i].payee:replace('"', '""')}"
{d.checks[i+1]}T,{d.checks[].number:aggCount},{d.checks[code='I'].number:aggCount},{d.checks[code='I'].amount:aggSum:formatN(2):replace(',', '')},{d.checks[code='V'].number:aggCount},{d.checks[code='V'].amount:aggSum:formatN(2):replace(',', '')}
```

### JSON data

```json
{
  "companyId": "TIS0042718",
  "fileSequence": "0317",
  "fileDate": "2026-11-16",
  "bankRouting": "071904820",
  "checks": [
    {
      "account": "4820117365",
      "number": "104510",
      "code": "I",
      "issueDate": "2026-11-09",
      "payee": "Hartwell Steel Services, LLC",
      "amount": 18420.55
    },
    {
      "account": "4820117365",
      "number": "104511",
      "code": "I",
      "issueDate": "2026-11-09",
      "payee": "Delmar Packaging Co.",
      "amount": 6215.4
    },
    {
      "account": "4820117365",
      "number": "104512",
      "code": "I",
      "issueDate": "2026-11-09",
      "payee": "Quillon Freight Lines",
      "amount": 4890
    },
    {
      "account": "4820117365",
      "number": "104513",
      "code": "I",
      "issueDate": "2026-11-09",
      "payee": "Ostrander Tool and Die",
      "amount": 12750.25
    },
    {
      "account": "4820117365",
      "number": "104514",
      "code": "V",
      "issueDate": "2026-11-10",
      "payee": "Pinecrest Industrial Gases",
      "amount": 2318.76
    },
    {
      "account": "4820117365",
      "number": "104515",
      "code": "I",
      "issueDate": "2026-11-10",
      "payee": "Meridian Pallet Works",
      "amount": 3640.1
    },
    {
      "account": "4820117365",
      "number": "104516",
      "code": "I",
      "issueDate": "2026-11-10",
      "payee": "Lowell Electric Cooperative",
      "amount": 9875.33
    },
    {
      "account": "4820117365",
      "number": "104517",
      "code": "I",
      "issueDate": "2026-11-10",
      "payee": "Vantage Safety Products",
      "amount": 1496.82
    },
    {
      "account": "4820117365",
      "number": "104518",
      "code": "I",
      "issueDate": "2026-11-11",
      "payee": "Ridgeway Chemical Supply",
      "amount": 7312.48
    },
    {
      "account": "4820117365",
      "number": "104519",
      "code": "I",
      "issueDate": "2026-11-11",
      "payee": "Calloway Machine Parts, Inc.",
      "amount": 15060
    },
    {
      "account": "4820117365",
      "number": "104520",
      "code": "I",
      "issueDate": "2026-11-11",
      "payee": "State of Ohio Department of Taxation",
      "amount": 8250
    },
    {
      "account": "4820117365",
      "number": "104521",
      "code": "I",
      "issueDate": "2026-11-11",
      "payee": "Brightwater Staffing Group",
      "amount": 11432.9
    },
    {
      "account": "4820117373",
      "number": "104522",
      "code": "I",
      "issueDate": "2026-11-12",
      "payee": "Kessler and Moore Insurance Agency",
      "amount": 5280
    },
    {
      "account": "4820117373",
      "number": "104523",
      "code": "I",
      "issueDate": "2026-11-12",
      "payee": "Harbor Point Logistics",
      "amount": 3905.67
    },
    {
      "account": "4820117373",
      "number": "104524",
      "code": "V",
      "issueDate": "2026-11-12",
      "payee": "Alder Creek Coatings",
      "amount": 6741.19
    },
    {
      "account": "4820117373",
      "number": "104525",
      "code": "I",
      "issueDate": "2026-11-12",
      "payee": "Whitfield Lubricants",
      "amount": 2189.45
    },
    {
      "account": "4820117373",
      "number": "104526",
      "code": "I",
      "issueDate": "2026-11-13",
      "payee": "Northgate Maintenance Services",
      "amount": 4476.3
    },
    {
      "account": "4820117373",
      "number": "104527",
      "code": "I",
      "issueDate": "2026-11-13",
      "payee": "Ironbridge Fastener Co.",
      "amount": 8903.72
    },
    {
      "account": "4820117373",
      "number": "104528",
      "code": "I",
      "issueDate": "2026-11-13",
      "payee": "Sutter Office Products",
      "amount": 642.18
    },
    {
      "account": "4820117373",
      "number": "104529",
      "code": "I",
      "issueDate": "2026-11-13",
      "payee": "Greer "Quick-Ship" Couriers",
      "amount": 287.5
    }
  ]
}
```

### Generated CSV

```text
H,TIS0042718,071904820,11162026,0317
D,4820117365,104510,I,11092026,18420.55,"Hartwell Steel Services, LLC"
D,4820117365,104511,I,11092026,6215.40,"Delmar Packaging Co."
D,4820117365,104512,I,11092026,4890.00,"Quillon Freight Lines"
D,4820117365,104513,I,11092026,12750.25,"Ostrander Tool and Die"
D,4820117365,104514,V,11102026,2318.76,"Pinecrest Industrial Gases"
D,4820117365,104515,I,11102026,3640.10,"Meridian Pallet Works"
D,4820117365,104516,I,11102026,9875.33,"Lowell Electric Cooperative"
D,4820117365,104517,I,11102026,1496.82,"Vantage Safety Products"
D,4820117365,104518,I,11112026,7312.48,"Ridgeway Chemical Supply"
D,4820117365,104519,I,11112026,15060.00,"Calloway Machine Parts, Inc."
D,4820117365,104520,I,11112026,8250.00,"State of Ohio Department of Taxation"
D,4820117365,104521,I,11112026,11432.90,"Brightwater Staffing Group"
D,4820117373,104522,I,11122026,5280.00,"Kessler and Moore Insurance Agency"
D,4820117373,104523,I,11122026,3905.67,"Harbor Point Logistics"
D,4820117373,104524,V,11122026,6741.19,"Alder Creek Coatings"
D,4820117373,104525,I,11122026,2189.45,"Whitfield Lubricants"
D,4820117373,104526,I,11132026,4476.30,"Northgate Maintenance Services"
D,4820117373,104527,I,11132026,8903.72,"Ironbridge Fastener Co."
D,4820117373,104528,I,11132026,642.18,"Sutter Office Products"
D,4820117373,104529,I,11132026,287.50,"Greer ""Quick-Ship"" Couriers"
T,20,18,125028.65,2,9059.95
```

## How to create a Positive Pay file

### 1\. Write the header record

The first line is written once, with the company and the file: `H,{d.companyId},{d.bankRouting}`. `{d.fileDate:formatD('MMDDYYYY')}` turns the ISO date of the JSON data into `11162026`. `{o.lang=en-us}` at the start of the file fixes the number format, so the decimal separator does not depend on the language of the API call.

### 2\. Write one detail record per check

The second line is repeated by a [loop](/documentation/design/template-formats/csv.md#loops): `{d.checks[i].account}`, `{d.checks[i].number}`, and `{d.checks[i+1]}` at the start of the trailer line closes it. A line must start with a tag to be repeated, so the record type is written by `{d.checks[i].number:print(D)}`, which prints `D` instead of the number. Issued and void checks share the loop: the `code` of each check is `I` or `V`.

### 3\. Format dates, amounts and payee names

`{d.checks[i].issueDate:formatD('MMDDYYYY')}` writes `11092026`, and `{d.checks[i].amount:formatN(2):replace(',', '')}` writes `18420.55`. The payee is written between quotes, and `:replace('"', '""')` doubles the quotes inside the name, so `Greer "Quick-Ship" Couriers` stays one field. See [Commas and quotes](/documentation/design/template-formats/csv.md#commas-and-quotes) and the [date](/documentation/design/formatters/date.md) and [number](/documentation/design/formatters/number.md) formatters.

### 4\. Compute the trailer with aggregators

The trailer is written right after the end tag of the loop, so the file has no empty line. [Aggregators](/documentation/design/computation/aggregation.md) compute the control values from the data: `{d.checks[].number:aggCount:add(2)}` counts the detail records, and `{d.checks[code='I'].amount:aggSum:formatN(2):replace(',', '')}` sums the issued checks only, with an [array filter](/documentation/design/repetitions/filtering.md) on the `code`. The same filter on `V` gives the void count and total. Here, 18 issued checks total 125,028.65, and 2 void checks total 9,059.95.

### 5\. Send the file to the bank

The file is UTF-8, with one header, 20 detail records and one trailer, the trailer repeating the count of 20. Upload it to the bank portal or send it by SFTP before the cut-off time of your bank, and before the checks are mailed. Create the Carbone call at the end of the check run of your AP system, so that the file always matches the printed checks.

## Related Examples

- [NACHA ACH file](/examples/nacha-ach-file/index.md): TXT template to ACH.
- [GL journal import](/examples/gl-journal-import-csv/index.md): CSV template to CSV.
- [Bank reconciliation report](/examples/bank-reconciliation-report/index.md): XLSX template to XLSX.

## Related topics

- [GL journal import](/examples/gl-journal-import-csv/index.md)
- [Bank statement with page subtotals](/examples/bank-statement-simple/index.md)
- [Checking account statement](/examples/bank-statement-expert/index.md)
- [Monthly fund factsheet](/examples/fund-factsheet/index.md)
- [Multi-page product invoice](/examples/invoice-simple/index.md)
- [Monthly management report](/examples/monthly-management-report/index.md)
