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

# Email Template Variables

> All available variables for email notifications

<Note>
  All variables are automatically formatted. Dates are formatted according to the recipient's language (German: `31.12.2024`, English: `12/31/2024`). Currency amounts are also automatically formatted.
</Note>

## Overview

All variables are already formatted and do not need additional formatting.

**Important**:

* All dates and date/time values are automatically formatted
* All currency amounts are already formatted with currency symbols

## Variable Categories

### Customer Information

Available in all notifications:

* `customer.firstName` - Customer's first name (Text)
* `customer.lastName` - Customer's last name (Text)
* `customer.companyName` - Company name, if available (Text, optional)
* `customer.customerNumber` - Customer number (Text)
* `customer.language` - Customer's language (Text)
* `customer.locale` - Customer's locale code (Text)
* `customer.contactPerson.firstName` - Contact person's first name (Text, optional)
* `customer.contactPerson.lastName` - Contact person's last name (Text, optional)
* `customer.contactPerson.email` - Contact person's email (Text, optional)

### Organization Information

Available in all notifications:

* `tenant.name` - Organization name (Text)
* `tenant.legalCompanyName` - Legal company name (Text)
* `tenant.street` - Street (Text)
* `tenant.housenumber` - House number (Text)
* `tenant.zip` - Postal code (Text)
* `tenant.city` - City (Text)
* `tenant.email` - Email address (Text)
* `tenant.phone` - Phone number (Text, optional)
* `tenant.ceo` - CEO (Text)
* `tenant.commercialRegisterNumber` - Commercial register number (Text)
* `tenant.commercialRegister` - Commercial register (Text)

### Invoice Information

Available in invoice-related notifications:

* `invoice.number` - Invoice number (Text)
* `invoice.grossAmount` - Total amount including taxes (formatted)
* `invoice.netAmount` - Net amount excluding taxes (formatted)
* `invoice.taxAmount` - Tax amount (formatted)
* `invoice.dueDate` - Due date (formatted: `d.m.Y` for German, `m/d/Y` for English)
* `invoice.finalizationDate` - Invoice finalization date (formatted, optional)
* `invoice.payDate` - Payment date (formatted, optional)
* `invoice.documentDate` - Document date (formatted)
* `invoice.customerNumber` - Customer number (Text)
* `invoice.referencedInvoiceNumber` - Reference invoice number (Text, optional)
* `invoice.referencedInvoiceDate` - Reference invoice date (formatted, optional)
* `invoice.referencedInvoiceDueDate` - Reference due date (formatted, optional)
* `invoice.referencedInvoiceTotalGrossAmount` - Reference invoice amount (formatted, optional)
* `invoice.dueDateInDays` - Days until due (Number, optional)
* `invoice.dunningLevel` - Dunning level (Number, optional)
* `invoice.paymentMethod.type` - Payment method type (Text, optional)
* `invoice.paymentMethod.displayName` - Pre-formatted payment method display name (Text, optional)
* `invoice.paymentMethod.card.lastFour` - Last four digits of the card (Text, optional, cards only)
* `invoice.paymentMethod.card.expirationDate` - Card expiration date formatted as "MM/YYYY" (Text, optional, cards only)

### Transaction Information

Available in transaction-related notifications:

* `transaction.amount` - Transaction amount (formatted)
* `transaction.refundAmount` - Refund amount (formatted, optional)
* `transaction.chargedAmount` - Charged amount (formatted, optional)
* `transaction.description` - Transaction description (Text)
* `transaction.documentNumber` - Document reference number (Text)
* `transaction.paidAt` - Payment date and time (formatted: `d.m.Y H:i` for German, `m/d/Y h:i A` for English, optional)
* `transaction.failedAt` - Failure date and time (formatted, optional)
* `transaction.failReason` - Failure reason (Text, optional)
* `transaction.offsiteReason` - Reason for offsite authorization (Text, optional)
* `transaction.paymentMethod.type` - Payment method type (Text, optional)
* `transaction.paymentMethod.displayName` - Pre-formatted payment method display name (Text, optional)
* `transaction.paymentMethod.card.lastFour` - Last four digits of the card (Text, optional, cards only)
* `transaction.paymentMethod.card.expirationDate` - Card expiration date formatted as "MM/YYYY" (Text, optional, cards only)

### Payment Method Information

Available in payment method-related notifications:

* `paymentMethod.type` - Payment method type (Text)
* `paymentMethod.displayName` - Pre-formatted payment method display name (Text)
* `paymentMethod.card.lastFour` - Last four digits of the card (Text, optional, cards only)
* `paymentMethod.card.expirationDate` - Card expiration date formatted as "MM/YYYY" (Text, optional, cards only)

### Subscription Information

Available in subscription-related notifications:

* `subscription.number` - Subscription number (Text)
* `subscription.name` - Subscription name (Text)
* `subscription.poNumber` - Purchase order number (Text, optional)
* `subscription.trialEndsOn` - Trial period end date (formatted, optional)
* `subscription.customFields.<key>` - Value of a subscription custom field (Text, optional)

### Price Change Items

Available in price change notifications (Array):

* `updateItems[].subscriptionId` - Subscription ID (Text)
* `updateItems[].subscriptionNumber` - Subscription number (Text)
* `updateItems[].subscriptionName` - Subscription name (Text)
* `updateItems[].contractStart` - Contract start date and time (formatted)
* `updateItems[].applyOn` - Application date and time (formatted)
* `updateItems[].billingInterval` - Billing interval (e.g., "monthly", "yearly") (Text)
* `updateItems[].oldPrice` - Previous price (formatted)
* `updateItems[].newPrice` - New price (formatted)

## Usage Examples

### Simple Variable Access

```
Hello {{ customer.firstName }} {{ customer.lastName }},

Your invoice {{ invoice.number }} for {{ invoice.totalGrossAmount }} is due.
```

### Nested Properties

```
Payment Method: {{ invoice.paymentMethod.displayName }}

{% if invoice.paymentMethod.card %}
Card Number: ****{{ invoice.paymentMethod.card.lastFour }}
Expiration Date: {{ invoice.paymentMethod.card.expirationDate }}
{% endif %}
```

### Date Formatting

Dates are automatically formatted based on the language:

* German (`de`): `d.m.Y` (e.g., `31.12.2024`)
* English (`en`): `m/d/Y` (e.g., `12/31/2024`)

Date/time is formatted as:

* German (`de`): `d.m.Y H:i` (e.g., `31.12.2024 14:30`)
* English (`en`): `m/d/Y h:i A` (e.g., `12/31/2024 02:30 PM`)

```
Due Date: {{ invoice.dueDate }}
Paid On: {{ transaction.paidAt }}
```

### Array Iteration

```
{% for item in updateItems %}
Subscription: {{ item.subscriptionName }} ({{ item.subscriptionNumber }})
Old Price: {{ item.oldPrice }} / {{ item.billingInterval }}
New Price: {{ item.newPrice }} / {{ item.billingInterval }}
Effective From: {{ item.applyOn }}
{% endfor %}
```

### Conditional Access

```
{% if invoice.paymentMethod %}
Payment Method: {{ invoice.paymentMethod.displayName }}
{% endif %}

{% if transaction.failReason %}
Failure Reason: {{ transaction.failReason }}
{% endif %}
```

## API Access

You can programmatically retrieve all available variables via the API:

```
GET /ui/notification-template-variables?notificationType=invoice.finalized
```

This returns a JSON response with all variables grouped by categories, including labels, types, and descriptions.
