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

# Implement handler

When you build a webhook endpoint to receive events from PaySway, your handler must be prepared for both successful and failed deliveries, as well as the structure of the JSON payload that arrives with each event. Below are key considerations and technical details to help you implement a robust endpoint.

## Delivery and retry logic

PaySway delivers events one at a time, sending each as a separate HTTP request to your webhook endpoint. Here's how delivery and retries work:

<Steps>
  <Step title="Single-event requests">
    Each HTTP request contains exactly one event in JSON format.
  </Step>

  <Step title="Successful deliveries">
    If your handler processes an event successfully, it should return a `200 OK` response status. This indicates that PaySway can safely mark the event as delivered.
  </Step>

  <Step title="Retries on failure">
    If your endpoint returns any status other than `200 OK`, the delivery is considered failed.
    PaySway will retry delivering that event using an exponential backoff strategy.
    There is no limit on the number of retry attempts, so your handler should be idempotent and prepared for possible repeated messages.
  </Step>

  <Step title="Independent deliveries">
    Failed deliveries for one event do not prevent PaySway from sending subsequent events. Each event is processed independently in its own request.
  </Step>

  <Step title="Final confirmation">
    As soon as a `200 OK` response is received, PaySway treats the event as delivered and will not attempt to send it again.
  </Step>
</Steps>

## Payload structure

PaySway packages each event in a single JSON payload with metadata and event-specific data:

<ParamField body="id" type="string (uuid)" required>
  A unique identifier for the event. Use this for idempotency checks.
</ParamField>

<ParamField body="createdDate" type="string (date-time)" required>
  The date and time the event was created, formatted as ISO 8601.
</ParamField>

<ParamField body="eventType" type="string (enum)" required>
  The type of event that occurred. See [event types](/webhooks/event-types) for all available values.
</ParamField>

<ParamField body="object" type="object" required>
  A structured event object containing event-specific data. The schema varies by event type.
</ParamField>

### Example payload

```json theme={null}
{
  "id": "45239619-07eb-47c7-9a58-f98650c269ba",
  "createdDate": "2025-08-22T12:54:14.418745Z",
  "eventType": "ACCOUNT_VERIFICATION_SUBMITTED",
  "object": {
    "id": "3404bd69-c7ca-4ce0-8a65-358cbf2ee32f",
    "createdDate": "2025-08-22T12:54:14.418745Z",
    "updatedDate": "2025-08-22T12:54:14.418745Z",
    "state": "PENDING"
  }
}
```
