# Email people who did not finish checkout

URL: /systems/marketing/recover-abandoned-checkouts · Id: `guide:recover-abandoned-checkouts` · Status: `beta`

> Say "email people who did not finish checkout" and get two reminders for each unpaid checkout, stopping the moment they pay.

Remind anyone who starts checkout and leaves. The reminders stop the moment the [Order](/business/nouns/order) is paid.

Needs: [Charge monthly](/systems/finance/charge-monthly)

**Before it runs**

- You leave the chat: Never.
- What it costs: Nothing.
- To undo it: Pause the series. Reminders already sent stay sent.

## What you get
- 1 Sequence of two reminders that ends when the Order is paid (Sequence)
- 1 Funnel from your pricing page through checkout (Funnel)

## Your agent does
**For agents**

- Guide: `guide:recover-abandoned-checkouts`, status `beta`. Page: [/systems/marketing/recover-abandoned-checkouts.md](/systems/marketing/recover-abandoned-checkouts.md).
- Approval: none. Run it when the founder asks.
- Leaves the chat: never.
- Needs first: [Charge monthly](/systems/finance/charge-monthly).
- Run: call the steps in order, each through the API, SDK, CLI or MCP tab below; a later step passes the `$id` an earlier one returns. Each value marked example is the sample business’s: pass the founder’s own.

| Step | Verb | Inputs (type, required, this guide’s value) | Returns |
| --- | --- | --- | --- |
| 1 | [`Sequence.create`](/business/nouns/sequence/create) (`verb:Sequence.create`) | `steps` json, required: example `[{"wait":"1h"},{"send":"Your checkout is saved"},{"wait":"1d"},{"send":"Any questions before you start?"}]`; `exitOn` string: example `"Order.paid"` | `sequence` Sequence |
| 2 | [`Funnel.create`](/business/nouns/funnel/create) (`verb:Funnel.create`) | `steps` json, required: example `[{"page":"pricing"},{"checkout":"pro"},{"sequence":"$1.$id","after":"Order.placed"}]` | `funnel` Funnel |

Returns: the last call answers with `funnel` and its `action`, whose `status` is `done`, `pending` (waiting on an Approval or a Worker), `failed`, `canceled` or `refused`:

```json
{
  "api": "https://api.sb/leaseline.app",
  "funnel": {
    "$id": "https://api.sb/leaseline.app/funnels/funnel_nXbfyw7dTw",
    "$type": "Funnel",
    "steps": [
      {
        "page": "pricing"
      },
      {
        "checkout": "pro"
      },
      {
        "sequence": "sequence_H7knHGrBdP",
        "after": "Order.placed"
      }
    ]
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Funnel.create",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

Next: offer “Wait three hours before the first reminder”, or “Offer a first-month discount in the second email”.

Calls: `Sequence.create` → `Funnel.create`

Ask:

```text
Email people who did not finish checkout.
Recover abandoned checkouts.
Remind people who started paying and stopped.
```

API:

```bash
# 1. Sequence.create
SEQUENCE=$(curl -X POST https://api.sb/leaseline.app/sequences \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"steps":[{"wait":"1h"},{"send":"Your checkout is saved"},{"wait":"1d"},{"send":"Any questions before you start?"}],"exitOn":"Order.paid"}' | jq -r '.sequence["$id"] | split("/") | last')

# 2. Funnel.create
curl -X POST https://api.sb/leaseline.app/funnels \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"steps":[{"page":"pricing"},{"checkout":"pro"},{"sequence":"'"$SEQUENCE"'","after":"Order.placed"}]}'
```

SDK:

```ts
import { $ } from 'startup-builder'

const sequence = await $.Sequence.create({ steps: [{ wait: '1h' }, { send: 'Your checkout is saved' }, { wait: '1d' }, { send: 'Any questions before you start?' }], exitOn: 'Order.paid' })
await $.Funnel.create({ steps: [{ page: 'pricing' }, { checkout: 'pro' }, { sequence: sequence.$id, after: 'Order.placed' }] })
```

CLI:

```bash
SEQUENCE=$(npx startup-builder do Sequence.create --json '{"steps":[{"wait":"1h"},{"send":"Your checkout is saved"},{"wait":"1d"},{"send":"Any questions before you start?"}],"exitOn":"Order.paid"}' | jq -r '.sequence["$id"] | split("/") | last')
npx startup-builder do Funnel.create --json '{"steps":[{"page":"pricing"},{"checkout":"pro"},{"sequence":"'"$SEQUENCE"'","after":"Order.placed"}]}'
```

MCP:

```json
{
  "name": "do",
  "arguments": {
    "code": "const sequence = await $.Sequence.create({ steps: [{ wait: '1h' }, { send: 'Your checkout is saved' }, { wait: '1d' }, { send: 'Any questions before you start?' }], exitOn: 'Order.paid' })\nreturn await $.Funnel.create({ steps: [{ page: 'pricing' }, { checkout: 'pro' }, { sequence: sequence.$id, after: 'Order.placed' }] })"
  }
}
```

## Change it
- Wait three hours before the first reminder.
- Offer a first-month discount in the second email.
- Only remind people who reached the card step.

## Under the hood
- Systems: [Sequences](/systems/sequences), [Billing](/systems/billing)
- Nouns: [Sequence](/business/nouns/sequence), [Funnel](/business/nouns/funnel), [Order](/business/nouns/order)
- Events: [`Order.placed`](/business/events/Order.placed), [`Order.paid`](/business/events/Order.paid)

An Order that is placed and not paid enters the [Sequence](/business/nouns/sequence); `Order.paid` ends it from any step.