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

# Setup Webhooks

> Push real-time notifications to your app the moment an event happens — no polling required.

Webhooks let Macropay call *you*. Instead of polling our API for the latest
order, subscription change, or refund, you register an endpoint once and we
deliver a signed HTTP POST every time something happens. As your merchant of
record, that includes the events you actually care about as a seller — paid
orders (with tax already remitted on your behalf), subscription renewals,
cancellations, disputes, and more.

Every delivery conforms to the [Standard Webhooks](https://www.standardwebhooks.com/)
specification, and our SDKs build on top of it so you get:

* **Cryptographic signature verification** out of the box — no hand-rolled HMAC.
* **Fully typed payloads** in TypeScript, Python, PHP, and Go.
* **Native Slack & Discord formatting** — paste a channel webhook URL and we
  reshape the payload into a clean chat message for your team.

<Note>
  **Billing AI agents?** The events you subscribe to here are the same stream
  that surfaces agent activity and outcome signals ingested through the Signals
  API — so usage, value receipts, and agentic margin updates can flow straight
  into your systems as they happen.
</Note>

## How it works

1. You create an endpoint and tell us which event types to send.
2. When a matching event fires, we POST the payload to your URL, signed with
   your secret.
3. Your handler verifies the signature, then reacts — provision access, update
   a record, notify a channel.

## Before you start

<Info>
  **Develop against the sandbox first.**

  Spin up test orders, subscriptions, cancellations, and refunds in the sandbox
  to trigger real webhook events end-to-end — without moving a cent of live
  money.
</Info>

## Create an endpoint

<Steps>
  <Step title="Open the webhook settings">
    In your organization settings, select **Add Endpoint** to register a new
    destination.

    <img className="block dark:hidden" src="https://mintcdn.com/macrodeepinc/Uu6hOe0dMZnKqgkh/assets/integrate/webhooks/create.light.png?fit=max&auto=format&n=Uu6hOe0dMZnKqgkh&q=85&s=c7073df69217de02e529a6db6b7869b4" width="1532" height="389" data-path="assets/integrate/webhooks/create.light.png" />

    <img className="hidden dark:block" src="https://mintcdn.com/macrodeepinc/Uu6hOe0dMZnKqgkh/assets/integrate/webhooks/create.dark.png?fit=max&auto=format&n=Uu6hOe0dMZnKqgkh&q=85&s=5e50eec4f19d365d542e3c295fa7e274" width="1494" height="388" data-path="assets/integrate/webhooks/create.dark.png" />
  </Step>

  <Step title="Point it at your URL">
    Provide the HTTPS URL that should receive events.

    <img className="block dark:hidden" src="https://mintcdn.com/macrodeepinc/Uu6hOe0dMZnKqgkh/assets/integrate/webhooks/url.light.png?fit=max&auto=format&n=Uu6hOe0dMZnKqgkh&q=85&s=3a9154e8746d62c62350725afc1eebf0" width="1075" height="402" data-path="assets/integrate/webhooks/url.light.png" />

    <img className="hidden dark:block" src="https://mintcdn.com/macrodeepinc/Uu6hOe0dMZnKqgkh/assets/integrate/webhooks/url.dark.png?fit=max&auto=format&n=Uu6hOe0dMZnKqgkh&q=85&s=713b5b2a28cb30334f3012c6f3568d61" width="1068" height="398" data-path="assets/integrate/webhooks/url.dark.png" />

    <Tip>
      **Testing from `localhost`?**

      Your machine isn't reachable from the public internet, so use a tunnel.
      [ngrok](https://ngrok.com/) or Cloudflare Tunnel forward a public HTTPS URL
      to your local server — register that URL as the endpoint while you build.
    </Tip>
  </Step>

  <Step title="Pick a delivery format">
    Keep this on **Raw** for standard integrations and you'll receive the event
    as a JSON payload.

    To route notifications into a chat tool instead, choose **Discord** or
    **Slack**, and Macropay reshapes each payload into a properly formatted
    message for that platform.

    <img className="block dark:hidden" src="https://mintcdn.com/macrodeepinc/Uu6hOe0dMZnKqgkh/assets/integrate/webhooks/format.light.png?fit=max&auto=format&n=Uu6hOe0dMZnKqgkh&q=85&s=3664c0396722e047411eeff0841d7f9e" width="1034" height="402" data-path="assets/integrate/webhooks/format.light.png" />

    <img className="hidden dark:block" src="https://mintcdn.com/macrodeepinc/Uu6hOe0dMZnKqgkh/assets/integrate/webhooks/format.dark.png?fit=max&auto=format&n=Uu6hOe0dMZnKqgkh&q=85&s=86c3daca6de088fa59e337d8309351dc" width="1050" height="418" data-path="assets/integrate/webhooks/format.dark.png" />

    Paste a Discord or Slack webhook URL and the matching format is selected for
    you automatically.
  </Step>

  <Step title="Set a signing secret">
    We sign every request with this secret so you can confirm each payload truly
    came from Macropay and wasn't tampered with in transit. Our SDKs verify the
    signature for you.

    Bring your own secret or generate a random one.

    <img className="block dark:hidden" src="https://mintcdn.com/macrodeepinc/Uu6hOe0dMZnKqgkh/assets/integrate/webhooks/secret.light.png?fit=max&auto=format&n=Uu6hOe0dMZnKqgkh&q=85&s=73b23a9f64150bc77cd46a36505ecb39" width="1074" height="331" data-path="assets/integrate/webhooks/secret.light.png" />

    <img className="hidden dark:block" src="https://mintcdn.com/macrodeepinc/Uu6hOe0dMZnKqgkh/assets/integrate/webhooks/secret.dark.png?fit=max&auto=format&n=Uu6hOe0dMZnKqgkh&q=85&s=0f4aec5ed85ef64f6ad0550f2f86c2b5" width="1072" height="332" data-path="assets/integrate/webhooks/secret.dark.png" />
  </Step>

  <Step title="Subscribe to events">
    Select the event types you want delivered to this endpoint, save, and you're
    live. 🎉
  </Step>
</Steps>

## Next steps

<CardGroup cols={2}>
  <Card title="Receive & verify events" icon="webhook" href="/integrate/webhooks/delivery">
    Wire up your handler, validate the signature, and start reacting to events.
  </Card>

  <Card title="Standard Webhooks spec" icon="book" href="https://www.standardwebhooks.com/">
    The open specification our signatures and headers conform to.
  </Card>
</CardGroup>
