Blog

New feature: emails for Stripe's test mode

We've added a feature so that you can now test your automations using your Stripe account's test mode before you go live.

You don't need to do anything different with Stripe Connect – our one-click integration works just the same.

To send an email that will respond to test mode events, simply set the 'live/test mode' switch at the bottom of the automation editor to target test mode data. You can even target your test mode plans.

When you've finished testing an automation and you want to start sending emails to live customers, simply reset your plan targeting, flick the test mode switch to 'live', and you're away!

Getting started with 'Payment will fail' emails

Payment will fail emails (also known as 'pre-dunning' emails) are super-useful in preventing Stripe customers' payments from failing. These emails are sent a few days before a customer's subscription is due to renew, but where we already know that the card on file has past its expiry date.

Payment will fail emails only take a few minutes to set up with Onboard. So let's go through it!

We'll assume you've already created an account and connected your Stripe account. Here's a link If you need help connecting to Stripe.

Step 1

First, go to the automations page and select "New automation".

Step 2

Next, we need to change the Trigger to be "Payment will fail".

There are no Advanced options for this trigger, so we'll skip that.

Step 3

Editing the Email timing is optional, it's best to tweak this to suit your subscription length. In this example we're going to leave it at 14 days before. This will email the customer 14 days before their subscription would renew.

Step 4

Plan targeting is also optional, It allows you to target specific Stripe plans. In this example we want to target just my "Silver" subscriptions. So we'll modify the checkbox to select those only. By default "Any subscription plan" is selected.

Step 5

Update the email Subject line

Step 5

Add some Email content, first we click on "add email content"

Next, we're asked which type of email content we'd like to add. In this example we'll choose "Create standard email". This is the most user friendly content type - for those without experience with HTML.

We're now shown a text area to modify the default template, and a mobile/desktop preview of our email. In this example we're happy with the default template so it's safe to close this. Here's a link if you want to learn more about dynamic email content.

Step 6

Changing the Sender is optional, and in this example we're happy with what's default.

Step 7

Time to save our hard work! Click Save.

Step 8

Time to activate our email!

Step 9

Celebrate!

Dynamic content reference guide

Onboard uses Liquid markup, a powerful and flexible markup language, to render information stored in Stripe to your emails. We refer to the tags that render this dynamic content as 'Liquid tags' – but it's the same basic principle as 'merge tags', 'mail merge' and other such dynamic content methods.

You can use Liquid tags to render things such as a customer's name, their current subscription plan name or cost, the date their subscription renews and so on.

You can use Liquid tags to render (pretty much) anything stored in a Stripe customer object, subscription object or, if sending a payment receipt email, an invoice object.

Liquid tags can be used in the email body content as well as in subject lines.

Basics usage of Liquid tags

Let's look at a basic Liquid tag:

Dear {{ customer.name | default: 'customer' }},

This is a Liquid tag that renders the customer's name as stored on their Stripe customer object. For example, if the customer's name is stored as 'Joe' in Stripe, the tag above would output "Dear Joe,".

But what if some of your customer's don't have their name stored in Stripe? That's where the "default: 'customer'" part comes in. You can use this to set a fallback value to use in case a value is not found in Stripe. In our example above, this would output "Dear customer,".

In the example above, "name" is the name of a property on Stripe's customer object. We can use Liquid tags to output any property on that object, for example:

{{ customer.phone }}

{{ customer.email }}

...and so on. We can even output nested values (such as addresses) like this:

Dear {{ customer.name | default 'customer' }}, how is the weather in {{ customer.address.city }}?

Useful liquid tags

Customer name:
Dear {{ customer.name | default: ‘customer’ }},

Date current period ends:
Your subscription will renew on {{ subscription.current_period_end | date: “%b %d” }}.

Days until trial period ends:
Your trial ends in
{{ subscription.days_until_trial_end }} days.

Last 4 digits of card on file:
We'll charge the card ending in {{ customer.card.last4 }}.

Plan name:
Thanks for renewing your {{ subscription.plan.nickname }} subscription plan.

Plan amount:
Your subscription plan will renew for
{{ subscription.plan.amount | money: subscription.plan.currency }}.

(Note: the two above apply if the customer has only one plan attached to their current subscription – the default for most Stripe users. If you use a more complex subscription model, you will need to iterate over your subscription items.)

Sender name and email address:
This email was sent from {{sender.name}}. Reply to me on {{ sender.email }} if you have any further questions!

Tags for invoice receipt emails only

Invoice subtotal:
{{ invoice.subtotal | money : invoice.currency }}

Invoice tax:
{{ invoice.tax | money : invoice.currency }}

Total invoice discount:
{%if invoice.total_discount %}

Discount: -
{{ invoice.total_discount | money: invoice.currency }}
{% endif %}

Invoice total:
{{ invoice.total | money : invoice.currency }}

Date invoice was paid:
{{ invoice.status_transitions.paid_at | date: "%b %d %Y" }}

A more complex example: an invoice receipt template:

<p>Dear {{ customer.name | default: 'customer' }},
<p>Thank you for your recent payment.</p>
<p>Invoice receipt number is {{ invoice.receipt_number }}.</p>
<p>Date: {{ invoice.status_transitions.paid_at | date: "%b %d %Y" }}.</p>
<table>
  <thead>
    <tr>
      <th>Description</th>
      <th>Amount</th>
    </tr>
  </thead>
  <tbody>
    {% for line in invoice.lines.data %}
      <tr>
        <td>{{ line.description }}: renews on {{ line.period.end | date "%b %d %Y" }}</td>
        <td>{{ line.amount | money: invoice.currency }}</td>
      </tr>
    {% endfor %}
    {%if invoice.total_discount %}
      <tr>
        <td>Discount</td>
        <td>-{{ invoice.total_discount | money: invoice.currency }}</td>
      </tr>
    {% endif %}
    <tr>
      <td>Subtotal</td><td>{{ invoice.subtotal | money: invoice.currency }}</td>
    </tr>
    <tr>
      <td>Tax</td><td>{{ invoice.tax | money: invoice.currency }}</td>
    </tr>
    <tr>
      <td><strong>Total</strong></td><td><strong>{{ invoice.total | money: invoice.currency }}</strong></td>
    </tr>
  </tbody>
</table>

<p>Thank you for your business.</p>
<p>Best,</p>
<p>{{sender.name}}</p>