Mail Merge Usage 

Introduction 

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

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

Mail Merge fields are dependent 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 (i.e. 0 instead of $0.00, 999 instead of $9.99).

You can add mail merge fields as a part of your configuration to populate the 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, then the content inside the block will be displayed. '#' indicates that the condition to be checked has to 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, then the content entered within the block is displayed, like plan name, addon name, etc. Else it will be ignored.

    {{#plan.name = basic}}
    Since you are in basic plan you have only email support.
    {{/plan.name = basic}}

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 has to 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 string refers to values, like subscription statuses (active, canceled, trial…), invoice statuses (paid, not paid…), etc.

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 the 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?
Loading…