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

# Stripe Webhook Event

> Stripe webhook event processing entity

Stripe webhook event processing entity

Tracks Stripe webhook events for idempotent processing.

## Fields

### Core Fields

| Field            | Type    | Required | Description                                  |
| ---------------- | ------- | -------- | -------------------------------------------- |
| id               | UUID    | Auto     | Primary key                                  |
| stripeEventId    | string  | Yes      | Stripe event ID (unique)                     |
| eventType        | string  | Yes      | Event type (e.g., payment\_intent.succeeded) |
| eventData        | json    | Yes      | Full event payload                           |
| processingStatus | enum    | Yes      | pending, processed, failed                   |
| retryCount       | integer | Auto     | Retry attempts (default: 0)                  |

### Processing Fields

| Field                  | Type     | Required | Description                       |
| ---------------------- | -------- | -------- | --------------------------------- |
| processedAt            | datetime | No       | Processing timestamp              |
| processingErrorMessage | text     | No       | Error if failed                   |
| relatedEntityType      | string   | No       | transaction, subscription, refund |
| relatedEntityId        | UUID     | No       | MemberPulse entity ID             |

### System Fields

| Field      | Type     | Required | Description           |
| ---------- | -------- | -------- | --------------------- |
| receivedAt | datetime | Auto     | Webhook received time |
| createdAt  | datetime | Auto     | Record creation       |

## Handled Event Types

| Event Type                      | Action                           |
| ------------------------------- | -------------------------------- |
| `payment_intent.succeeded`      | Update transaction, grant access |
| `payment_intent.failed`         | Mark failed, notify member       |
| `customer.subscription.updated` | Sync subscription status         |
| `customer.subscription.deleted` | Cancel membership                |
| `charge.refunded`               | Process refund                   |
| `invoice.payment_succeeded`     | Extend membership                |
| `invoice.payment_failed`        | Trigger grace period             |

## Business Rules

* Events are idempotent (check stripeEventId)
* Failed events retry up to 3 times
* Events logged for audit trail

## Features

### Stripe Webhook Event

#### Acceptance Criteria

##### Frontend

* [ ] Admin/client UI can view and manage `Stripe Webhook Event` records where applicable.

##### Backend / API

* [ ] CRUD operations exist for `Stripe Webhook Event` (create, read, update, delete/archive).

##### Permissions

* [ ] Access is restricted to appropriate roles (tenant-scoped).

##### Business Rules

* [ ] Fields and relationships documented on this page are enforced for `Stripe Webhook Event`.

##### Error Handling

* [ ] Invalid payloads return field-level validation errors.
