RevenueCat.Webhook (revenue_cat v0.1.0)

Copy Markdown View Source

RevenueCat webhook ingestion with deduplication and Ecto-backed persistence helpers.

This module:

  • validates and extracts webhook event payload fields
  • inserts or fetches webhook event rows idempotently by external_id
  • executes host-defined event handling exactly once per event row
  • marks rows as processed/failed with sync attempt metadata

Required options

  • :repo - your Ecto repo module
  • :schema - your webhook event schema module
  • :handle_event_fun - function (event_map, event_meta_map) -> :ok | {:error, reason}

Optional options

Summary

Types

webhook_result()

@type webhook_result() :: :processed | :duplicate

Functions

process(payload, opts)

@spec process(
  map(),
  keyword()
) :: {:ok, webhook_result()} | {:error, term()}