> ## Documentation Index
> Fetch the complete documentation index at: https://docs.easner.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Event catalog, easner-signature, and retries.

Easner POSTs signed events to your URLs. Create as many endpoints as you need per mode (test and live may differ). Tick which events you want in Settings → Webhooks. Unticked events are not sent. Disable is reversible — Enable puts the endpoint back.

Endpoint rules: a public `https://` address with a real host name. No `localhost`, IP addresses, internal names or odd ports (use a tunnel such as a dev tunnel URL while you build). Easner waits 8 seconds for an answer, reads at most 64 KB of the response, and never follows redirects.

## Test and live endpoints

Every event has a mode. **Test events go only to test endpoints and live events only to live endpoints.** A test payment never reaches your live URL. The same `data.livemode` field is on every payload. Create the endpoint in the mode you are in (Console header: Test or Live).

Each endpoint has its own signing secret (`easner_whsec_…`), shown once when you create or rotate it. Store it as `EASNER_WEBHOOK_SECRET`.

Headers on every delivery:

| Header | Value |
| - | - |
| `content-type` | `application/json` |
| `easner-event` | The event name, e.g. `transfer.completed` |
| `easner-event-id` | The event id, e.g. `evt_9f2c4a7e1b3d5f60a8c2e4d1`. Same value as `id` in the body, and the same on every retry |
| `easner-signature` | `t=<unix>,v1=<hex>` |

Body:

```json theme={null}
{
  "id": "evt_9f2c4a7e1b3d5f60a8c2e4d1",
  "type": "transfer.completed",
  "created": 1758336000,
  "data": {
    "id": "tr_…",
    "amount": 4900,
    "currency": "USD",
    "status": "completed",
    "livemode": false
  }
}
```

Return `2xx` quickly. Do the work after you ACK, or keep the handler short. Anything else (a non-2xx status, a timeout, a redirect) is a failure and will retry.

`id` is the event id (`evt_…`). It is created once per event and is the same on every retry and redelivery, so it is the key to dedupe on: store the ids you have handled and skip one you have seen. The same event can arrive more than once. `created` is when the event happened (Unix seconds) and also never changes. The `id` in the examples below is left out for brevity, every body has it. Events recorded before ids were added get one derived from the stored event the first time they are redelivered, and it stays the same after that.

Dedupe on the event id, not on `data`: one object produces several events (a refund goes `refund.created` then `refund.updated`), and each is a different event with its own id.

## Verify `easner-signature`

HMAC-SHA256 of the Unix timestamp, a period, and the raw body, keyed with the endpoint's signing secret. Compare with `v1` using a constant-time compare.

`t` is the time this attempt was sent, so it is fresh on every retry. Reject a `t` more than 5 minutes from your clock (replay protection). The event's own time is `created` in the body, which does not change on retries. Easner used to reuse the original `t` on retries. If your verifier loosened its tolerance to cope with that, put it back to 5 minutes.

```js theme={null}
import { createHmac, timingSafeEqual } from "node:crypto";

export function verifyWebhook(rawBody, signatureHeader, secret) {
  const parts = Object.fromEntries(
    String(signatureHeader || "")
      .split(",")
      .map((part) => part.trim().split("=", 2)),
  );
  const timestamp = Number(parts.t);
  const expected = createHmac("sha256", secret)
    .update(`${timestamp}.${rawBody}`)
    .digest("hex");
  const got = String(parts.v1 || "");
  if (got.length !== expected.length) return false;
  if (Math.abs(Date.now() / 1000 - timestamp) > 5 * 60) return false;
  return timingSafeEqual(Buffer.from(expected), Buffer.from(got));
}
```

Use the **raw** body. Re-serializing JSON will fail the signature.

```python Python theme={null}
import hashlib
import hmac
import os
import time

def verify_webhook(raw_body: bytes, signature_header: str) -> bool:
    parts = dict(p.strip().split("=", 1) for p in signature_header.split(","))
    timestamp = int(parts.get("t", "0"))
    signed = f"{timestamp}.".encode() + raw_body
    expected = hmac.new(
        os.environ["EASNER_WEBHOOK_SECRET"].encode(), signed, hashlib.sha256
    ).hexdigest()
    if abs(time.time() - timestamp) > 5 * 60:
        return False
    return hmac.compare_digest(expected, parts.get("v1", ""))
```

```php PHP theme={null}
<?php
function verify_webhook(string $rawBody, string $signatureHeader): bool {
    $parts = [];
    foreach (explode(",", $signatureHeader) as $part) {
        [$key, $value] = array_pad(explode("=", trim($part), 2), 2, "");
        $parts[$key] = $value;
    }
    $timestamp = (int) ($parts["t"] ?? 0);
    $expected = hash_hmac("sha256", $timestamp . "." . $rawBody, getenv("EASNER_WEBHOOK_SECRET"));
    if (abs(time() - $timestamp) > 5 * 60) return false;
    return hash_equals($expected, $parts["v1"] ?? "");
}
```

```ruby Ruby theme={null}
require "openssl"

def verify_webhook(raw_body, signature_header)
  parts = signature_header.split(",").map { |p| p.strip.split("=", 2) }.to_h
  timestamp = parts["t"].to_i
  expected = OpenSSL::HMAC.hexdigest("SHA256", ENV.fetch("EASNER_WEBHOOK_SECRET"), "#{timestamp}.#{raw_body}")
  return false if (Time.now.to_i - timestamp).abs > 5 * 60
  Rack::Utils.secure_compare(expected, parts["v1"].to_s)
end
```

## Catalog

Tick these in Settings → Webhooks. Default ticks are Banking: `customer.updated`, `account.updated`, `transfer.completed`, `transaction.created`. Add Checkout events when you take payments on a site: `checkout.completed`, `checkout.async_succeeded`, `checkout.failed`, `refund.created` at least, plus the subscription events for subscriptions.

Thirty-seven events exist. Checkout: `checkout.completed`, `checkout.async_succeeded`, `checkout.failed`, `payment.available`, `subscription.created`, `subscription.updated`, `subscription.canceled`, `subscription.trial_ending`, `subscription.payment_failed`, `refund.created`, `refund.updated`, `refund.failed`, `dispute.created`, `dispute.updated`, `dispute.closed`. Banking: `account.updated`, `customer.created`, `customer.updated`, `transfer.created`, `transfer.completed`, `transfer.failed`, `transaction.created`. Connect: `payee.linked`, `payee.unlinked`, `payee.relinked`, `payee.link_confirmation_required`, `payee.balance.updated`, `payee.restricted`, `payee.tax_form.updated`, `credit.available`, `payout.created`, `payout.held`, `payout.waiting_for_funds`, `payout.waiting_for_limit`, `payout.waiting_for_tax_form`, `payout.completed`, `payout.failed`. `customer.updated` is one event name with two payload shapes (Banking and Checkout customers, see below).

Every field of every event, with types and nullability, is in [Webhook events](https://docs.easner.com/webhook-events.md). The examples on this page show the common fields.

There is no `transfer.canceled` event. Canceling a transfer (`POST /v1/transfers/:id/cancel`) releases the hold and sends no webhook: read the `canceled` status from the cancel response or from `GET /v1/transfers/:id`.

### Checkout

**`checkout.completed`** — Payment succeeded. Fulfil the order. Funds land on **your** business balance.

```json theme={null}
{
  "type": "checkout.completed",
  "created": 1758336000,
  "data": {
    "checkout_session_id": "cs_…",
    "mode": "payment",
    "amount_cents": 4900,
    "currency": "USD",
    "customer_email": "ada@example.com",
    "subscription_id": null,
    "metadata": { "order_id": "ord_123" },
    "paid_at": "2026-09-20T00:00:00.000Z",
    "livemode": false
  }
}
```

**`checkout.async_succeeded`** — A **delayed** payment method (a bank debit) charged successfully. Easner sends it only for those methods. A card payment sends `checkout.completed` and nothing else, so it no longer produces this event. It is informational: fulfil from `checkout.completed`, which Easner also sends once the debit clears. `data` has `checkout_session_id` (`null` only if the session cannot be found), `amount_cents`, `currency`, `livemode` and `payment_link_id` when the payment came from a link.

**`checkout.failed`** — The payment failed or a bank debit did not go through. Do not fulfil. `data` has `amount_cents`, `currency`, `reason`, `livemode`, and `checkout_session_id` when Easner knows the session: a failed bank debit carries it, and so does a declined card attempt when Easner can tie it to a session. Renewals do not, so match on your own metadata or the customer if it is missing. `reason` can be `null`. Failed renewals also send this event with the `subscription.payment_failed` shape, for older integrations. New code should use `subscription.payment_failed`.

A free trial or a 100% promotion code sends `checkout.completed` with `amount_cents: 0` and `amount_due_today_cents: 0`. Payments from a payment link add `payment_link_id` to `data`.

**`payment.available`** — Funds are usable on your business balance. Only live money is credited to a balance, so a real event always has `livemode: true`.

```json theme={null}
{
  "type": "payment.available",
  "created": 1758336000,
  "data": { "amount_cents": 4750, "currency": "USD", "available_at": "2026-09-20T00:00:00.000Z", "livemode": true }
}
```

**`subscription.updated`** / **`subscription.canceled`** — A renewal, plan change, pause or cancellation. `canceled` fires when the subscription ends.

```json theme={null}
{
  "type": "subscription.updated",
  "created": 1758336000,
  "data": {
    "subscription_id": "sub_…",
    "status": "active",
    "metadata": { "user_id": "123", "plan": "pro" },
    "livemode": false
  }
}
```

**`subscription.created`** — A subscription started, including a free trial. Create access on this event. The `data` has the same state as `subscription.updated`, plus `started_as` (`trial` or `active`). See [Webhook events](https://docs.easner.com/webhook-events.md).

**`subscription.trial_ending`** — The free trial ends in 3 days. Nothing is charged yet. `data` has `trial_end`, `quantity` and `amount_cents` for the first charge.

**`subscription.payment_failed`** — A renewal could not be charged. Easner retries on its own schedule (about 3, 5 and 7 days). Ask the customer to fix their payment method, for example with a [portal](https://docs.easner.com/customer-portal.md) link.

```json theme={null}
{
  "type": "subscription.payment_failed",
  "created": 1758336000,
  "data": {
    "subscription_id": "sub_…",
    "invoice_id": "in_…",
    "amount_cents": 3600,
    "currency": "USD",
    "attempt_count": 1,
    "next_payment_attempt": "2026-09-23T00:00:00.000Z",
    "reason": "A recurring payment could not be collected.",
    "livemode": false
  }
}
```

#### Refunds

**`refund.created`**, **`refund.updated`**, **`refund.failed`** — A full or partial refund was made (from `POST /v1/refunds` or Console), changed status, or did not go through (the money stays with you). Dedupe on `refund_id` plus `status`. `refund_id` is the `re_…` id that `POST /v1/refunds` and `GET /v1/refunds` return as `id`. `payment_id` and `fully_refunded` are on every refund event, including when `POST /v1/refunds` recorded the refund first. See [Refunds](https://docs.easner.com/refunds.md#ids).

```json theme={null}
{
  "type": "refund.created",
  "created": 1758336000,
  "data": {
    "refund_id": "re_…",
    "payment_id": "7c1e9f0a-52b4-4a8e-9d3f-1b6a2c4e8d70",
    "amount_cents": 2500,
    "currency": "USD",
    "status": "succeeded",
    "reason": "requested_by_customer",
    "fully_refunded": false,
    "livemode": false
  }
}
```

#### Disputes

**`dispute.created`**, **`dispute.updated`**, **`dispute.closed`** — A customer disputed a payment with their bank. The amount is held. Respond with evidence before `evidence_due_by`. `closed` means the dispute was won or lost; check `status`.

```json theme={null}
{
  "type": "dispute.created",
  "created": 1758336000,
  "data": {
    "dispute_id": "dp_…",
    "payment_id": "7c1e9f0a-52b4-4a8e-9d3f-1b6a2c4e8d70",
    "amount_cents": 4900,
    "currency": "USD",
    "reason": "fraudulent",
    "status": "needs_response",
    "evidence_due_by": "2026-10-20T00:00:00.000Z",
    "livemode": false
  }
}
```

**`customer.updated`** for a Checkout customer has a different `data` from the Banking customer: `{ "object": "checkout.customer", "id", "email", "name", "phone", "address", "livemode" }`. Check `data.object` before you read it.

### Banking

**`account.updated`** — Available or pending changed, and also once when an account is first created (a new customer's USD account, or `POST /v1/accounts`). A new customer therefore sends `account.updated` for the issued account, then `customer.created`. Default tick.

```json theme={null}
{
  "type": "account.updated",
  "created": 1758336000,
  "data": {
    "id": "acct_…",
    "currency": "USD",
    "available": 4900,
    "pending": 0,
    "customer": "cus_…",
    "livemode": false
  }
}
```

**`customer.updated`** — Record changed, including `verification_status`. Default tick. `customer.created` is the same `data` shape; tick it if you need create.

```json theme={null}
{
  "type": "customer.updated",
  "created": 1758336000,
  "data": {
    "id": "cus_…",
    "email": "ada@example.com",
    "name": "Ada",
    "external_id": "user_42",
    "status": "active",
    "verification_status": "approved",
    "livemode": false,
    "created": "2026-09-20T00:00:00.000Z"
  }
}
```

**`transfer.created`** — A transfer was created and is waiting for the customer to authorize it. `data` is the transfer without `client_secret`, and `next_action` is the authorize object, not `null`:

```json theme={null}
{
  "type": "transfer.created",
  "created": 1758336000,
  "data": {
    "id": "tr_…",
    "quote": "qt_…",
    "source": "acct_…",
    "destination": "dest_…",
    "amount": 4900,
    "currency": "USD",
    "status": "requires_action",
    "livemode": false,
    "created": "2026-09-20T00:00:00.000Z",
    "expires_at": "2026-09-20T00:15:00.000Z",
    "next_action": {
      "type": "authorize",
      "url": "https://business.easner.com/send/authorize/tr_…",
      "delivery": "client_secret"
    }
  }
}
```

In live mode `delivery` is `customer_email`. The sample from Console, Send test event, carries the same object (with a sample id).

**`transfer.completed`** — Vault sent. Default tick. `data` is the transfer **without** `client_secret`. Also tick `transfer.created` / `transfer.failed` if you handle those.

```json theme={null}
{
  "type": "transfer.completed",
  "created": 1758336000,
  "data": {
    "id": "tr_…",
    "quote": "qt_…",
    "source": "acct_…",
    "destination": "dest_…",
    "amount": 4900,
    "currency": "USD",
    "status": "completed",
    "livemode": false,
    "created": "2026-09-20T00:00:00.000Z",
    "expires_at": "2026-09-20T00:15:00.000Z",
    "next_action": null
  }
}
```

**`transfer.failed`** — optional tick. Fires when a transfer expires before the customer confirms, or when the send fails after confirm and the funds are known not to have left. Same transfer fields plus `error`. A send whose outcome is unknown stays in `processing` and sends no event until it is reconciled. When the failure happens after confirm, `next_action` may still be filled in from before the confirm; ignore it, read `status`:

```json theme={null}
{
  "type": "transfer.failed",
  "created": 1758336000,
  "data": {
    "id": "tr_…",
    "quote": "qt_…",
    "source": "acct_…",
    "destination": "dest_…",
    "amount": 4900,
    "currency": "USD",
    "status": "failed",
    "livemode": false,
    "created": "2026-09-20T00:00:00.000Z",
    "expires_at": "2026-09-20T00:15:00.000Z",
    "next_action": null,
    "error": "Transfer expired"
  }
}
```

**`transaction.created`** — A ledger row was written. Default tick. This payload is **narrower than** `GET /v1/transactions/:id`. Receive `type` is `deposit`, `onramp`, or `chain`.

```json theme={null}
{
  "type": "transaction.created",
  "created": 1758336000,
  "data": {
    "id": "txn_…",
    "type": "deposit",
    "amount": 4900,
    "currency": "USD",
    "direction": "in",
    "status": "completed",
    "livemode": false
  }
}
```

## Retries

A delivery is attempted up to **5 times**: the first attempt when the event happens, then retries 1 minute, 5 minutes, 30 minutes and 2 hours after the previous failed attempt. There is no later retry: after the fifth failed attempt (at least 2 hours 36 minutes after the first attempt, a little more when the retry job runs late) the delivery is `failed` and Easner stops. Redeliver it by hand from Settings → Webhooks, or read the missed object from the API. Each attempt (a retry or a redelivery) is signed again with the time it is sent, and carries the same event `id` and `created`. Dedupe on `id`.

Deliveries are listed there. Events in Console is a log of every event, not this catalog.

## Send a test event

In Console, Settings, Webhooks, choose an endpoint and **Send test event**, or use Checkout, Integrate, step 5. Pick any event name. Easner POSTs a sample payload to that one endpoint (never to your other endpoints) and shows the status your server answered. The sample payload carries `"test": true` and `"livemode": false`. The request is signed exactly like a real one, so it checks your signature code too. A `200` here is what the Checkout go-live check "Your webhook answered 200" waits for.

Sample payloads are static and use sample ids such as `cs_test_easner_sample`. Do not look them up with `GET /v1/checkout/sessions`. Every one of the twenty events has a sample with the same fields as the real payload shown on this page (refunds, disputes and `subscription.payment_failed` included), plus `test: true`. The test delivery carries its own `id` (`evt_…`) and `easner-event-id` like a real one.

## Manage endpoints via the API

A webhook endpoint is an https URL that Easner posts [webhook events](https://docs.easner.com/webhook-events.md) to. Each endpoint has one mode (test or live), its own list of events, and its own signing secret. How deliveries are signed and retried is on this page.

Over the API, a key with the `webhooks.manage` scope can list endpoints of its mode, add one, change one, and disable or delete one. A key without the scope gets `403` `key_forbidden`.

### Routes

| Method and path | Purpose |
| - | - |
| `GET /v1/webhook_endpoints` | Lists the endpoints of your mode, disabled ones included |
| `POST /v1/webhook_endpoints` | Adds an endpoint and returns its signing secret, once |
| `POST /v1/webhook_endpoints/:id` | Changes the `url` or `enabled_events`, or disables and enables the endpoint |
| `DELETE /v1/webhook_endpoints/:id` | Stops deliveries to the endpoint. The row stays |

Every endpoint in a response has these fields, and no others:

| Field | Type | Notes |
| - | - | - |
| `id` | string | The endpoint id |
| `object` | string | `webhook_endpoint` |
| `url` | string | The https address Easner posts to |
| `enabled_events` | string\[] | Only these events are sent to the endpoint |
| `livemode` | boolean | `true` for a live key's endpoint, `false` for a test key's |
| `status` | string | `enabled` or `disabled` |
| `created` | string | When the endpoint was added |

The signing secret is never in a list, a change or a delete response.

### Add an endpoint

```json theme={null}
{
  "url": "https://shop.example/webhooks/easner",
  "enabled_events": ["transfer.completed", "refund.created"]
}
```

`url` must be a full `https://` address. `enabled_events` is required and names events from [Webhook events](https://docs.easner.com/webhook-events.md). The API does not pre-tick any events: send the ones you handle. An unknown event is refused, with every unknown name in the message and in `error.fields`.

A successful call answers `201` with the endpoint's fields, plus two more:

| Field | Notes |
| - | - |
| `secret` | The signing secret, `easner_whsec_…`. Shown once |
| `warning` | A reminder to save the secret now |

Save the secret where your server reads `EASNER_WEBHOOK_SECRET`. Easner stores only an encrypted copy, so it cannot be read again. If you lost it, add a new endpoint, or rotate the secret in Console (Settings → Webhooks, Rotate secret).

Creating an endpoint is not idempotent. A retry after a lost response makes a second endpoint with its own secret. To avoid that, list the endpoints first and look for the URL.

### Change an endpoint

`POST /v1/webhook_endpoints/:id` takes any of these fields. Send at least one:

| Field | Effect |
| - | - |
| `url` | Points the endpoint at a new https address |
| `enabled_events` | Replaces the list of events. It must not be empty |
| `disabled` | `true` stops deliveries. `false` turns them back on |

The response is the endpoint's fields. A change that alters nothing answers `200` and is not recorded.

### Delete an endpoint

`DELETE /v1/webhook_endpoints/:id` stops deliveries to the endpoint at once. The row is kept, so its id and history stay, and it shows as `status: disabled` in the list. The response is `{ "object": "webhook_endpoint", "id": "…", "deleted": true }`. To send to it again, call `POST` with `disabled: false`.

### Modes

A test key lists, adds and changes test endpoints only. A live key does the same for live endpoints. An endpoint of the other mode is `404` `not_found`. A live endpoint receives live events, so add one only with a URL that is ready for real money.

### Notices

The business owner is emailed when an endpoint is added, changed, disabled, enabled or deleted. The email names the endpoint and says the change was made through the API, with the name of the key that made it. A change that alters nothing sends no email.

The API has no authenticator step. Console asks for a fresh security code before it adds or changes an endpoint; a key with `webhooks.manage` does not. The scope and the email are the controls, so give the scope only to a key that needs it.

### Not on the API

* **Rotate a signing secret.** Settings → Webhooks, then Rotate secret. The old secret stops working at once.
* **Send a test event.** Settings → Webhooks, then Send test event.
* **Redeliver a failed event, or read the delivery log.** Settings → Webhooks.
* **Change the description.** Settings → Webhooks.
* **Create or revoke API keys.** See [API keys](https://docs.easner.com/api-keys.md).

### Errors

| `code` | HTTP | When |
| - | - | - |
| `invalid_url` | 400 | `url` is not an `https://` address, or names a host that cannot be reached from the internet |
| `invalid_request` | 400 | `enabled_events` is missing, empty or has an unknown name. Or `disabled` is not a boolean. Or a change sends no field. `error.fields` names the field |
| `not_found` | 404 | No endpoint of this mode has that id |
| `key_forbidden` | 403 | The key lacks `webhooks.manage` |
| `rate_limit` | 429 | Over the write budget. `POST` and `DELETE` count as writes, `GET` as a read. Wait `Retry-After` seconds |

See [Errors](https://docs.easner.com/errors.md) for every code.

## Expected handler

**1. Read the raw body**

Do not re-serialize JSON before verifying.

**2. Verify `easner-signature`**

HMAC-SHA256 of timestamp plus raw body. Reject timestamps older than 5 minutes. This holds for retries too.

**3. Switch on `type`**

Branch on the event name, not the message text.

**4. Fulfil idempotently**

Skip an event whose `id` (or `easner-event-id`) you have already handled. Then use `checkout_session_id`, `id` on the transfer, or your `metadata`.

**5. Return `200`**

ACK quickly. Do heavier work after.

> [card] [Test and live](https://docs.easner.com/test-and-live.md)
>
> What test completes, and what live actually moves.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.