Conversion

Abandoned checkout recovery email workflow

A 12-node Customer.io canvas rewritten as three steps: wait an hour, then sell the upgrade’s value to subscribers and send first-time buyers a reminder followed by a time-limited discount.

EmailPushtrigger.eventpayload refsdelaybranchrunflow()segmentsgoalreentry: after_exitcooldown
import { flow, trigger, workflow } from 'sendwend';
import { issueCoupon } from './actions';
import { e, u } from './contract';
import { activeSubscriber, purchaser } from './segments';
import { email, push } from './templates';

/**
 * The abandoned checkout: its payload says which plan was in the cart.
 */
const checkout = trigger.event(e.begin_checkout);

/**
 * Subscribers changing plan: what the upgrade adds, on two channels, no
 * discount.
 */
const upgrade = flow((w) =>
  w
    .push(push.checkoutReminder, {})
    .email(email.upgradeRecovery, { plan: u.subscription_plan })
);

/**
 * First purchase: a reminder without a discount, then a time-limited
 * offer a day later. The discount is held to the second email so people
 * are not taught to abandon checkout for a coupon.
 */
const firstPurchase = flow((w) =>
  w
    .email(email.checkoutReminder, { plan: checkout.payload.plan })
    .delay('23 hours')
    // Create the coupon in billing right before the email that carries
    // it.
    .run(issueCoupon, { code: 'SAVE15', email: u.email })
    .email(email.offer, { coupon: 'SAVE15', expiresIn: '48 hours' })
);

/**
 * Abandoned checkout recovery, ported from a Customer.io canvas of 12
 * nodes: a wait, three "purchased?" checks that each lead to an exit, a
 * subscriber split and the messages. Here it is three steps. The goal
 * replaces every "purchased? → exit" check: it is tested before each
 * step, ends the journey on a purchase and counts it as a conversion.
 *
 * `after_exit` with a 7-day cooldown: a user who abandons again later
 * is recovered again, but not more than once a week, and never while a
 * recovery is already running.
 */
export const abandonedCheckoutRecovery = workflow({
  id: 'abandoned_checkout_recovery',
  name: 'Abandoned checkout recovery',
  trigger: checkout,
  reentry: { mode: 'after_exit', cooldown: '7 days' },
  goal: purchaser,
})
  .delay('1 hour')
  .branch(
    'subscriber split',
    [activeSubscriber, upgrade],
    firstPurchase
  );
Compiled canvasDrag to pan

When to use it

When people start a checkout and leave without paying. Abandoned checkouts are among the warmest leads a product has: the user picked a plan and got as far as payment. A reminder answers the common reasons (distraction, a question, a card not at hand) without assuming the price was the problem.

How it works

  1. 1A begin_checkout event starts it; the payload carries the plan.
  2. 2It waits one hour.
  3. 3Subscribers changing plan get a push and an email about what the upgrade adds. No discount.
  4. 4First-time buyers get a reminder naming the plan, then, 23 hours later, a custom action creates a coupon and an email offers it for 48 hours.
  5. 5A purchase (the purchaser segment) is the goal. Checked before each step, it ends the journey for whoever buys.

Why it's built this way

Twelve nodes become three steps

The original canvas checked “purchased?” after the wait, after the first email and before the offer, each leading to its own exit. A goal replaces all of them: it is evaluated before every step, exits on match by default and records the conversion.

The discount waits for the second email

Offering a coupon in the first reminder teaches buyers that abandoning checkout pays. Holding it to the second email keeps it for people the reminder did not move.

Subscribers get value, not a coupon

An existing customer moving up a plan already pays; the email explains what changes, personalized with their current plan.

The coupon is created just in time

run(issueCoupon) creates the code in billing right before the email that carries it, inside a durable step that is retried on failure and passes an idempotency key.

Make it yours

  • Change the first delay: an hour suits a self-serve plan; a day suits a considered purchase.
  • Replace issueCoupon with your billing system’s API, keeping ctx.idempotencyKey.
  • Split the first-time arm with a cohort to test whether the discount is needed at all.
  • Raise the cooldown if your buyers often come back to checkout over several weeks.

What to measure

Recovered checkouts: the goal conversion rate, and how many conversions came after the discount email.

Also see Win-back email campaign with an escalating offer.