Docs

Log in to read the version of docs relevant to your site.

Mail Merge Usage

Introduction

Mail Merge fields can be used to personalize content in Chargebee while configuring:

  • Email Notifications
  • Checkout & Portal
  • Invoice & Credit Notes

Mail Merge fields depend on the template selected for a particular email. You can find the list of fields in the Chargebee application as shown below:

Note:

When currency mergevars are used in conditional statements, the amount should be specified in cents and as an integer (for example, 0 instead of $0.00, 999 instead of $9.99).

You can add mail merge fields as part of your configuration to populate values dynamically.

	 Your current plan is {{plan.name}}.

Result

Your current plan is Basic.

Display Content when Field has a Value

If the field contains a value, the content inside the block will be displayed. '#' indicates that the condition to be checked must be true. '/' indicates the end of the field block.

	Dear Customer,
    {{#plan.setup_cost}}
    Your setup cost is {{plan.setup_cost}}.
    {{/plan.setup_cost}}
    Thank you for your purchase.

Result

Dear Customer, Your setup cost is $12.50. Thank you for your purchase.

If the mail merge field does NOT contain a value, the content will be ignored.

	Dear Customer,
    {{#plan.setup_cost}}
    Your setup cost is {{plan.setup_cost}}.
    {{/plan.setup_cost}}
    Thank you for your purchase.

Result

Dear Customer, Thank you for your purchase.

Display Content when the Field Has a Specific Value

If the field contains a value, the content entered within the block is displayed, such as plan name, addon name, etc. Otherwise, it will be ignored.

	{{#plan.id = BASIC-USD-Monthly}}
	Since you are in basic plan you have only email support.
	{{/plan.id = BASIC-USD-Monthly}}

Result

Since you are in basic plan you have only email support.

Display Content when the Field Does not Have a Specific Value

If the field is empty or does not have a specific value, the content entered within the block is displayed. '^' indicates that the condition specified must be false.

SAMPLE #1

	{{^customer.company}}
    You have not provided the company name
    {{/customer.company}}
    Thank you for your purchase.

Result

You have not provided the company name Thank you for your purchase.

SAMPLE #2

To display content when field does not have the specified value:

	{{^plan.name = enterprise}}
    Upgrade to the enterprise plan and enjoy 24/7 phone support.
    {{/plan.name = enterprise}}

Result

Upgrade to the enterprise plan and enjoy 24/7 phone support.

Enumerated String

Enumerated strings refer to values like subscription statuses (active, canceled, trial, etc.), invoice statuses (paid, not paid, etc.), and more.

SAMPLE #1

	{{#card.status = expiring}}
    Your card is about to expire.
    {{/card.status = expiring}}

Result

Your card is about to expire.

SAMPLE #2

Using an enumerated string with a false condition:

	{{^invoice.status = paid}}
    You have an outstanding invoice.
    {{/invoice.status = paid}}

Result

You have an outstanding invoice.

List Values

Used to display a list of items (objects that may have multiple entries in the subscription), such as addons, coupons, etc.

	{{#addons}}
    Addon Name : {{addon.name}}
    Addon Price : {{addon.price}}
    {{/addons}}

Result

Addon Name : Support Plan Addon Price : $9.99 Addon Name : License Addon Price : $19.99

Reformat Date and Time Values

You can use 'format' and 'timezone' attributes along with timestamp fields, such as subscription.trial_end, to change the default format of the date and time or convert it to a specific timezone. Click here for more details.

SAMPLE #1

	You signed up for your subscription on
    {{ subscription.created_at | format : dd-MMM-yyyy hh:mm:ss z }}

Result

You signed up for your subscription on 14-May-2016 11:07:00 UTC

SAMPLE #2

	Your subscription was activated on
    {{ subscription.activated_at | timezone: EST }} 

Result

Your subscription was activated on 14-May-2016 06:07:00

SAMPLE #3

	Your trial ends on
    {{ subscription.trial_end | format : dd-MMM-yyyy hh:mm:ss z | timezone: EST }}

Result

Your trial ends on 14-May-2016 06:07:00 EST

Was this article helpful?