# Billtrust

> Send customers, invoices and contacts to Billtrust and read payments and remittance exports.

App · 21 actions. Web page: https://docs.lodol.com/docs/integrations/billtrust

## Actions

### Add customer note

Add a note to a customer account. Notes can't be changed or deleted later.

**Inputs**

- Account number (`account_number`, text, required): Your own unique number for the customer account, such as its number in your ERP.
- Note reference (`reference`, text, required): Your own unique reference for the note.
- Note (`body`, text, required): The note.
- Subject (`subject`, text): The note's subject line.
- Note type (`note_type`, text): A label for the kind of note, such as `collections`.
- Effective date (`effective_date`, date and time): When the note takes effect. Defaults to now.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "body": "example",
    "effective_date": "example",
    "note_type": "example",
    "reference": "example",
    "subject": "example"
  }
}
```

### Close invoice

Close an open invoice or credit note and record why.

**Inputs**

- Document number (`document_number`, text, required): Your own unique number for the invoice or credit note.
- Reason (`closure_reason`, text, required): Why the invoice is closed. One of: `paid`, `write_off` (Write off), `contra`, `adjustment`, `other`.
- Closed at (`closure_date`, date and time): When it was closed. Defaults to now.
- Notes (`notes`, text): A note to keep with the closure.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "account_number": "example",
    "currency": "example",
    "denomination": 1,
    "document_number": "example",
    "document_type": "example",
    "due_date": "example",
    "invoice_date": "example",
    "invoice_num": "example",
    "original_denomination": 1,
    "status": "example"
  }
}
```

### Create contact

Add a contact to a customer account, for Collections reminders and calls.

**Inputs**

- Contact reference (`reference`, text, required): Your own unique reference for the contact.
- Customer account number (`account_number`, text): The account number of the customer this contact belongs to.
- First name (`first_name`, text): First name.
- Last name (`last_name`, text): Last name.
- Email (`email`, text): Email address.
- Phone (`phone`, text): Phone number.
- Mobile phone (`mobile_phone`, text): Mobile number.
- Job title (`title`, text): Job title.
- Department (`department`, text): Department.
- Role (`function`, text): The contact's role, such as accountant.
- Primary contact (`is_primary`, true/false): Turn on to make this the customer's primary contact for Collections.
- Language (`language`, text): Two-letter language code, such as `en`.
- Notes (`notes`, text): Notes about this contact.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "account_number": "example",
    "email": "example",
    "first_name": "example",
    "is_primary": true,
    "last_name": "example",
    "phone": "example",
    "reference": "example"
  }
}
```

### Create customer

Add a customer account to Billtrust. Fails if the account number is already in use.

**Inputs**

- Account number (`account_number`, text, required): Your own unique number for the customer account, such as its number in your ERP.
- Name (`name`, text, required): The customer's name.
- Email (`email`, text): The customer's billing email address.
- Phone (`phone`, text): The customer's phone number.
- Currency (`currency`, text): Three-letter currency code, such as `USD`. Needed when your Billtrust account uses the basic currency model; it can't be changed later.
- Payment terms (`payment_terms`, text): Payment terms, such as `NET30`.
- Credit limit (`credit_limit`, number): The customer's credit limit.
- Language (`language`, text): Two-letter language code for Collections emails, such as `en`.
- Display reference (`display_reference`, text): A short reference shown in Billtrust and used to match payments.
- Account group (`account_group`, text): A group or segment label.
- Parent account number (`parent_account_number`, text): The account number of this customer's parent account.
- VAT number (`vat`, text): VAT registration number.
- Description (`description`, text): A description of the customer.
- Address line 1 (`address1`, text): Billing street address.
- Address line 2 (`address2`, text): Billing address line 2.
- City (`city`, text): Billing city.
- State (`state`, text): Billing state or province.
- Postal code (`zip`, text): Billing postal code.
- Country (`country`, text): Billing country as a two-letter code, such as `US`.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "account_number": "example",
    "currency": "example",
    "email": "example",
    "name": "example",
    "notes": [
      {}
    ],
    "payment_terms": "example",
    "status": "example"
  }
}
```

### Create export schedule

Set up a recurring payment export that runs every so many minutes.

**Inputs**

- Data source (`source`, text, required): Which payment data to read: cash application payments (cashapp), invoice and payment data (iandp) or Billtrust Payment Network data (bpn). One of: `cashapp`, `iandp`, `bpn`.
- Every (minutes) (`interval_minutes`, number, required): How often to run the export, in minutes. At least 5. At least 5.
- Name (`name`, text): A name for the schedule.
- First run (`first_run_at`, date and time): When to run it first. Defaults to one interval from now.
- Filter field (`filter_field`, text): A field to filter on, such as `status`. Get Payment Fields lists the fields you can filter on.
- Filter operator (`filter_operator`, text): How to compare the field with the value. In and Not in take several values separated by commas. One of: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`. Default: `eq`.
- Filter value (`filter_value`, text): The value to compare with.
- Fields (`fields`, list): The fields to return. Leave empty for the standard payment fields.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "createdAt": "example",
    "fields": [
      "example"
    ],
    "filters": {},
    "id": "example",
    "intervalMs": 1,
    "nextRunAt": "example",
    "scheduleName": "example",
    "source": "example"
  }
}
```

### Create invoice

Add an invoice or credit note to Billtrust. Fails if the document number is already in use.

**Inputs**

- Document number (`document_number`, text, required): Your own unique number for the invoice or credit note.
- Customer account number (`account_number`, text, required): The account number of the customer the invoice belongs to.
- Type (`document_type`, text): Invoice, credit note or other. One of: `invoice`, `credit_note` (Credit note), `other`. Default: `invoice`.
- Invoice date (`invoice_date`, date, required): The date of the invoice.
- Due date (`due_date`, date, required): The date payment is due.
- Invoice number (`invoice_num`, text): The invoice number customers see. Needed to match payments in CashApp.
- Currency (`currency`, text): Three-letter currency code, such as `USD`. Enter it with both amounts.
- Original amount (`original_amount`, number): The invoice's original total.
- Amount due (`amount_due`, number): The amount still owed. Zero closes the invoice.
- PO number (`po_number`, text): The customer's purchase order number.
- Credits invoice (`applies_to_invoice`, text): For a credit note: the number of the invoice it credits.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "account_number": "example",
    "currency": "example",
    "denomination": 1,
    "document_number": "example",
    "document_type": "example",
    "due_date": "example",
    "invoice_date": "example",
    "invoice_num": "example",
    "original_denomination": 1,
    "status": "example"
  }
}
```

### Delete export schedule

Delete an export schedule. Past runs and their data stay available.

**Inputs**

- Export schedule (`schedule_id`, text, required): The export schedule.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {}
}
```

### Find payments

Find payment and remittance records by date and field values. Billtrust leaves out payments an export schedule has already delivered.

**Inputs**

- Data source (`source`, text, required): Which payment data to read: cash application payments (cashapp), invoice and payment data (iandp) or Billtrust Payment Network data (bpn). One of: `cashapp`, `iandp`, `bpn`.
- From date (`from_date`, date): Payments created on or after this date.
- To date (`to_date`, date): Payments created on or before this date.
- Filter field (`filter_field`, text): A field to filter on, such as `status`. Get Payment Fields lists the fields you can filter on.
- Filter operator (`filter_operator`, text): How to compare the field with the value. In and Not in take several values separated by commas. One of: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`. Default: `eq`.
- Filter value (`filter_value`, text): The value to compare with.
- Fields (`fields`, list): The fields to return. Leave empty for the standard payment fields.
- Limit (`limit`, number): How many payments to return, up to 100,000. Defaults to 500. From 1 to 100000.
- Next page cursor (`cursor`, text): The cursor from the previous page's pagination, to get the next page.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "data": [
      {}
    ],
    "pagination": {
      "cursor": "example",
      "hasMore": true,
      "rowCount": 1
    }
  }
}
```

### Get contact

Get a contact by its reference.

**Inputs**

- Contact reference (`reference`, text, required): Your own unique reference for the contact.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "account_number": "example",
    "email": "example",
    "first_name": "example",
    "is_primary": true,
    "last_name": "example",
    "phone": "example",
    "reference": "example"
  }
}
```

### Get customer

Get a customer account and its notes.

**Inputs**

- Account number (`account_number`, text, required): Your own unique number for the customer account, such as its number in your ERP.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "account_number": "example",
    "currency": "example",
    "email": "example",
    "name": "example",
    "notes": [
      {}
    ],
    "payment_terms": "example",
    "status": "example"
  }
}
```

### Get customer note

Get one note on a customer account by its reference.

**Inputs**

- Account number (`account_number`, text, required): Your own unique number for the customer account, such as its number in your ERP.
- Note reference (`reference`, text, required): The note's reference.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "body": "example",
    "effective_date": "example",
    "note_type": "example",
    "reference": "example",
    "subject": "example"
  }
}
```

### Get export run data

Get the payment rows a completed export run produced. Data is kept for 90 days.

**Inputs**

- Export schedule (`schedule_id`, text, required): The export schedule.
- Run ID (`run_id`, text): The run to read. Leave empty for the most recent completed run.
- Limit (`limit`, number): How many rows to return, up to 100,000. Defaults to 500. From 1 to 100000.
- Next page cursor (`cursor`, text): The cursor from the previous page's pagination, to get the next page.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "data": [
      {}
    ],
    "pagination": {
      "cursor": "example",
      "hasMore": true,
      "rowCount": 1
    },
    "runId": "example"
  }
}
```

### Get invoice

Get an invoice or credit note, including whether it is open or closed.

**Inputs**

- Document number (`document_number`, text, required): Your own unique number for the invoice or credit note.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "account_number": "example",
    "currency": "example",
    "denomination": 1,
    "document_number": "example",
    "document_type": "example",
    "due_date": "example",
    "invoice_date": "example",
    "invoice_num": "example",
    "original_denomination": 1,
    "status": "example"
  }
}
```

### Get latest export run

Get the most recent finished run of an export schedule, and whether it completed or failed.

**Inputs**

- Export schedule (`schedule_id`, text, required): The export schedule.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "completedAt": "example",
    "errorDetail": "example",
    "errorStage": "example",
    "rowCount": 1,
    "runId": "example",
    "scheduleId": "example",
    "startedAt": "example",
    "status": "example"
  }
}
```

### Get payment fields

List the payment fields you can return and filter on, for each data source.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "fields": {},
    "filters": {},
    "sources": [
      "example"
    ],
    "version": "example"
  }
}
```

### List customer notes

List the notes on a customer account.

**Inputs**

- Account number (`account_number`, text, required): Your own unique number for the customer account, such as its number in your ERP.

**Outputs**

- `data` (list): The response from Billtrust.

**Example output**

```json
{
  "data": [
    {
      "body": "example",
      "effective_date": "example",
      "note_type": "example",
      "reference": "example",
      "subject": "example"
    }
  ]
}
```

### List export schedules

List your recurring payment export schedules.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "data": [
      {
        "createdAt": "example",
        "fields": [
          "example"
        ],
        "filters": {},
        "id": "example",
        "intervalMs": 1,
        "nextRunAt": "example",
        "scheduleName": "example",
        "source": "example"
      }
    ]
  }
}
```

### List invoice PDFs

List the PDF files attached to an invoice or credit note.

**Inputs**

- Document number (`document_number`, text, required): Your own unique number for the invoice or credit note.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "attachments": [
      {}
    ],
    "document_number": "example"
  }
}
```

### Update contact

Change a contact. Only the fields you fill in change.

**Inputs**

- Contact reference (`reference`, text, required): Your own unique reference for the contact.
- Customer account number (`account_number`, text): The account number of the customer this contact belongs to.
- First name (`first_name`, text): First name.
- Last name (`last_name`, text): Last name.
- Email (`email`, text): Email address.
- Phone (`phone`, text): Phone number.
- Mobile phone (`mobile_phone`, text): Mobile number.
- Job title (`title`, text): Job title.
- Department (`department`, text): Department.
- Role (`function`, text): The contact's role, such as accountant.
- Primary contact (`is_primary`, true/false): Turn on to make this the customer's primary contact for Collections.
- Language (`language`, text): Two-letter language code, such as `en`.
- Notes (`notes`, text): Notes about this contact.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "account_number": "example",
    "email": "example",
    "first_name": "example",
    "is_primary": true,
    "last_name": "example",
    "phone": "example",
    "reference": "example"
  }
}
```

### Update customer

Change a customer account. Only the fields you fill in change.

**Inputs**

- Account number (`account_number`, text, required): Your own unique number for the customer account, such as its number in your ERP.
- Name (`name`, text): The customer's name.
- Email (`email`, text): The customer's billing email address.
- Phone (`phone`, text): The customer's phone number.
- Currency (`currency`, text): Three-letter currency code, such as `USD`. Needed when your Billtrust account uses the basic currency model; it can't be changed later.
- Payment terms (`payment_terms`, text): Payment terms, such as `NET30`.
- Credit limit (`credit_limit`, number): The customer's credit limit.
- Language (`language`, text): Two-letter language code for Collections emails, such as `en`.
- Display reference (`display_reference`, text): A short reference shown in Billtrust and used to match payments.
- Account group (`account_group`, text): A group or segment label.
- Parent account number (`parent_account_number`, text): The account number of this customer's parent account.
- VAT number (`vat`, text): VAT registration number.
- Description (`description`, text): A description of the customer.
- Address line 1 (`address1`, text): Billing street address.
- Address line 2 (`address2`, text): Billing address line 2.
- City (`city`, text): Billing city.
- State (`state`, text): Billing state or province.
- Postal code (`zip`, text): Billing postal code.
- Country (`country`, text): Billing country as a two-letter code, such as `US`.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "account_number": "example",
    "currency": "example",
    "email": "example",
    "name": "example",
    "notes": [
      {}
    ],
    "payment_terms": "example",
    "status": "example"
  }
}
```

### Update invoice

Change an invoice or credit note. Only the fields you fill in change; an amount due of zero closes it, and a closed one with an amount due reopens.

**Inputs**

- Document number (`document_number`, text, required): Your own unique number for the invoice or credit note.
- Customer account number (`account_number`, text): The account number of the customer the invoice belongs to.
- Type (`document_type`, text): Invoice, credit note or other. One of: `invoice`, `credit_note` (Credit note), `other`. Default: `invoice`.
- Invoice date (`invoice_date`, date): The date of the invoice.
- Due date (`due_date`, date): The date payment is due.
- Invoice number (`invoice_num`, text): The invoice number customers see. Needed to match payments in CashApp.
- Currency (`currency`, text): Three-letter currency code, such as `USD`. Enter it with both amounts.
- Original amount (`original_amount`, number): The invoice's original total.
- Amount due (`amount_due`, number): The amount still owed. Zero closes the invoice.
- PO number (`po_number`, text): The customer's purchase order number.
- Credits invoice (`applies_to_invoice`, text): For a credit note: the number of the invoice it credits.

**Outputs**

- `data` (object): The response from Billtrust.

**Example output**

```json
{
  "data": {
    "account_number": "example",
    "currency": "example",
    "denomination": 1,
    "document_number": "example",
    "document_type": "example",
    "due_date": "example",
    "invoice_date": "example",
    "invoice_num": "example",
    "original_denomination": 1,
    "status": "example"
  }
}
```
