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

# Billing Intent Webhook

Sent to banks when a merchant calls `POST /v1/billing/intent` to request billing permission from a customer.

**Webhook type:** `billing.intent`\
**Recipient:** Banks

## Payload

```json theme={null}
{
  "entityId": "bank_456",
  "entityType": "bank",
  "webhookType": "billing.intent",
  "timestamp": "2024-01-15T10:30:00.000Z",
  "batchId": "batch_intent_123",
  "data": [
    {
      "customerId": "customer_123",
      "customerEmail": "john.doe@example.com",
      "lookupID": "customer-lookup-phrase",
      "paymentID": "customer-agreement-phrase",
      "currency": "NGN",
      "merchant": {
        "id": "merchant_001",
        "name": "Netflix Nigeria",
        "icon": "https://example.com/icons/netflix.png",
        "email": "support@netflix.com",
        "website": "https://netflix.com"
      },
      "description": "Netflix Premium subscription billing authorization",
      "reference": "intent_ref_abc123",
      "dueDate": "2024-01-16T10:30:00.000Z"
    }
  ],
  "itemCount": 1,
  "signature": "webhook_signature_hash"
}
```

Notify the customer of the incoming request. After they decide, send their response to `POST /v1/billing/intent-response` with the `customerDecision` and any spending limits.

## Handler

```javascript theme={null}
app.post("/webhooks/peere/billing-intent", (req, res) => {
  const signature = req.headers["x-peere-signature"];
  if (!verifySignature(req.body, signature)) {
    return res.status(401).send("Invalid signature");
  }

  const { webhookType, data } = req.body;

  if (webhookType === "billing.intent") {
    for (const intent of data) {
      notifyCustomer(intent.customerId, intent);
      storeBillingIntent(intent);
    }
  }

  res.status(200).send("OK");
});
```
