e

Invoice Template Variables Documentation


This document provides a comprehensive guide to all variables available in the invoice template system. These variables can be used to create custom invoice templates.


For their usage, please refer to the zenskar default template in your sandbox account


Basic Invoice Information



Invoice Header


  • {{invoice_data.id}} - Invoice number
    • {{invoice_data.invoice_date}} - Date when the invoice was created
      • {{invoice_data.due_by}} - Due date for payment
        • {{billing_duration}} - Billing period duration
          • {{logo}} - Organization's logo URL

Customer Information


  • {{customer.name}} - Customer's name
    • {{customer.email}} - Customer's email address
      • {{customer.address}} - Customer's billing address
        • {{customer.tax_id}} - Customer's tax ID (if available)
          • {{customer.ship_to_address}} - Customer's shipping address (if different from billing)
            • {{customer.invoice_recipients}} - List of invoice recipients
              • {{customer.custom_data}} - Any custom data associated with the customer
                • {{customer.external_id}} - Customer's external ID
                  • {{customer.id}} - Customer's internal ID

Seller Information


  • {{seller.name}} - Seller's name
    • {{seller.address}} - Seller's address
      • {{seller.tax_config}} - Seller's tax configuration

Line Items

All line items data lies inside the {{document_lines}} object, so usage will be

{{#document_lines}} <p>{{item_name}}</p> <p>{{item_description}}</p> {{/document_lines}}

Line Item Properties


Each line item can have the following properties:

  • {{item_name}} - Name of the item
    • {{item_description}} - Description of the item
      • {{templating_data.indent_level}} - Indentation level for hierarchical display
        • {{templating_data.formatted_service_period}} - Service period for the item
          • {{templating_data.formatted_quantity}} - Formatted quantity with unit
            • {{templating_data.formatted_unit_price}} - Formatted price per unit
              • {{templating_data.formatted_amount}} - Formatted total amount
                • {{usage_report_link}} - if the usage report feature is enabled, use this to add a hyperlink to download the usage report

Pricing Types


The template supports various pricing types, each with specific variables:


Per Unit Pricing


  • {{templating_data.per-unit-pricing}} - Boolean indicating per-unit pricing
    • {{templating_data.quantity}} - Raw quantity value
      • {{templating_data.unit_price}} - Raw unit price
        • {{templating_data.amount}} - Raw total amount

Package Pricing


  • {{templating_data.package-pricing}} - Boolean indicating package pricing
    • {{templating_data.package_amount}} - Package price
      • {{templating_data.package_size}} - Size of the package

Volume Pricing


  • {{templating_data.volume-pricing}} - Boolean indicating volume pricing
    • {{templating_data.selected_price}} - Selected price based on volume

Tiered Pricing


  • {{templating_data.tiered-pricing}} - Boolean indicating tiered pricing
    • {{templating_data.tiers}} - Array of tier information
      • {{tier_name}} - Name of the tier
        • {{formatted_quantity}} - Quantity in this tier
          • {{formatted_unit_price}} - Price per unit in this tier
            • {{formatted_amount}} - Total amount for this tier

Matrix Pricing


  • {{templating_data.matrix-pricing}} - Boolean indicating matrix pricing
    • {{templating_data.tiers}} - Array of matrix pricing tiers

Custom Pricing


  • {{templating_data.custom-pricing}} - Boolean indicating custom pricing
    • {{templating_data.sub_line_items}} - Array of custom pricing line items

Product Level Discount


  • {{templating_data.discount}} – Boolean indicating whether a discount applies
    • {{templating_data.formatted_quantity}} – Quantity the discount applies to
      • {{templating_data.formatted_discount_to_show}} – Label or description for the discount
        • {{templating_data.formatted_discount_given}} – Discount amount shown as a deduction

Product Level Tax


  • {{templating_data.tax}} – Boolean indicating whether tax applies
    • {{templating_data.formatted_quantity}} – Quantity the tax applies to
      • {{templating_data.formatted_percent}} – Tax percentage
        • {{templating_data.formatted_tax_amount}} – Calculated tax amount

Product Level Surcharge



{{templating_data.surcharge_data}} – Boolean or object indicating if a surcharge applies



{{templating_data.formatted_quantity}} – Quantity the surcharge applies to



{{templating_data.surcharge_percent}} – Surcharge rate in percent



{{templating_data.surcharge_total}} – Calculated surcharge total



Totals and Adjustments


These are not inside the {{document_lines}}


Note: discount is applied before tax


Discounts


  • {{discount_data.discount_data}} - Discount information
    • {{discount_data.total_before_discount}} - Total before discount
      • {{discount_data.discount_percent}} - Discount percentage
        • {{discount_data.discount_total}} - Total discount amount

Taxes


  • {{tax_data_new.tax_data}} - Tax information
    • {{tax_data_new.total_before_tax}} - Total before tax
      • {{tax_data_new.taxes}} - Array of tax items
        • {{tax_item_name}} - Name of the tax
        • {{formatted_tax_amount}} - Formatted tax amount
        • {{tax_percent}} - Tax percentage
        • {{is_avalara_tax}} - Boolean indicating if it's an Avalara tax

Surcharges


  • {{surcharge_data.surcharge_data}} - Surcharge information
    • {{surcharge_data.total_before_surcharge}} - Total before surcharge
      • {{surcharge_data.surcharge_percent}} - Surcharge percentage
        • {{surcharge_data.surcharge_total}} - Total surcharge amount

Payment Information



Customer Balance


  • {{customer_balance.balance_is_non_zero}} - Boolean indicating if customer has balance
    • {{customer_balance.balance}} - Customer's current balance
      • {{customer_balance.amount_due}} - Final amount due after balance application

Payment Methods


  • {{ach_details}} - ACH payment details
    • {{bank_name}} - Bank name
      • {{routing_number}} - Routing number
        • {{account_number}} - Account number
          • {{swift_code}} - SWIFT code

Payment Instructions


  • {{payment_instructions}} - Custom payment instructions
    • {{title}} - Title of payment instructions
      • {{description}} - Description of payment instructions
        • {{details_list}} - List of payment details
          • {{key}} - Detail key
          • {{value}} - Detail value

Additional Information



Invoice Summary


  • {{summary.show_invoice_summary}} - Boolean indicating if summary should be shown
    • {{summary.amount_due}} - Amount due in summary
      • {{summary.current_date}} - Current date
        • {{summary.summary}} - Array of summary items
          • {{date}} - Date of transaction
            • {{amount_type}} - Type of amount
              • {{reference_id}} - Reference ID
                • {{remarks}} - Remarks
                  • {{amount}} - Amount

Invoice Notes


  • {{invoice_note}} - Invoice notes
    • {{invoice_note.title}} - Note title
      • {{invoice_note.note}} - Note content


Custom Attributes


Custom attributes which are set up for modules can be accessed in the template. The following are available in invoice template currently

  • Customer
    Using {{customer.custom_data.<custom attribute keyname}}
    • Contract
      Using {{contract.custom_attributes.<custom attribute keyname>}}
      • Products
        Using {{product.custom_attributes<custom attribute keyname>}}

Usage Examples



Basic Line Item

<tr> <td>{{item_name}}</td> <td>{{templating_data.formatted_service_period}}</td> <td>{{templating_data.formatted_unit_price}}</td> <td>{{templating_data.formatted_quantity}}</td> <td>{{templating_data.formatted_amount}}</td> </tr>

Tax Display

<tr> <td>{{tax_item_name}}</td> <td>{{tax_percent}}%</td> <td>{{formatted_tax_amount}}</td> </tr>

Payment Instructions

<div class="payment-instructions"> <h3>{{payment_instructions.title}}</h3> <p>{{payment_instructions.description}}</p> {{#payment_instructions.details_list}} <div class="detail-row"> <span>{{key}}:</span> <span>{{value}}</span> </div> {{/payment_instructions.details_list}} </div>

Notes


  1. All currency values are automatically formatted according to the specified currency.
    2. Dates are formatted according to the standard date format: "MMM DD, YYYY"
    3. Boolean values can be used with Mustache's conditional syntax: {{#variable}}...{{/variable}}
    4. Arrays can be iterated using Mustache's iteration syntax: {{#array}}...{{/array}}
    5. Some variables may be optional and should be checked for existence before use