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

# Commerce Webhooks

> Receive signed order and subscription lifecycle events.

Use webhooks as the server-side signal that an order or customer subscription changed. A
browser success page is useful for the buyer, but it is not a reliable fulfillment trigger.

## Set up an endpoint

<Steps>
  <Step title="Open Developer settings">
    In the Business profile menu, open **Developers**, then select **Webhooks**.
  </Step>

  <Step title="Add an HTTPS endpoint">
    Enter the public HTTPS URL that should receive the selected commerce events.
  </Step>

  <Step title="Store the signing information">
    Cache the published Ed25519 public key in your server-side configuration. You may also retain the endpoint ID for configuration tracking. Neither value is a signing secret.
  </Step>

  <Step title="Verify every request">
    Verify the signature against the raw request body before parsing or acting on the event.
  </Step>
</Steps>

## Fulfillment rules

* Route behavior by event type.
* Use the `webhook-id` header as the delivery idempotency key.
* Compare amount, currency, product, and merchant reference with your own records.
* Update local subscription state from `subscription.*` events; a scheduled period-end
  cancellation arrives as `subscription.updated`, while the final stop arrives as
  `subscription.ended`.
* Return a successful response quickly and move slow work to a queue.
* Accept retries and out-of-order delivery.
* Never move a locally paid order back to pending because an older event arrives.

<Warning>
  Never log signatures, API keys, full customer payment details, passport images, or payout account details.
</Warning>

<CardGroup cols={2}>
  <Card title="API webhook reference" icon="code" href="/api-reference/endpoint/webhooks">
    Review the public key, signature contract, payload, retries, and idempotency rules.
  </Card>

  <Card title="Customers & subscriptions" icon="users" href="/features/customers-and-subscriptions">
    Understand subscription status, scheduled cancellation, and renewal orders.
  </Card>
</CardGroup>


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