> ## 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.

# Bank Response Webhook

Sent to merchants when a bank responds to a billing request with the customer's final decision.

**Webhook type:** `billing.response`\
**Recipient:** Merchants and Providers

## Payload

```json theme={null}
{
  "entityId": "merchant_001",
  "entityType": "merchant",
  "webhookType": "billing.response",
  "timestamp": "2024-01-15T11:05:00.000Z",
  "batchId": "batch_response_890",
  "data": [
    {
      "customerId": "customer_123",
      "amount": 1500,
      "currency": "NGN",
      "reference": "billing_ref_xyz789",
      "merchant": {
        "id": "merchant_001",
        "name": "Netflix Nigeria"
      },
      "customerAction": "accepted",
      "isSettled": false,
      "bankTransactionId": "bank_txn_abc123",
      "processedAt": "2024-01-15T11:05:00.000Z"
    }
  ],
  "totalAmount": 1500,
  "itemCount": 1
}
```

The `customerAction` field is either `accepted` or `declined`. Use the `reference` to match this response to the original billing request.

## Handler

```javascript theme={null}
app.post("/webhooks/peere/billing-response", (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.response") {
    for (const response of data) {
      if (response.customerAction === "accepted") {
        // fulfill order
      } else {
        // handle decline
      }
    }
  }

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