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

# Webhooks

Register a URL to get notified when a payment is completed. Perfect for WooCommerce, or any backend that needs to mark orders as paid automatically.

Register a Webhook:

<CodeGroup>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.privexpay.com/api-webhooks \
    --header 'x-api-key: pp_live_your_api_key' \
    --header 'Content-Type: application/json' \
    --data '{ "url": "https://yourstore.com/privex/webhook" }'
  ```

  ```javascript Node.js theme={null}
  await fetch('https://api.privexpay.com/api-webhooks', {
    method: 'POST',
    headers: {
      'x-api-key': 'pp_live_your_api_key',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ url: 'https://yourstore.com/privex/webhook' }),
  });
  ```
</CodeGroup>

When a payment completes, we POST this JSON to your URL. Just look up the `checkout_id` in your system and mark the order as paid.

<CodeGroup>
  ```json Response theme={null}
  POST https://yourstore.com/privex/webhook

  {
    "event": "payment.completed",
    "checkout_id": "b3f1c2d4-7e8a-4d2b-9f1c-1234567890ab",
    "payment_status": "completed",
    "amount": 69.97,
    "currency": "USD"
  }
  ```
</CodeGroup>
