RevenueCat (revenuecat v0.4.0)
Copy MarkdownMinimal RevenueCat client.
Exposes get_customer/1 (cached) and fetch_customer/1 (remote).
Summary
Functions
Fetch a single customer attribute struct by name.
Fetch the current offering struct from an Offerings struct.
Fetch a single entitlement struct by id.
Return the entitlements map from a customer.
Fetch a customer by app user id, bypassing the customer cache.
Get Offerings for a given app_user_id.
Get a customer by app user id, using the customer cache when possible.
Return true if the customer has the given entitlement id.
Return true if the customer has the given subscription id.
Fetch a single offering struct by id from an Offerings struct.
Fetch a single subscription struct by id.
Return the subscriptions map from a customer.
Update customer attributes and return the updated customer.
Types
@type entitlement_map() :: map()
Functions
@spec attribute(RevenueCat.Customer.t(), String.t() | atom()) :: RevenueCat.Customer.Attribute.t() | nil
Fetch a single customer attribute struct by name.
@spec current_offering(RevenueCat.Offerings.t()) :: RevenueCat.Offerings.Offering.t() | nil
Fetch the current offering struct from an Offerings struct.
@spec entitlement(RevenueCat.Customer.t() | map(), String.t() | atom()) :: RevenueCat.Customer.Entitlement.t() | nil
Fetch a single entitlement struct by id.
@spec entitlements(RevenueCat.Customer.t()) :: map()
Return the entitlements map from a customer.
Returns an empty map for non-customer inputs.
@spec fetch_customer(String.t()) :: {:ok, RevenueCat.Customer.t()} | {:error, term()}
Fetch a customer by app user id, bypassing the customer cache.
@spec fetch_offerings( String.t(), keyword() ) :: {:ok, RevenueCat.Offerings.t()} | {:error, term()}
Get Offerings for a given app_user_id.
This endpoint can optionally take a :platform (string) which will be sent
as the X-Platform header (lower-cased to x-platform), e.g. "ios".
@spec get_customer(String.t()) :: {:ok, RevenueCat.Customer.t()} | {:error, term()}
Get a customer by app user id, using the customer cache when possible.
@spec has_entitlement?(RevenueCat.Customer.t(), String.t() | atom()) :: boolean()
Return true if the customer has the given entitlement id.
@spec has_subscription?(RevenueCat.Customer.t(), String.t() | atom()) :: boolean()
Return true if the customer has the given subscription id.
@spec offering(RevenueCat.Offerings.t(), String.t() | atom()) :: RevenueCat.Offerings.Offering.t() | nil
Fetch a single offering struct by id from an Offerings struct.
@spec subscription(RevenueCat.Customer.t(), String.t() | atom()) :: RevenueCat.Customer.Subscription.t() | nil
Fetch a single subscription struct by id.
@spec subscriptions(RevenueCat.Customer.t()) :: map()
Return the subscriptions map from a customer.
Returns an empty map for non-customer inputs.
@spec update_customer_attributes(String.t(), map()) :: {:ok, RevenueCat.Customer.t()} | {:error, term()}
Update customer attributes and return the updated customer.