> ## Documentation Index
> Fetch the complete documentation index at: https://docs.campfire.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Accounts Receivable Workflows

> How to create, modify, pay and void invoices in Campfire

<Info>All requests in this flow assume you have a valid access token attached in your request headers. See our [authentication guide](/quickstart) for more information.</Info>

## Creating an invoice

This section will guide you through the process of creating an invoice in Campfire.

<Steps>
  <Step title="Fetch related data">
    We'll need to grab some object references for related objects to create our invoice. We'll need to pass in the id's of the related objects where applicable in the invoice creation request. Linked here are the filter endpoints for the applicable objects. These include:

    * [Products (Required)](/api-reference/revenue-recognition/list-contract-products)
    * [Customers (Required)](/api-reference/company-objects/list-vendors)
    * [Entities (Required)](/api-reference/settings/list-chart-entities)
    * [Contracts (Optional)](/api-reference/revenue-recognition/list-contracts)
  </Step>

  <Step title="Assemble the request">
    We can now create our request body by filling in the related fields. Here are the required fields:

    | Field                   | Description                                                                                                 | Example                    |
    | ----------------------- | ----------------------------------------------------------------------------------------------------------- | -------------------------- |
    | `terms`                 | Payment terms (default is net\_30, can be: 7, 10, 15, 20, 30, 40, 45, 60, 90, 105, 120 or due\_on\_receipt) | `"net_30"`                 |
    | `invoice_date`          | Accounting date for the invoice in YYYY-MM-DD format                                                        | `"2025-07-01"`             |
    | `due_date`              | Due date for the invoice in YYYY-MM-DD format                                                               | `"2025-07-31"`             |
    | `lines`                 | Array of line items for the invoice                                                                         | See line item fields below |
    | `entity`                | ID from entity                                                                                              | `"54"`                     |
    | `currency`              | Currency code                                                                                               | `"USD"`                    |
    | `message_on_invoice`    | Message to display on invoice                                                                               | `"Invoice Message"`        |
    | `exchange_rate_book`    | Exchange rate between transactional and entity currency (auto-computed if not provided)                     | `1`                        |
    | `exchange_rate`         | Exchange rate between entity and consolidation currency (auto-computed if not provided)                     | `1`                        |
    | `client`                | ID from client                                                                                              | `"24020"`                  |
    | `billing_address`       | Billing address                                                                                             | `"Billing Address"`        |
    | `shipping_address`      | Shipping address                                                                                            | `"Shipping Address"`       |
    | `contract`              | ID from contract (optional)                                                                                 | `"24899"`                  |
    | `purchase_order_number` | Purchase order number                                                                                       | `"123456789"`              |
    | `invoice_number`        | Invoice number                                                                                              | `"1234567890"`             |
    | `location_of_sale`      | Location of sale description                                                                                | `"Location of sale desc"`  |
    | `item_date`             | Bill date in YYYY-MM-DD format                                                                              | `"2025-07-01"`             |
    | `period_start`          | Period start date in YYYY-MM-DD format                                                                      | `"2025-07-01"`             |
    | `period_end`            | Period end date in YYYY-MM-DD format                                                                        | `"2025-07-31"`             |
    | `shipping_date`         | Shipping date in YYYY-MM-DD format                                                                          | `"2025-07-01"`             |

    **Line Item Fields:**

    | Field          | Description                       | Example        |
    | -------------- | --------------------------------- | -------------- |
    | `service_date` | Service date in YYYY-MM-DD format | `"2025-07-01"` |
    | `amount`       | Line item amount                  | `300`          |
    | `product`      | ID from product                   | `"3560"`       |
    | `rate`         | Rate per unit                     | `15`           |
    | `description`  | Line item description             | `"Line desc"`  |
    | `quantity`     | Quantity                          | `20`           |
    | `tax`          | Tax amount                        | `12`           |

    Example request body:

    ```json theme={null}
    {
        "terms": "net_30",
        "invoice_date": "2025-07-01",
        "due_date": "2025-07-31",
        "lines": [
            {
                "service_date": "2025-07-01",
                "amount": 300,
                "product": "3560",
                "rate": 15,
                "description": "Line desc",
                "quantity": 20,
                "tax": 12
            }
        ],
        "entity": "54",
        "currency": "USD",
        "message_on_invoice": "Invoice Message",
        "exchange_rate_book": 1,
        "exchange_rate": 1,
        "client": "24020",
        "billing_address": "Billing Address",
        "shipping_address": "Shipping Address",
        "contract": "24899",
        "purchase_order_number": "123456789",
        "invoice_number": "1234567890",
        "location_of_sale": "Location of sale desc",
        "item_date": "2025-07-01",
        "period_start": "2025-07-01",
        "period_end": "2025-07-31",
        "shipping_date": "2025-07-01"
    }
    ```
  </Step>

  <Step title="Post the invoice">
    Now that we have the request we can post it via the [Create Invoice](/api-reference/accounts-receivable/create-invoice) endpoint.

    Congrats! You've created your first invoice!
  </Step>
</Steps>

## Paying an invoice

This section will walk you through posting a payment to an invoice.

<Steps>
  <Step title="Get a Journal & Transaction">
    We need to get a transaction id to reference in the payment.

    You have two options for this:

    * [Creating a Journal, and using one of its transactions](/guides/journal-entries)
    * [Finding Existing Transactions](/api-reference/core-accounting/list-chart-transactions)
  </Step>

  <Step title="Assembling the payment">
    Now that we have a transaction id, we can create our payment request body.

    Payments that don't use the full amount of a transaction will bump out a new line of the journal based on the referenced transaction.

    <Tip>You can apply multiple transactions to an invoice at the same time. Each transaction will be a separate payment.</Tip>

    | Field            | Description                                                                  | Example  |
    | ---------------- | ---------------------------------------------------------------------------- | -------- |
    | `transaction_id` | ID from transaction                                                          | `"1234"` |
    | `amount`         | Payment amount                                                               | `10000`  |
    | `account`        | ID from account (If you want to categorize the transaction at the same time) | `"1234"` |

    Example request body:

    ```json theme={null}
    {
        "transactions": [
            {
                "transaction_id": 21069178,
                "account_id": "2550",
                "amount": 8999.99
            }
        ],
    }
    ```
  </Step>

  <Step title="Post the payment">
    Now that we have the request we can post it via the [Create Payment](/api-reference/accounts-receivable/mark-invoice-as-paid) endpoint.

    Congrats! You've paid your invoice!
  </Step>
</Steps>
