Overview

Invoice is a type of financial records representing the billing sent from merchant to customer. It acts primarily as a collection of other financial records, such as line items, taxes, discounts and credits. Invoice is also referred to as "order".

Create an Invoice

The following fields are required :

  • objectType: type of financial record. For Invoice, the value is "invoice".
  • id: unique identifier of this record. This is external id received by Leapfin.
  • totalAmount: total amount of invoice including tax and discount.
  • subtotalAmount: total amount of invoice excluding tax and discount.
  • currencyCode: 3-digit ISO code of totalAmount and subtotalAmount fields, e.g. “USD”, "GBP", etc. This is the primary currency of this record
  • status: current status of this invoice. Acceptable values are:
    • "drafted": the invoice is created but has not been sent to customers
    • "open": the invoice is issued to customers for payment
    • "paid": the invoice is paid by customers
    • "uncollectible": the invoice is issued but never paid successfully. Payment is not longer expected to be received.
    • "voided": the invoice is canceled after issued to customers
  • date: the date-time of when this invoice is created in billing system.

The following fields are optional but are commonly need for creating journal entries:

  • issueDate: the date-time when this invoice is issued. If not issued yet, the value is null. In most cases this will be the same as date. However, if invoices can be in a 'drafted' state, then this date can be different.
  • uncollectibleDate: the date-time when the payment for this invoice becomes uncollectible. If invoice has not become uncollectible or has been paid, then the value is null. Typically used for dunning/bad debt rule scenarios.
  • paidDate: the date-time when this invoice is paid. Typically used for invoice to payment matching.
  • dueDate: the date-time when the payment for this invoice is due.
  • exchangeRates: a list of exchange rates used to calculate currency conversions
    • currencyCode: 3-digit ISO code, e.g. “USD”, "GBP", etc. This is the target currency of this record
    • rate: conversion rate from primary currency to target currency. i.e. amount in primary currency * rate = converted amount in target currency.
  • links: directional relationships pointing from this record to other financial records. While Invoice often expects many other financial records (e.g. Line Item, Tax, etc.) pointing to it, the record usually has no links pointing to other records.
    • objectType: type of the target financial record
    • id: unique identifier of the target financial record
  • customFields: additional fields (i.e. key-value pairs) related to this record

Sample Data

{
    "objectType": "invoice",
    "id": "invoice_001",
    "totalAmount": 1090.19,
    "subtotalAmount": 1000.00,
    "currencyCode": "USD",
    "status": "open",
    "date": "2021-01-16T19:20:30",
    "issueDate": "2021-01-16T19:25:10",
    "uncollectibleDate": null,
    "paidDate": null,
    "dueDate": "2021-02-16T00:00:00",
    "exchangeRates": [
      {
        "currencyCode": "EUR",
        "rate": 0.84
      },
      {
        "currencyCode": "GBP",
        "rate": 0.73
      }
    ],
    "links": [],
    "customFields": {
      "field1": "value1",
      "field2": "value2"
    }
}

Query an Invoice

Invoice records are stored in VW_FT_INVOICE table. It can be accessed via Snowflake Data Sharing and Access.

ColumnDescription
LEAPFIN_IDunique identifier created by Leapfin.
DECODED_LEAPFIN_ID_VTdecoded version of LEAPFIN_ID in json format. It contains following values:

- external_code: unique identifier of this record. This is external id received by Leapfin.
- integration_id: unique identifier of the data source. This is internal id created by Leapfin.
- leapfin_data_type: type of financial record, i.e. "LeapfinInvoice"
- leapfin_suffix: additional string to distinguish different financial records when the same external_code is received from the data source.
- raw_data_type: type of raw data record received from the data source.
ORGANIZATION_IDunique identifier of the account. This is internal id created by Leapfin.
DATE_DTthe date of when this Event happened.
STATUScurrent status of this invoice. Acceptable values are:

- "drafted": the invoice is created but has not been sent to customers
- "open": the invoice is issued to customers for payment
- "paid": the invoice is paid by customers
- "uncollectible": the invoice is issued but never paid successfully. Payment is not longer expected to be received.
- "voided": the invoice is canceled after issued to customers
DUE_DATE_DTthe date when the payment for this invoice is due.
ISSUED_DATE_DTthe date when this invoice is issued. If not issued yet, the value is null. In most cases this will be the same as date. However, if invoices can be in a 'drafted' state, then this date can be different.
UNCOLLECTIBLE_DATE_DTthe date when the payment for this invoice becomes uncollectible. If invoice has not become uncollectible or has been paid, then the value is null. Typically used for dunning/bad debt rule scenarios.
CURRENCY_CODE3-digit ISO code, e.g. “USD”, "GBP", etc. This is the primary currency of this record.
EXCHANGE_RATES_VTa list of exchange rates used to calculate currency conversions. Each rate contains following values:

- currencyCode: 3-digit ISO code, e.g. “USD”, "GBP", etc. This is the target currency of this record.
- rate: conversion rate from primary currency to target currency. i.e. amount in primary currency * rate = converted amount in target currency.
PAID_DATE_DTthe date when this invoice is paid. Typically used for invoice to payment matching.
CUSTOM_FIELDS_VTadditional fields (i.e. key-value pairs) about the financial record in json format
ACCOUNTING_TRANSACTIONS_VTa list of journal entries associated with this financial record. Each item contains following values:

- date: the date of the journal entry
- entries: a list of journal lines within the journal entry. Each line contains following values:
--- account: unique identifier of the financial account. This is an internal id created by Leapfin (refer to VW_LK_ACCOUNT).
--- amount: amount of money booked towards the account.
--- accountingSide: an indicator of whether the amount is a debt ("dr") or credit ("cr") to the acount.
- comments: additional fields (i.e. key-value pairs) on the journal entry in json format.
TOTALtotal amount of invoice including tax and discount. This amount is derived by Leapfin based on the Line Item, Tax, and Discount associated with the Invoice.
SUBTOTALtotal amount of invoice excluding tax and discount. This amount is derived by Leapfin based on the Line Item associated with the Invoice.
EXTERNAL_TOTALtotal amount of invoice including tax and discount. This amount is received from external source.
EXTERNAL_SUBTOTALtotal amount of invoice excluding tax and discount. This amount is received from external source.
CREATED_AT_DTthe date-time when the financial record is created by Leapfin. Value format: "2022-07-14 23:01:26.400"
UPDATED_AT_DTthe date-time when the financial record is last updated by Leapfin. Value format: "2022-09-01 06:09:57.379"