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

# Webhooks

> Inbound webhook ingestion for blockchain smart contract events, Fonbnk payments, and RevenueCat subscriptions.

# Webhooks

LearnWay exposes secure webhook receivers for real-time external event processing. All webhook endpoints require cryptographic signature verification and enforce event idempotency.

***

## Contract Events Webhook

Ingests indexed on-chain events emitted by LearnWay smart contracts on Lisk L2.

### Endpoint

```http theme={null}
POST /api/v2/webhook/contract-events
```

### Request Headers

| Header                | Type     | Required | Description                                      |
| :-------------------- | :------- | :------- | :----------------------------------------------- |
| `x-webhook-signature` | `string` | **Yes**  | HMAC SHA-256 hex signature of the payload        |
| `x-webhook-timestamp` | `string` | **Yes**  | Unix timestamp (seconds) when request was sent   |
| `x-event-id`          | `string` | **Yes**  | Unique event UUID used to prevent replay attacks |

### Request Body

```json theme={null}
{
  "eventType": "XP_REWARDED",
  "contractAddress": "0x742d35Cc6584C0532c3c4b5EF8bE6c14E6c8b8F2",
  "transactionHash": "0x8f3c7b2a9e1d0f5e...",
  "blockNumber": 12849201,
  "data": {
    "userAddress": "0x71C...3921",
    "amount": "50000000000000000000"
  }
}
```

### Response (200 OK)

```json theme={null}
{
  "success": true,
  "message": "Event processed successfully"
}
```

***

## RevenueCat Webhook

Receives app store transaction and subscription lifecycle events (Renewals, Cancellations, Billing Issues).

### Endpoint

```http theme={null}
POST /api/v2/webhooks/revenuecat
```

### Request Headers

```http theme={null}
Authorization: Bearer <REVENUECAT_WEBHOOK_AUTH_KEY>
```
