## Implementing Your Webhook Endpoint

To receive game events, your system must expose an HTTPS endpoint that accepts the webhook notifications we deliver. This page covers the endpoint requirements, the payload you will receive, how to respond, and how delivery and retries work.

#### Authentication

We authenticate each delivery to your endpoint using the method you configured in your subscription. Validate it on every incoming request.

| Type | Required Fields | Description |
|  --- | --- | --- |
| BEARER | apiKey | API key sent in the `Authorization` header as a Bearer token |
| BASIC | username, password | HTTP Basic authentication with username and password |
| NONE | none | No authentication (not recommended for production) |


### Webhook Payload

Each delivery is a POST request whose body is described by the schema below.

**Delivery Sample:**

```shell curl
curl -i -X POST \
  https://your-domain.com/webhook/game-events \
  -H 'Content-Type: application/json' \
  -d '{
    "roundId": "12345678-abcd-1234-efgh-123456789012",
    "gameId": "rp_12",
    "playerId": "player123",
    "timestamp": "2026-09-15T10:30:00.123",
    "bet": 1.5,
    "currencyCode": "EUR",
    "events": [
      "COIN",
      "FEATURE"
    ],
    "actionId": "1054417e-487e-46d8-ba99-27e4ee8e86a7",
    "sessionToken": "0Ja8M7KvY"
  }'
```

**Payload Schema:**

```json
{
  "$ref": "#/components/schemas/GameEventNotification",
  "components": {
    "schemas": {
      "GameEventNotification": {
        "type": "object",
        "description": "Payload delivered to your webhook endpoint when a subscribed game event occurs.",
        "required": [
          "roundId",
          "gameId",
          "playerId",
          "timestamp",
          "events",
          "actionId",
          "bet",
          "currencyCode"
        ],
        "properties": {
          "roundId": {
            "type": "string",
            "description": "Unique identifier for the game round.",
            "example": "12345678-abcd-1234-efgh-123456789012"
          },
          "gameId": {
            "type": "string",
            "description": "The game identifier.",
            "example": "rp_12"
          },
          "playerId": {
            "type": "string",
            "description": "External player identifier.",
            "example": "player123"
          },
          "timestamp": {
            "type": "string",
            "description": "When the event occurred, in UTC, without a zone offset.",
            "example": "2026-09-15T10:30:00.123"
          },
          "bet": {
            "type": "number",
            "description": "Base bet amount of the game round in major currency units (e.g. `1.50` for EUR).\nThis value remains consistent across all spins within the round.\nFor Buy Feature, reflects the underlying base bet rather than the feature purchase price (e.g. `1.50` bet × 50 multiplier = `75.00` feature purchase price, but `1.50` is sent)\n",
            "example": 1.5
          },
          "currencyCode": {
            "type": "string",
            "description": "Currency code.",
            "example": "EUR"
          },
          "events": {
            "type": "array",
            "description": "The event types that occurred during this action.",
            "items": {
              "type": "string",
              "example": "COIN"
            },
            "example": [
              "COIN",
              "FEATURE"
            ]
          },
          "actionId": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for this specific action; use it to detect duplicate deliveries.",
            "example": "1054417e-487e-46d8-ba99-27e4ee8e86a7"
          },
          "sessionToken": {
            "type": "string",
            "description": "Player session token.",
            "example": "0Ja8M7KvY"
          }
        }
      }
    }
  }
}
```

### Expected Response

Your endpoint acknowledges each delivery with its HTTP status code:

| Status | Meaning | Retried? |
|  --- | --- | --- |
| `200 OK` | Notification processed successfully | No — acknowledged |
| `4xx` | Permanent failure (e.g. validation error) | No |
| `5xx` | Temporary failure | Yes — with exponential backoff |


### Endpoint Requirements

You need to provide an HTTPS endpoint capable of receiving POST requests with `application/json` content type. Configure the endpoint URL and its authentication when you create or update your subscription.

**URL Format**: Any HTTPS URL (e.g., `https://your-domain.com/webhook/game-events`)

**HTTP Method**: POST

**Content-Type**: `application/json`

**Authentication**: Configured by you during subscription creation (see the supported types above).

#### Default Endpoint

Providing a callback URL is optional. If you do not provide one when creating your subscription, events are delivered to your **default endpoint**: your existing wallet base URL, reusing the authentication credentials already configured for your account. The full path is `$wallet_url/v1/game-action-events`, and no additional setup is required.

### Delivery & Retries

We continuously deliver webhooks to your configured endpoint with automatic retry handling.

- **Reliable Delivery**: Automatic retries for up to 7 days
- **Exponential Backoff**: Increasing delays between retries (prevents overwhelming your system)
- **Error Handling**: Permanent failures (4xx errors) are not retried
- **Authentication**: Uses the authentication method configured in your subscription (BEARER, BASIC, or NONE)


### Best Practices

- **Respond quickly**: Return 200 OK as soon as possible (under 1 second)
- **Handle duplicates**: Use `actionId` to detect duplicate deliveries
- **Process asynchronously**: Queue webhook processing if you need time to process
- **Monitor failures**: Track 4xx responses to identify integration issues
- **Validate payloads**: Always validate incoming webhook structure