Email Templates

Advanced Billing lets you customize emails for specific events that take place within a subscription’s lifetime. To get you started, we provide default templates for each of these emails. You’re free to edit them to fit your needs with the dynamic variables below. We expose these variables for you to use in each email template. Variables must be quoted in double braces, such as {{product.name}}.

The syntax used in the email templates is called “Liquid”. The Liquid for Designers wiki page provides a good overview and many examples, including If / Else for conditional logic.

At this time, it’s not possible to pull in the following information via Liquid in an email template:

  • Component information
  • Tax charges and tax rates
  • For European merchants subject to PSD2 – a link to the 3DSecure authentication page

Liquid Examples

Advanced Billing has compiled several liquid examples that merchants can select from when creating email templates. You may locate them here.

These templates are incredibly helpful if you’d like to construct emails of the following nature:

If you have a suggestion for the example page, please let us know!

If you'd like to revert to the original email templates associated with your site, please use the resource at the bottom of this page. We've published a collection of email templates as a backup for your sites. Please see the linked section of the documentation for more information.

 

Legacy fields

  • {{return_url}} Do not use
  • {{product.return_url}} Do not use
  • {{product.return_params}} Do not use

Basic Fields

Email Field Description
{{from_address}} This will be replaced with acme-inc@example.com if left as {{from_address}} though any valid email address will do.
{{name}} The name of your customer. e.g. Bill Williams
{{full_name}} The name of your customer. e.g. Bill Williams
{{product_price}} The recurring price of the subscription’s current product
{{product_name}} The name of the product. e.g. Basic Plan
{{product_family}} The name of the product family e.g. Wonderful Products
{{product_family_and_name}} The product family name is surrounded by parenthesis, followed by the product name. e.g. (Wonderful Product Family) Basic Plan
{{balance_in_cents}} The amount, if any, they still owe. e.g. 0 (for $0.00) or 23100 (for $231.00) Useful for conditionally adding a reminder.
{{balance}} the amount, if any, they still owe in dollars. e.
{{merchant_name}} Your merchant name. e.g. Acme, Inc.
{{masked_card_number}} The masked credit card number. eg XXXX-XXXX-XXXX-1
{{update_url}} The self-service URL for the subscription

Billing Portal

You can inform your subscribers via email of the direct links needed to perform certain tasks in the Billing Portal. Use the following URLs in any of the emails, under settings, to link a subscriber to a specific location to perform any of the tasks below. Please be aware that you must have the Billing Portal enabled to create valid URLs.

Cancel my account

https://www.billingportal.com/s/[your_subdomain]/subscriptions/{{subscription.id}}/cancel

Configure your plan

https://www.billingportal.com/s/[your_subdomain]/subscriptions/{{subscription.id}}/components

Plan change

https://www.billingportal.com/s/[your_subdomain]/subscriptions/{{subscription.id}}/migrations/new

Update payment method

https://www.billingportal.com/s/[your_subdomain]/subscriptions/{{subscription.id}}/payment_method/edit

View my account

https://www.billingportal.com/s/[your_subdomain]/accounts/{{customer.id}}/edit

Custom Fields (Metadata)

Custom fields can be accessed in email templates with a Liquid filter:

{{ subscription | custom_field: "Color" }}

where “Color” is the name of the custom field.

Custom field values can be used in conditionals by capturing the filtered value as a named variable and then using it later:

{% capture gift_wrap %}{{ subscription | custom_field: "Gift wrap?" }}{% endcapture %}
{% if gift_wrap == "" %} ... {% endif %}
The "capture" action must coexist on the same line as the custom field you'd like to capture a value from in the email/logic.

 

Customer

Email Field Description
{{customer.id}} The unique customer id within Advanced Billing
{{customer.first_name}} The customer’s first name
{{customer.last_name}} The customer’s last name
{{customer.email}} The email address of the customer
{{customer.organization}} The customer’s organization
{{customer.reference}} The unique identifier used within your application for this customer
{{customer.created_at}} Timestamp for when the customer was created
{{customer.address}} The shipping address for the customer
{{customer.address_2}} Additional shipping information for the customer
{{customer.city}} The customer’s city information
{{customer.state}} The customer’s state information
{{customer.zip}} The zip code of the customer
{{customer.country}} The country of the customer
{{customer.phone}} The customer’s phone number
{{customer.locale}} The customer’s language settings. Locale value is only available in invoice-centric sites.
{{customer.billing_portal?}} True/false indicating whether or not this customer is managed in the billing portal
{{customer.portal_invite_sent?}} True/false value indicating whether or not the customer was emailed an invitation to manage their subscriptions in the billing portal

Dunning Fields

Advanced Billing has created a specific set of dunning-related email variables for usage only in dunning Emails. We house these under the section titled Customizing your Dunning Emails

Payment (only for receipt emails)

Please be aware that these fields should only be used within the receipt email. Utilizing them in other templates will likely cause each of these variables to return unexpected values.

Email Field Description
{{payment.amount}} The amount just paid, formatted in your currency
{{payment.amount_in_cents}} The amount just paid, in cents
{{payment.card_expiration}} The expiration date of the card
{{payment.card_number}} The customer’s credit card, obscured to only show the last 4 digits. e.g. XXXX-XXXX-XXXX-1234
{{payment.card_type}} The type of card used (bogus, visa, master, discover, american_express, diners_club, JCB, switch, solo, dankort, maestro, forbrugsforeningen, laser)
{{payment.memo}} The memo is associated with the transaction.
{{payment.success}} True/false value indicated whether or not the payment was a test.True/false value indicated whether or not the payment was successful.
{{payment.test}} True/false value indicated whether or not the payment was a test.
{{payment.gateway_transaction_id}} The transaction id from the gateway

Payment Profile

Email Field Description
{{payment_profile.id}} The unique payment profile id within Advanced Billing
{{payment_profile.first_name}} The first name on the customer’s payment information
{{payment_profile.last_name}} The last name of the customer’s payment information
{{payment_profile.masked_card_number}} The customer’s credit card, obscured to only show the last 4 digits. e.g. XXXX-XXXX-XXXX-1234
{{payment_profile.card_type}} The type of card used (bogus, visa, master, discover, american_express, diners_club, JCB, switch, solo, dankort, maestro, forbrugsforeningen, or laser)
{{payment_profile.brand}} The type of card used with its correct spelling (Bogus, Visa, Master, …)
{{payment_profile.billing_address}} The billing address for the payment profile
{{payment_profile.billing_address_2}} Additional billing information for the payment profile
{{payment_profile.billing_city}} The billing city for the payment information
{{payment_profile.billing_state}} The billing state for the payment information
{{payment_profile.billing_zip}} The zip code of the payment information
{{payment_profile.billing_country}} The country of the billing information
{{payment_profile_exists}} True or false indicating whether or not a valid payment method is on file for the subscription
{{payment_profile.expiration_month}} Expiration month of the credit card on file
{{payment_profile.expiration_year}} Expiration year of the credit card on file
{{payment_profile.payment_method_type}} Either card or bank account
Note: If you intend to use credit card-specific fields (like masked_card_number), be sure to wrap those sections of your email template in a {% if subscription.card_on_file? %}...{% endif %} block, to ensure you only use those fields when the payment profile is a credit card. You can use the same technique when calling bank account-specific fields by using the {% if subscription.bank_account_on_file? %}...{% endif %} block.


Product

Each reference to product represents the product price point your customer is subscribed to.

Email Field Description
{{product.id}} The unique product id within Advanced Billing
{{product.name}} The product name
{{product.handle}} The product API handle
{{product.description}} The product description
{{product.accounting_code}} The product family accounting code (has no bearing in Advanced Billing, may be used within your app)
{{product.price_in_cents}} The product price, in integer cents
{{product.initial_charge?}} True/false indicating whether or not the product has an initial charge
{{product.initial_charge_in_cents}} The upfront charge you have specified
{{product.expires?}} True/false indicating whether or not the product expires
{{product.offers_trial?}} True/false indicating whether or not the product offers a trial price
{{product.trial_price_in_cents}} The product trial price, in integer cents
{{product.update_return_url}} The URL a buyer is returned to after a successful account update. See the section on product Return URLs and Parameters
{{product.update_return_params}} The parameters string we will use in constructing your return URL. See the section on Product Return URLs and Parameters
{{product.request_credit_card?}} True/false indicating whether or not the product requests a credit card at signup
{{product.require_credit_card?}} True/false indicating whether or not the product requires a credit card at signup
{{product.archived?}} True/false indicating whether or not the product is currently archived
{{product.archived_at}} Timestamp for when the product was archived (if it was)
{{product.currency}} The product-currency
{{product.price}} The product price, formatted in the product currency
{{product.initial_charge}} The initial charge, formatted in the product currency
{{product.trial_price}} The trial price, formatted in the product currency
{{product.recurring_duration}} The length of one renewal period (e.g. 30 days, 1 year, etc.)
{{product.expiration_duration}} The length of time before the product expires (if it does)
{{product.trial_duration}} The length of the product trial (if there is one)


Relationship Invoicing Emails

The following email templates are for use at the Relationship Invoicing sites only. To view the email template options for legacy invoices, please use the email templates located here.


Invoice (only for Invoice emails)
For Invoice emails, only the following email fields can be included:

Email Field Description
{{invoice.billing_address.city}} Billing address city
{{invoice.billing_address.country}} Billing address country
{{invoice.billing_address.state}} Billing address state
{{invoice.billing_address.street}} Billing street address
{{invoice.billing_address.line2}} Billing street address line 2
{{invoice.billing_address.zip}} Billing zip code / postal address
{{invoice.collection_method}} The collection method for the payment of the subscription. Can be automatic or remittance.
{{invoice.created_at}} Date the invoice was created
{{invoice.currency}} Currency of the invoice
{{invoice.customer.email}} Customer email
{{invoice.customer.first_name}} Customer-first name
{{invoice.customer.name}} Customer full name
{{invoice.customer.last_name}} Customer last name
{{invoice.customer.organization}} Customer organization
{{invoice.customer.locale}} Customer language settings
{{invoice.discount_amount}} Discount amount (if any) applied to the invoice
{{invoice.due_amount}} Amount due of the invoice
{{invoice.due_date}} Due date of the invoice
{{invoice.id}} Unique ID of the invoice displayed in URL
{{invoice.number}} Customer-facing number of the invoice
{{invoice.issue_date}} Issue date of the invoice
{{invoice.memo}} Invoice memo
{{invoice.paid_amount}} Amount of payments made against the invoice
{{invoice.paid_date}} Date the invoice was paid in full
{{invoice.recipient_emails}} Any email-based recipients of the invoice
{{invoice.seller.name}} Seller name of the Advanced Billing account
{{invoice.seller.phone}} Seller phone number of the Advanced Billing account
{{invoice.site_id}} Site ID that contains the associated invoice
{{invoice.shipping_address.city}} Shipping address city
{{invoice.shipping_address.country}} Shipping address country
{{invoice.shipping_address.street}} Shipping address
{{invoice.shipping_address.line2}} Shipping address line 2
{{invoice.shipping_address.state}} Shipping address state
{{invoice.status}} Current status of the invoice
{{invoice.subscription_id}} Subscription ID associated with the invoice
{{invoice.subscription_reference}} Unique Subscription reference number; typically populated with a merchant-side ID for quick reference.
{{invoice.subtotal_amount}} Subtotal of the invoice
{{invoice.tax_amount}} Tax amount applied to the invoice
{{invoice.terms}} Terms of the invoice
{{invoice.total_amount}} Total amount due of the invoice
{{invoice.transaction_time}} Time of the generation of the line items associated with the current on-demand invoice
{{invoice.updated_at}} Date (if any) the invoice was updated at
{{invoice.url}} URL of the current invoice

Statements

Depending on which architecture you are using, statement emails may not be available. You may use email templates in statements. However, if you've enabled the billing portal, the liquid syntax you use in your statements will not display properly; liquid syntax will not render in the billing portal.

We consider the usage of liquid syntax in statements as edge-case-usage. You’re welcome to use them sparingly, but we must stress that the formatting of statements does not lend itself to this delivery method.

As an alternative, please use liquid syntax in emails to your subscribers.

Subscription

Email Field Description
{{subscription.id}} The subscription unique id within Advanced Billing.
{{subscription.state}} The current state of the subscription. Please see the documentation for subscription states
{{subscription.balance_in_cents}} Gives the current outstanding subscription balance in the number of cents
{{subscription.current_period_started_at}} Timestamp relating to the start of the current (recurring) period
{{subscription.current_period_starts_at}} Timestamp relating to the start of the current (recurring) period
{{subscription.current_period_ends_at}} Timestamp relating to the end of the current (recurring) period (i.e. when the next regularly scheduled attempted charge will occur)
{{subscription.trial_started_at}} Timestamp for when the trial period (if any) began
{{subscription.trial_ended_at}} Timestamp for when the trial period (if any) ended
{{subscription.trial_ends_at}} Timestamp for when the trial period (if any) ended
{{subscription.activated_at}} (Read-Only) Timestamp for when the subscription began (i.e. when it came out of a trial, or when it began in the case of no trial)
{{subscription.expires_at}} Timestamp giving the expiration date of this subscription (if any)
{{subscription.cancellation_message}} Seller-provided reason for, or note about, the cancellation
{{subscription.canceled_at}} Timestamp for when the subscription canceled (if it did)
{{subscription.cancel_at_end_of_period}} Whether or not the subscription will (or has) canceled at the end of the period
{{subscription.payment_collection_method}} The type of payment collection to be used in the subscription. May be automatic, remittance, or invoice.
{{subscription.coupon_code}} The coupon code of the coupon currently applied to the subscription (if any)
{{subscription.total_revenue_in_cents}} Gives the total revenue from the subscription in the number of cents.
{{subscription.estimated_renewal_amount_in_cents}} The estimated amount of the next renewal, in cents
{{subscription.current_billing_amount_in_cents}} The balance_in_cents + the estimated_renewal_amount_in_cents
{{subscription.expires_at_end_of_period?}} True/false value indicating whether or not the subscription expires at the end of the current period
{{subscription.total_revenue}} Gives the total revenue from the subscription in the number of cents.
{{subscription.estimated_renewal_amount}} The estimated_renewal_amount_in_cents, formatted in the currency of the subscription
{{subscription.current_billing_amount}} The current_billing_amount_in_cents, formatted in the currency of the subscription
{{subscription.payment_method_on_file?}} True/false value indicating whether or not there is a payment_profile present
{{subscription.card_on_file?}} True/false value indicating whether or not the payment_profile is a credit card
{{subscription.bank_account_on_file?}} True/false value indicating whether or not the payment_profile is a bank account
{{subscription.billing_portal?}} True/false value indicating whether or not this customer is managed in the billing portal
{{subscription.billing_portal_management_url}} The billing portal subscription management URL for this subscription, if billing portal is enabled
{{subscription.portal_invite_sent?}} True/false value indicating whether or not the customer was emailed an invitation to manage their subscriptions in the billing portal
{{subscription.referral_code}} The referral code can be appended to Public Signup Page URLs. See Referrals for more information.
{{subscription.require_introductory_offer_trial_information?}} True/false value indicates whether or not the subscription is during an introductory offer period. See Trialing Subscriptions - Introductory Offers
{{subscription.introductory_offer_period_length}} The length of the introductory offer trial period.
{{subscription.introductory_offer_ends_at}} Estimated end of the introductory offer trial period.
{{subscription.introductory_offer_estimated_renewal_amount}} The estimated amount of the first subsequent transaction after the end of the introductory offer trial period.

Direct Debit Instruction

Note: Direct Debit Instruction email templates support only the following Liquid variables:
  • all Direct Debit Instruction variables,
  • all Customer variables,
  • all Payment Profile variables,
  • some Basic variables: from_addressnamefull_namemerchant_namemasked_card_number.

 

Email Field Description
{{direct_debit.creditor_name}} Creditor’s name
{{direct_debit.scheme_identifier_reference}} Scheme identifier reference
{{direct_debit.scheme_identifier_name}} Scheme identifier name
{{direct_debit.bank_name}} Bank name
{{direct_debit.masked_bank_branch_code}} Masked bank branch code
{{direct_debit.mandate_url}} URL to the GoCardless mandate in the PDF form

 

Test Data

Custom fields are not available in the test data when editing an email template. Instead, you will see placeholder text in the email preview, for example:

[PLACEHOLDER: The value of "Color" on the Subscription will be included in the real email.]

If you misspell the name of the custom field, you will see a warning such as:

WARNING: The custom field "Gift warp?" does not exist for Subscriptions. This will always be blank in a real email.]

To see how your email will look with different values for the custom fields, we suggest creating subscriptions in a site that is in test mode, using your own email address so that you will receive the email.

For more information on test data, please see the following documentation on how to configure preview emails.


Backup Email Templates

Below is a collection of our standard email templates for all communications to subscribers. Please feel free to use these if you’d like to revert to the original emails that ship with new sites.

Cancellation Emails

Hello {{name}},

We're sorry to see you go!

Per your request, your subscription to {{product_name}} was canceled on {{subscription.canceled_at | date:'%d %B %Y'}}.

If you did not request cancellation and this message is being received in error, please contact us to reactivate.

If you have any additional questions or need assistance, please let us know.

Thank you,

{{merchant_name}}

Card Expiration Emails

Dear {{name}},

Your credit card {{masked_card_number}} is set to expire in {{days_until_card_expiration}} day(s).

Please visit {{update_url}} to update your card.

Cheers,
{{merchant_name}}

End of Trial Emails

Dear {{name}},

Your trial period for {{product.name}} will end on {{subscription.current_period_ends_at | date:'%d %B %Y'}}
at around {{subscription.current_period_ends_at | date:'%H:%M %Z'}}.

{% if subscription.payment_method_on_file? %}Your {{payment_profile.payment_method_type}} {{payment_profile.payment_method_masked_number}} will be charged for the estimated amount due of {{subscription.current_billing_amount}}.
(The estimated amount does not include any add-on or overage charges that may be added between now and renewal.)
From now on, the regular price for {{product.name}} will be {{product.price}} per {{product.recurring_duration}}.

{% else %}In order to continue uninterrupted service, please add a card to your subscription so we will be able process the estimated amount due of {{subscription.current_billing_amount}}.
(The estimated amount does not include any add-on or overage charges that may be added between now and renewal):
{% if subscription.billing_portal? %}{{subscription.billing_portal_management_url}}.
{% else %}{{update_url}}.
{% endif %}
From now on, the regular price for {{product.name}} will be {{product.price}} per {{product.recurring_duration}}.
{% endif %}
{% if subscription.billing_portal? %}If you’d like to cancel your subscription or make a change to your billing information, please visit:
{{subscription.billing_portal_management_url}}
{% else %}Please email us if you'd like to cancel your subscription.
{% endif %}
Thanks!
{{merchant_name}}

Invoice - Automatic

Dear {{invoice.customer.name}},

A new invoice for your {{invoice.seller.name}} account is now available.

**Invoice Number:** {{ invoice.number }}<br>
**Issue Date:** {{ invoice.issue_date }}<br>
**Total:** {{ invoice.total_amount | format_currency: invoice.currency }}<br>
**Due:** {{ invoice.due_amount | format_currency: invoice.currency }}<br>

View Invoice: <{{invoice.url}}>

Thank you,

{{invoice.seller.name}}

Invoice - Remittance / Manual

Dear {{invoice.customer.name}},

A new invoice for your {{invoice.seller.name}} account is now available. {{ invoice.due_amount | format_currency: invoice.currency }} is now due.

{{invoice.url}}

Thank you,

{{invoice.seller.name}}

Receipt Email

Dear {{name}}

You were just charged {{payment.amount}} for {{product_name}}.

{% if balance_in_cents > 0 %}
The outstanding amount for your subscription is {{balance}}.
{% endif %}

{% if subscription.require_introductory_offer_trial_information? %}
The trial period length  of your subscription is {{ subscription.introductory_offer_period_length }} and ends at: {{ subscription.introductory_offer_ends_at }}.

The first subsequent transaction for estimated amount of {{ subscription.introductory_offer_estimated_renewal_amount }} will take place on {{ subscription.introductory_offer_ends_at }}.

{% if subscription.billing_portal? %}
If you’d like to cancel your subscription or make a change to your billing information, please visit:
{{subscription.billing_portal_management_url}}
{% else %}
Please email us if you'd like to cancel your subscription.
{% endif %}
{% endif %}

Cheers,
{{merchant_name}}

Signup Email

Hello {{name}},

You've signed up for {{product_family}} ({{product_name}}).
{% if product.update_return_url %}
Now that you're all signed up, head over to {{product.update_return_url}}.
{% endif %}

{% if subscription.require_introductory_offer_trial_information? %}
The trial period length  of your subscription is {{ subscription.introductory_offer_period_length }} and ends at: {{ subscription.introductory_offer_ends_at }}.

The first subsequent transaction for estimated amount of {{ subscription.introductory_offer_estimated_renewal_amount }} will take place on {{ subscription.introductory_offer_ends_at }}.

{% if subscription.billing_portal? %}
If you’d like to cancel your subscription or make a change to your billing information, please visit:
{{subscription.billing_portal_management_url}}
{% else %}
Please email us if you'd like to cancel your subscription.
{% endif %}
{% endif %}

Thanks,
{{merchant_name}}

Upcoming Renewal Emails

Dear {{name}},

{% if subscription.expires_at_end_of_period? %}Your subscription to {{product.name}} will expire on {{subscription.current_period_ends_at | date:'%d %B %Y'}}
at around {{subscription.current_period_ends_at | date:'%H:%M %Z'}}. You will not be billed again for this subscription.
{% else %}Your subscription to {{product.name}} will renew on {{subscription.current_period_ends_at | date:'%d %B %Y'}}
at around {{subscription.current_period_ends_at | date:'%H:%M %Z'}}.

{% if subscription.payment_method_on_file? %}Your {{payment_profile.payment_method_type}} {{payment_profile.payment_method_masked_number}} will be charged for the estimated amount due of {{subscription.current_billing_amount}}.
(The estimated amount does not include any add-on or overage charges that may be added between now and renewal.)

If you need to make a change to your billing information, please visit: {% if subscription.billing_portal? %}
{{subscription.billing_portal_management_url}}{% else %}
{{update_url}}{% endif %}

{% else %}In order to continue uninterrupted service, please add a card to your subscription: {% if subscription.billing_portal? %}
{{subscription.billing_portal_management_url}}{% else %}
{{update_url}}{% endif %}
{% endif %}{% endif %}
Thanks!
{{merchant_name}}

Update Payment Request Emails

Dear {{name}},

{% if subscription.payment_method_on_file? %}

You may wish to update the {% if subscription.card_on_file? %}credit card{% elsif subscription.bank_account_on_file? %}bank account{% else %}paypal account{% endif %} on file for your account with us, either to make a payment or to replace the {% if subscription.card_on_file? %}credit card{% elsif subscription.bank_account_on_file? %}bank account{% else %}paypal account{% endif %} to which future payments will be processed. Kindly click on the following secure link to edit the details:

{{update_url}}

{% else %}

You currently do not have valid payment information on file with us. Kindly click on the following secure link to update your payment information:

{{update_url}}

{% endif %}

Thank you for your business.

{{merchant_name}}

Direct Debit Instruction Emails

Hi {{payment_profile.first_name}} {{payment_profile.last_name}},

**Important**: confirmation of the setup of your Direct Debit Instruction to {{direct_debit.creditor_name}}.

**{{direct_debit.creditor_name}} {{direct_debit.scheme_identifier_reference}} can now collect payments from you by Direct Debit.**

We will notify you via email at least 2 working days in advance of any changes to your payment date or amount.

---

Payments will be debited from your bank account {{payment_profile.masked_bank_routing_number}}-{{direct_debit.masked_bank_branch_code}}-{{payment_profile.masked_bank_account_number}}
  ({{direct_debit.bank_name}}) via Direct Debit, and will appear on your bank statement as {{direct_debit.scheme_identifier_name | escape }}.

**Please check the details above - if they are incorrect or there are any other issues with the Direct Debit, please contact {{merchant_name}}.**

View your Direct Debit Instructions and terms & conditions: [Click here to view your mandate]({{direct_debit.mandate_url}}).

Thank you,

{{merchant_name}}

Prepaid Subscription Payment Receipt Emails

Dear {{name}}

You were just charged {{payment.amount}} for {{product_name}}.

The balance of funds on your subscription is now {{subscription.current_account_balance}}.

Cheers,

{{merchant_name}}

Suspended Prepaid Subscription Emails

Dear {{name}},

The balance for your {{product_name}} subscription has reached zero. Because of this, your subscription has been suspended.

Cheers,

{{merchant_name}}

Reactivated Prepaid Subscription Emails

Dear {{ name }}

The balance for your {{ product_name }} subscription has been replenished to {{ subscription.current_account_balance }} and your subscription has been reactivated.

Thank you for your business,

{{ merchant_name }}
Was this article helpful?
0 out of 0 found this helpful