Email Templates

Under the Settings tab of your Chargify account are options related to sending automated emails from Chargify to your customers around certain subscription lifecycle events (e.g., post-signup, credit card dunning, upcoming renewal, etc.).

Chargify provides default templates for each of these emails, but you are free to edit them to fit your business’ needs. We expose a number of 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.

The following variables are available for signup, dunning, receipt, expiration, end of trial, and upcoming renewal emails:

Liquid Examples

Chargify has compiled a number of liquid examples Merchant’s usage in email templates. You may locate them here. If you have a suggestion for the example page, please let us know!

Legacy fields

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

Basic Fields

  • {{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 followed by the product name. e.g. Wonderful Products 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.g. $0.00 or $2.31
  • {{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

Subscription

  • {{subscription.id}} The subscription unique id within Chargify.
  • {{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 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, 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}} 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 Blling 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 Billing Portal
  • {{subscription.referral_code}} The referral code which can be appended to Public Signup Page URLs. See Referrals for more information.

Product

  • {{product.id}} The unique product id within Chargify
  • {{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 Chargify, 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 up front 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 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)

Customer

  • {{customer.id}} The unique customer id within Chargify
  • {{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 own 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.billing_portal?}} True/false indicating whether or not this customer is managed in Billing Portal
  • {{customer.portal_invite_sent?}} True/false value indicating whether or not the customer was emailed an invitation to manage their subscriptions in Billing Portal

Payment Profile

  • {{payment_profile.id}} The unique payment profile id within Chargify
  • {{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 it’s 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 informatio
  • {{payment_profile.billing_zip}} The zip code of the payment information
  • {{payment_profile.billing_country}} The country of the billing information
  • {{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
  • {{payment_profile.payment_method_masked_number}} The masked credit card or bank account number, depending on which is on file
  • {{payment_profile.masked_bank_account_number}} The customer’s bank account, obscured to show only the last 4 digits, e.g XXXXX1111
  • {{payment_profile.masked_bank_routing_number}} The customer’s bank routing number, obscured to show only the last 4 digits, e.g. XXXXX1234
  • {{payment_profile.bank_name}} The customer’s bank name
  • {{payment_profile.bank_account_type}} Either checking or savings
  • {{payment_profile.bank_account_holder_type}} Either personal or business
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. .

Payment (only for receipt emails)

  • {{payment.amount}} The amount just paid, formatted in your currency
  • {{payment.amount_in_cents}} The amount just paid, in cents
  • {{payment.card_expiration}}
  • {{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, or laser)
  • {{payment.memo}}
  • {{payment.success}} 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

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 %}

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.