Skip to main content

Email Templates Variables

Sending custom emails are an essential part of running a software business. Customers expect emails in their language and with the correct branding. BillaBear allows you to do this by allowing you to define email templates for a brand and locale.

Template Types

BillaBear integrates with SendGrid, Mailgun, and Postmark email service providers and allows you to use their template system. When using this you must give the template id given by the email service provider.

If you use BillaBear's template system instead, it's powered by the template language Twig.

Fallback Order

BillaBear has a fallback order for email templates, so if there is no specific template for a locale and brand then it'll look for a fallback.

  1. It looks for Locale and Brand.
  2. Then it looks for Default Locale and Brand.
  3. Then it looks for Default Locale and Default Brand
  4. Then it throws an error

Template Variables

In the templates the following variables are defined.

General

Variables that are available in all emails templates.

NameDescriptionExample
brand.nameName of the brandBilaBear
brand.tax_numberThe tax number for the brand/companuGB45j5jf9
brand.address.company_nameThe name of the company in the addressHumbly Arrogant Software Limited
brand.address.street_line_oneThe first line of the address1 Example Way
brand.address.street_line_twoThe second line of the address
brand.address.cityThe city for the addressExampleville
brand.address.regionThe region/state for the addressRenfrewshire
brand.address.countryThe country code for the addressGB
brand.address.postcodeThe post code for the addressPA5 1ND
customer.nameThe name of the customerExample User
customer.emailThe email for the customeriain.cambridge@example.org

Subscription Created

All variables described in general are available as well as the ones described below.

NameDescriptionExample
subscription.plan_nameThe plan name for the subscriptionIntro
subscription.has_trialA boolean, true or false, value for if the subscription has a trialtrue
subscription.trial_lengthThe number of days the trial lasts7
subscription.payment_scheduleThe payment schedule for the subscription - week, month, yearmonth
subscription.amountThe amount that the subscription costs per payment schedule10.00 EUR
subscription.next_payment_dueThe due date for the next payment2021-01-03T02:30:00+01:00

Subscription Cancelled

All variables described in general are available as well as the ones described below.

NameDescriptionExample
subscription.plan_nameThe plan name for the subscriptionIntro
subscription.finsihes_atThe date when the plan finishes2021-01-03T02:30:00+01:00

Payment Created

All variables described in general are available as well as the ones described below.

NameDescriptionExample
payment.amountThe amount for the payment10.00 EUR
payment.currencyThe currency for the paymentEUR
payment.descriptionThe description for the paymentSubscription Payment
receipt.totalThe total amount for the receipt10.00 EUR
receipt.tax_totalThe VAT total amount for the receipt2.00 EUR
receipt.sub_totalThe sub total amount for the receipt8.00 EUR

Payment Card Expiring

All variables described in general are available as well as the ones described below.

NameDescriptionExample
payment_card.last_fourThe last four numbers of the card so the customer can identify the card42424
payment_card.expiry_monthThe month the card will expire in.10
payment_card.expiry_yearThe year the card will expire in.2023
voucher.has_voucherIf there is a voucher for adding a card during the expiry processtrue
voucher.typeIf it's a percentage voucher or a fixed amount of credit voucherpercentage
voucher.percentageThe percentage. Null if fixed amount10
voucher.amountThe amount if fixed credit1000
voucher.currencyThe currency for the voucherUSD

Payment Card Expiring - Day Before next payment attempt and card is still valid

All variables described in general are available as well as the ones described below.

NameDescriptionExample
payment_card.last_fourThe last four numbers of the card so the customer can identify the card42424
payment_card.expiry_monthThe month the card will expire in.10
payment_card.expiry_yearThe year the card will expire in.2023
subscription.plan_nameThe plan name for the subscriptionIntro
subscription.has_trialA boolean, true or false, value for if the subscription has a trialtrue
subscription.trial_lengthThe number of days the trial lasts7
subscription.payment_scheduleThe payment schedule for the subscription - week, month, yearmonth
subscription.amountThe amount that the subscription costs per payment schedule10.00 EUR
subscription.next_payment_dueThe due date for the next payment2021-01-03T02:30:00+01:00
voucher.has_voucherIf there is a voucher for adding a card during the expiry processtrue
voucher.typeIf it's a percentage voucher or a fixed amount of credit voucherpercentage
voucher.percentageThe percentage. Null if fixed amount10
voucher.amountThe amount if fixed credit1000
voucher.currencyThe currency for the voucherUSD

Payment Card Expiring - Day Before next payment attempt and has already card expired

All variables described in general are available as well as the ones described below.

NameDescriptionExample
payment_card.last_fourThe last four numbers of the card so the customer can identify the card42424
payment_card.expiry_monthThe month the card will expire in.10
payment_card.expiry_yearThe year the card will expire in.2023
subscription.plan_nameThe plan name for the subscriptionIntro
subscription.has_trialA boolean, true or false, value for if the subscription has a trialtrue
subscription.trial_lengthThe number of days the trial lasts7
subscription.payment_scheduleThe payment schedule for the subscription - week, month, yearmonth
subscription.amountThe amount that the subscription costs per payment schedule10.00 EUR
subscription.next_payment_dueThe due date for the next payment2021-01-03T02:30:00+01:00
voucher.has_voucherIf there is a voucher for adding a card during the expiry processtrue
voucher.typeIf it's a percentage voucher or a fixed amount of credit voucherpercentage
voucher.percentageThe percentage. Null if fixed amount10
voucher.amountThe amount if fixed credit1000
voucher.currencyThe currency for the voucherUSD

Invoice Created

NameDescriptionExample
invoice.totalThe total for the invoice1000
invoice.sub_totalThe sub total for the invoice800
invoice.tax_totalThe tax total for the invoice200
invoice.currencyThe currency for the invoiceEUR
invoice.due_dateThe due date for the invoice to be paid by2023-09-21 10:04:00.000
invoice.payee_address.company_nameThe name of the company in the addressHumbly Arrogant Software Limited
invoice.payee_address.street_line_oneThe first line of the address1 Example Way
invoice.payee_address.street_line_twoThe second line of the address
invoice.payee_address.cityThe city for the addressExampleville
invoice.payee_address.regionThe region/state for the addressRenfrewshire
invoice.payee_address.countryThe country code for the addressGB
invoice.payee_address.postcodeThe post code for the addressPA5 1ND
invoice.biller_address.company_nameThe name of the company in the addressHumbly Arrogant Software Limited
invoice.biller_address.street_line_oneThe first line of the address1 Example Way
invoice.biller_address.street_line_twoThe second line of the address
invoice.biller_address.cityThe city for the addressExampleville
invoice.biller_address.regionThe region/state for the addressRenfrewshire
invoice.biller_address.countryThe country code for the addressGB
invoice.biller_address.postcodeThe post code for the addressPA5 1ND
invoice.linesarray of lines[]
invoice.lines[0].totalTotal100
invoice.lines[0].sub_totalSub totals90
invoice.lines[0].tax_totalTax Total10
invoice.lines[0].tax_percentageThe Tax percentage9.0
invoice.lines[0].descriptionThe description for the lineAn example line