# Validate Emails of ThriveCart Buyers: Setup Guide

URL: https://email-validation.org/docs/guides/thrivecart/
Updated: 2026-12-05

> Documentation index: https://email-validation.org/llms.txt

Check the buyer's email address of each new ThriveCart order. One TypeScript file with no dependencies, on your own
server, receives your ThriveCart webhook, checks the token in its URL and ThriveCart's secret word, checks the buyer's
address and reports the answer to your code with ThriveCart's order and customer ids (never the address). An order
whose address cannot receive mail reaches you right after the sale, before its receipts, course access mails and
dunning mails bounce. By default only a definite `invalid` is flagged.

**It reports; it cannot block a checkout.** ThriveCart runs nothing of yours before it takes an order: its webhooks
are sent after the event, so the order already exists when the receiver hears of it.

**It cannot flag a ThriveCart order or customer.** ThriveCart's API has no tag, note or custom field to write a verdict
into, so the answer goes only to your `onResult` code: log it, forward it to your own system (your CRM, a sheet, a mail
to your team) or act on the order yourself. The receiver takes no ThriveCart key and never calls ThriveCart, and it
never refunds or changes an order.

**Status: set up from this page.** There is no ThriveCart app listing: you run the file on your server and add it as a
webhook in your ThriveCart account. It has not yet been tried on a real ThriveCart account, so try it with a product
in test mode first.

Download it: [email-validation-thrivecart.zip](https://email-validation.org/downloads/thrivecart/email-validation-thrivecart.zip) holds the file
as TypeScript (`email-validation-thrivecart.ts`) and as JavaScript (`email-validation-thrivecart.mjs`), and the MIT
licence.

## What you need

- An API key of ours from the [API keys page](https://email-validation.org/app/api-keys/) with **Validate addresses** (on by default). Keep it on
  your server.
- A ThriveCart account. ThriveCart offers a 14-day free trial of its Standard monthly plan
  ([ThriveCart's plans](https://thrivecart.com/#pricing)).
- Your ThriveCart **secret word**, from **Settings** → **API & Webhooks** → **ThriveCart order validation**.
- A token of your own for the webhook URL: at least 24 letters and digits, from your password manager's generator (or `openssl rand -hex 32`).
- A server with an HTTPS address that runs `fetch` and Web Crypto: Next.js, Remix, Hono, Bun, Deno,
  Cloudflare Workers or Node 22 or later. Copy `email-validation-thrivecart.ts` into a TypeScript project, or
  `email-validation-thrivecart.mjs` into a JavaScript one.

Our key goes only to our API. Nothing here logs or answers an address, the token, the secret word or a key.

## Set it up

1. Put the receiver at an HTTPS address of your server, with the key, token and secret word from your environment:

   ```ts
   // app/api/thrivecart/route.ts (Next.js); any framework with web Requests works the same way
   import { after } from 'next/server';
   import { createThrivecartHook } from './email-validation-thrivecart';

   const hook = createThrivecartHook({
     apiKey: process.env.EMAIL_VALIDATION_API_KEY,
     token: process.env.THRIVECART_WEBHOOK_TOKEN,
     secret: process.env.THRIVECART_SECRET,
     waitUntil: after, // keeps the work after the answer running on serverless hosts
     onResult: (r) => {
       if (r.outcome === 'flagged') console.log('Look at ThriveCart order', r.orderId, r.decision.status);
     },
   });

   export const POST = (request: Request) => hook(request);
   export const HEAD = (request: Request) => hook(request); // ThriveCart's check when the URL is saved
   ```

   On Cloudflare Workers, build `hook` the same way without `after` (drop its import and the `waitUntil` line) and pass
   it the request's context, which keeps the work after the answer running:

   ```ts
   export default { fetch: (request: Request, env: Env, ctx: ExecutionContext) => hook(request, ctx) };
   ```
2. In ThriveCart, open **Settings** → **API & Webhooks** → **Webhooks & notifications** and add a webhook with a name
   and the receiver's address with your token: `https://<your host>/api/thrivecart?token=<your token>`
   ([ThriveCart's webhooks guide](https://support.thrivecart.com/help/using-webhook-notifications/)). ThriveCart
   checks the address when you save it and needs a `2xx` answer to both a `HEAD` and a `POST`: the receiver answers
   both `200` when the token is right, and does nothing for a `POST` that names no event.
3. ThriveCart's webhooks go out for every event and every product. The receiver takes **order.success** (a new order)
   and answers the rest `200` with nothing done.

Keep the URL secret like a password: it shows in your server's access logs and in ThriveCart's webhook settings. To
change the token, change it in your environment and in the webhook URL together; if you change the secret word in
ThriveCart, change `THRIVECART_SECRET` too.

## How it works

1. **Token first.** ThriveCart does not sign its webhooks, and the same secret word goes to every webhook URL of your
   account (Zapier, your CRM, any tool you connected). So the receiver first compares the URL's `token` with yours, in
   constant time and before it reads the body; a missing or wrong token is answered `401`.
2. **Then the secret word.** A delivery that names an event must carry your secret word in `thrivecart_secret`
   (compared in constant time), and with `account` set, your account name in `thrivecart_account`; otherwise it is
   answered `401`. An order more than a day old by its own date is a replay and is ignored.
3. **Answered at once.** A delivery it takes is answered `200`, and the check runs after the answer (`waitUntil` on
   serverless hosts), within 25 seconds.
4. **One check per address.** The buyer's address (`customer[email]`) is checked with our API. A definite answer is
   remembered for 30 days under a hash of the address (never the address itself), in the memory of the instance that
   checked it (up to 1,000 addresses) and in your `store` if you pass one. A delivery ThriveCart sends again (same
   `webhook_id`), the same order again, or the same buyer's next order costs nothing more when it reaches an instance
   that remembers it; without a `store`, another instance or a restart checks the address again.
5. **Reported.** `onResult` gets the event, ThriveCart's order and customer ids, the `mode` (`live` or `test`), the
   outcome (`flagged`, `allowed`, `no_address` or `unchecked`), whether the answer was remembered, and the decision.

Our own timeout or failure is `unchecked`: never flagged and never remembered, so it never replaces an earlier verdict.
The delivery was already answered `200`, so ThriveCart does not send it again: list the orders left `unchecked` from
`onResult` if you want to look at them later. Test-mode orders are checked like live ones; `mode` tells them apart.

## Try it free first

First on your machine: save this as `try.mjs` beside `email-validation-thrivecart.mjs` and run it with `node try.mjs`
and your key in `EMAIL_VALIDATION_API_KEY`.

```js
import { createEmailCheck } from './email-validation-thrivecart.mjs';

const check = createEmailCheck({ apiKey: process.env.EMAIL_VALIDATION_API_KEY });
const decision = await check('no_mailbox@sandbox.email-validation.org');
console.log(decision.flagged, decision.status, decision.reason); // prints: true invalid no_mailbox
```

Sandbox checks cost no credit. That domain receives no mail, so send it nothing.

Then in ThriveCart: set one product's status to **Test mode** and buy it once yourself on its checkout with your own email
address and the test card your payment processor gives
([ThriveCart's guide to testing your checkout](https://support.thrivecart.com/help/testing-your-checkout/)). Webhooks
fire for test orders, and ThriveCart still mails the buyer a receipt, so never use a test or invented address there.
`onResult` reports the order with `mode: 'test'`, its outcome and status. That check uses one credit unless the answer
is `unknown`.

## Options

| Option | Default | What it does |
| --- | --- | --- |
| `apiKey` | required | Our API key (Validate addresses). Missing: nothing is checked. |
| `region` | `us` | `eu` checks the address in the EU and stores its result there (same keys and credits). |
| `token` | required | The webhook URL's `?token=`: at least 24 URL-safe characters. |
| `secret` | required | Your ThriveCart secret word, compared with each delivery's `thrivecart_secret`. |
| `account` | none | Your ThriveCart account name: a delivery naming another account is refused. |
| `events` | `['order.success']` | Add `cart.abandoned` to check the address typed into a checkout that was left (ThriveCart shows no sample of that event yet). |
| `flag` | `['invalid']` | Statuses that flag an order: `invalid`, `disposable`, `catch_all`, `unknown`. |
| `store` | memory | A Workers KV namespace, or anything with `get(key)` and `put(key, value, { expirationTtl })`: answers shared across instances, no address in it. |
| `rememberDays` | `30` | How long a definite answer stands in for a new check (1 to 365 days). |
| `timeoutMs` | `6000` | How long a check may take before the order stays unchecked (whole milliseconds, at most 20000). |
| `waitUntil` | none | Keeps the work after the answer running on a serverless host. |
| `onResult` | none | Called once per delivery worked on, never with the address; what it throws is ignored. |

## Credits and limits

Each check uses one credit; `unknown` results and sandbox addresses are free. A remembered answer costs nothing.

When our API asks it to slow down (`429` or `503`), the receiver waits as long as asked, at most 20 seconds a time and
three tries, and never past the delivery's 25 seconds; a refused check is not charged.

It fails open: no key, a timeout, a network error, a rate limit or any error answer leaves the order as it is.

[What each status means](https://email-validation.org/docs/statuses/).

## More on ThriveCart

- [ThriveCart email validation integration](https://email-validation.org/integrations/thrivecart/)
