Overview

Discount is a type of financial record representing a deduction of sale price on invoice. Discount can be applied either at invoice level, e.g. $10 coupon after spending $200, or at individual line-item level, e.g. 10% off on a shirt. Alternative names for Discount is coupon, promotion code, etc.

For invoice level discount, Leapfin creates a separate Discount record. For line-item level discounts, Leapfin recommends saving the discount information as parts of Line Item record.

📘

Discount vs Credit

Discount and Credit are similar in that they both reduce the amount of invoice. Sometime teams refer to those terms interchangeably without consistent definitions.

On Leapfin Platform, discount and credit are distinguished by whether its financial impact should be tracked independently of the invoices. If yes, then we consider it a Credit, otherwise a Discount.

For example, merchant offers $10 off for customer to use in future invoice.

  • If merchant considers this $10 as money owned to customer, then Leapfin will create a Credit.
  • If merchant considers this $10 has no value until it is applied to an invoice, then Leapfin will create a Discount.

Creating a Discount

The following fields are required :

  • objectType: type of financial record. For Discount, the value is "discount".
  • id: unique identifier of this record. This is an external id received by Leapfin.
  • amount: amount of the discount. The amount should be non-negative.
  • currencyCode: 3-digit ISO code, e.g. “USD”, representing the primary currency.
  • date: the date-time of when this discount is created in billing system.

The following fields are optional but are commonly needed for creating journal entries.

  • description: a general description of the discount
  • startDate: for discounts related to a subscription period, this is the start date-time of the period.
  • endDate: for discounts related to a subscription period, this is the end date-time of the period.
  • 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. Discount is commonly linked to Invoice or Line Item
    • objectType: type of the target financial record, e.g. "invoice"
    • id: the unique identifier of the target financial record
  • customFields: additional fields (i.e. key-value pairs) related to this record

Sample Data

{
    "objectType": "discount",
    "id": "discount_001",
    "amount": 13.09,
    "currencyCode": "USD",
    "description": "a sample discount",
    "date": "2021-01-16T11:28:31",
    "startDate": "2021-01-20T00:00:00",
    "endDate": "2022-01-19T00:00:00",
    "exchangeRates": [
      {
        "currencyCode": "EUR",
        "rate": 0.84
      },
      {
        "currencyCode": "GBP",
        "rate": 0.73
      }
    ],
    "links": [
      {
        "objectType": "invoice",
        "id": "invoice_001"
      }
    ],
    "customFields": {
      "field1": "value1",
      "field2": "value2"
    }
}

Query a Discount

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

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

- external_code: the unique identifier of this record. This is external id received by Leapfin.
- integration_id: the unique identifier of the data source. This is an internal id created by Leapfin.
- leapfin_data_type: type of financial record, i.e. "LeapfinDiscount"
- 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 an internal id created by Leapfin.
DATE_DTthe date of when this discount is created in billing system.
CURRENCY_CODE3-digit ISO code of amount field, e.g. “USD”, "GBP", etc. This is the primary currency of this record.
DESCRIPTIONA description of the Discount object.
START_DATE_DTFor Discounts that are subscription in nature (i.e. time-series based), this is the start date of the period.
END_DATE_DTFor Discounts that are subscription in nature (i.e. time-series based), this is the end date of the period.
AMOUNTamount of money impacted by this Discount. The value should be non-negative. This is the primary amount of this record.
EXCHANGE_RATES_VTa list of exchange rates used to calculate currency conversions. Each rate contains the 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.
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 the following values:

- date: the date of the journal entry
- entries: a list of journal lines within the journal entry. Each line contains the 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.
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"