revenuecat_webhook_events API Postgres table
Processed RevenueCat webhook events, keyed by the provider event id.
Declared in packages/api-shared/src/schema/revenuecatWebhookEvents.ts
Description
RevenueCat delivers subscription lifecycle events (initial purchase, renewal, expiration, …) to POST /billing/revenuecat/webhook and retries on any non-2xx response, so the same event id can arrive more than once. This table makes webhook processing idempotent: the handler claims an event by inserting its eventId (conflict = already processed and skipped), and the row doubles as a lightweight audit trail of what the webhook resolved and did.
Columns
iduuid- primary key
- not null
- default gen_random_uuid()
Row id, distinct from RevenueCat's
eventId. Event listings page newest first by(eventTimestamp, id).event_idtext- not null
RevenueCat's globally-unique event id. Uniquely indexed; a second delivery of the same id is a no-op.
event_typetext- not null
RevenueCat event type (e.g.
INITIAL_PURCHASE,EXPIRATION).app_user_idtext- not null
RevenueCat App User ID on the event. Our client sets this to the buyer's global user id.
product_idtext- nullable
Provider product reported by RevenueCat, when present; for a
PRODUCT_CHANGE, this stores RevenueCat's destinationnew_product_id.storetext- nullable
Uppercase RevenueCat store that originated the event. This distinguishes device-store purchases from promotional and Stripe audit events.
environmenttext- nullable
Uppercase RevenueCat billing environment. Sandbox events are retained for audit but never represented as real paid totals.
currencytext- nullable
The provider-reported store transaction price, normalized to the ISO currency's minor unit.
price_in_purchased_currency_minorinteger- nullable
The provider-reported store transaction price, normalized to the ISO currency's minor unit.
period_typetext- nullable
RevenueCat's uppercase transaction period classification.
transaction_idtext- nullable
Provider transaction ids used to correlate the applied billing row back to RevenueCat/store history.
original_transaction_idtext- nullable
Provider transaction ids used to correlate the applied billing row back to RevenueCat/store history.
source_original_transaction_idtext- nullable
For a Play
PRODUCT_CHANGE, the locked predecessor token present when the change marker was processed.organization_iduuid- nullable
Organization the event was applied to, resolved from the
orgIdsubscriber attribute. Null when the event carried no resolvable org.source_organization_iduuid- nullable
Previous owner for a
TRANSFERevent. This lets both personal organizations retain an explicit move in billing history.outcometext- not null
How the handler dispositioned the event (
applied/ignored).event_timestamptimestamp- not null
Provider-reported event time. Used to reject stale, out-of-order deliveries: a transition is not applied when a newer event has already been applied to the same organization.
purchased_attimestamp- nullable
Provider-reported billing period bounds, when the event carries them.
expiration_attimestamp- nullable
Provider-reported billing period bounds, when the event carries them.
created_attimestamp- not null
- default now()
Server-side insertion timestamp.
Indexes
revenuecat_webhook_events_event_id_idx(event_id)- unique
revenuecat_webhook_events_timestamp_id_idx(event_timestamp, id)revenuecat_webhook_events_outcome_timestamp_id_idx(outcome, event_timestamp, id)revenuecat_webhook_events_org_timestamp_id_idx(organization_id, event_timestamp, id)revenuecat_webhook_events_source_org_timestamp_id_idx(source_organization_id, event_timestamp, id)revenuecat_webhook_events_native_route_idx(app_user_id, original_transaction_id, store, outcome)