RevenueCat (revenue_cat v0.1.0)

Copy Markdown View Source

RevenueCat V2 API client focused on entitlement checks and customer deletion.

Supports global config, per-call overrides, and reusable client structs.

Summary

Functions

Deletes a customer in RevenueCat.

Deletes a customer using per-call options.

Checks whether a customer currently has an active entitlement.

Checks active entitlement using per-call options.

Builds a reusable client struct.

Types

option_key()

@type option_key() :: :secret_api_key | :project_id | :base_url | :req_options

options()

@type options() :: [{option_key(), term()}]

t()

@type t() :: %RevenueCat{
  base_url: String.t(),
  project_id: nil | String.t(),
  req_options: keyword(),
  secret_api_key: nil | String.t()
}

Functions

delete_customer(app_user_id)

Deletes a customer in RevenueCat.

Returns :ok when RevenueCat responds with 200, 204, or 404.

delete_customer(app_user_id, opts)

@spec delete_customer(String.t(), options()) :: :ok | {:error, term()}
@spec delete_customer(t(), String.t()) :: :ok | {:error, term()}

Deletes a customer using per-call options.

Options override app config for this call.

has_active_entitlement(app_user_id, configured_entitlement)

Checks whether a customer currently has an active entitlement.

configured_entitlement may be an entitlement ID, lookup key, or display name. Returns {:ok, true | false} on successful API resolution.

has_active_entitlement(app_user_id, configured_entitlement, opts)

@spec has_active_entitlement(String.t(), String.t(), options()) ::
  {:ok, boolean()} | {:error, term()}
@spec has_active_entitlement(t(), String.t(), String.t()) ::
  {:ok, boolean()} | {:error, term()}

Checks active entitlement using per-call options.

Options override app config for this call.

new(opts \\ [])

@spec new(options()) :: t()

Builds a reusable client struct.

Options:

  • :secret_api_key
  • :project_id
  • :base_url (defaults to RevenueCat V2 API base URL)
  • :req_options (passed through to Req.get/2 and Req.delete/2)