website logo
SupportSign In
⌘K
Developing on Invoiced
Custom PDF Templates
File Attachments
Magic Links
Metered Billing
Payment Information
Subscription Billing
Template Language
Webhooks
API Release Notes
API Reference
User Documentation
Docs powered by archbee 
10min

Template Language

The Invoiced Template Language is a powerful, easy way to customize the invoices, statements, emails, text messages, and more on Invoiced. Our template language is built on the popular Twig template language with custom extensions designed for the unique requirements of billing.

Usage

Invoiced Template Language can be used to generate personalized emails, messages, and documents. In this document you will learn about all of the capabilities and features of the template language.

Variables

The most common use of the template language is to output variables. In order to use a variable, the name is wrapped in {{ and }}.

Invoiced Template Language
|


Tags

Tags allow you to implement logic within your template, like branching and looping.

Here is an example of an if statement:

Invoiced Template Language
|


Available tags: (click to learn more)

  • if
  • for
  • set

Filters

Filters allow you to modify variables before they are output into the document.

Here is an example of a filter that formats the invoice variable as a money amount and output in your document:

Invoiced Template Language
|


Available filters: (click to learn more)

  • abs
  • batch
  • capitalize
  • date
  • date_modify
  • default
  • escape
  • first
  • format
  • join
  • last
  • length
  • lower
  • merge
  • money - Formats a number as a money amount.
  • money_unit_cost - Formats a number as a money amount according to the rules for unit cost.
  • nl2br
  • number_format
  • number_format_no_round - Formats a number without applying any rounding or modification of decimal.
  • raw
  • replace
  • reverse
  • round
  • slice
  • sort
  • split
  • title
  • trim
  • upper

Functions

You can call a functions to generate content. Functions are called by their name followed by parentheses and optional arguments.

For example this will show the maximum of the two values:

Invoiced Template Language
|


Functions can be combined with filters:

Invoiced Template Language
|


Available functions: (click to learn more)

  • cycle
  • date
  • dump
  • dump_scope - Dumps all of the variables available within the template in a readable format.
  • max
  • min
  • random
  • range
  • trans - Translates a string in the customer's locale.
  • transchoice - Translates a string in the customer's locale with pluralization rules.



Did this page help you?
Yes
No
UP NEXT
Webhooks
Docs powered by archbee 
TABLE OF CONTENTS
Usage
Variables
Tags
Filters
Functions