ExShopifyApp.Billing.Subscription (ex_shopify_app v1.2.0)
Reads the merchant's active app subscription from the Shopify Admin API.
This is the generic plumbing for "which plan is the merchant on?" — it returns the
active subscription's name, status, and current_period_end. Mapping the plan
name to allowances, prices, or upgrade rules is host-app policy and stays out of
the library.
The current_period_end is the end of the current billing cycle, useful for
scoping a per-cycle idempotency key when reporting the billing meter (see
ExShopifyApp.AppEvents).
Summary
Functions
Fetches the merchant's active Shopify subscription.
Builds a Subscription struct from the GraphQL response.
Types
Functions
@spec fetch_active(ExShopifyApp.Shop.authorized()) :: {:ok, t()} | {:error, :no_subscription | term()}
Fetches the merchant's active Shopify subscription.
Performs a network round-trip to the Admin GraphQL API; no special scope is required.
Returns:
{:ok, %Subscription{}}when the merchant has an active subscription.{:error, :no_subscription}when there is no active subscription (e.g. a development store with no paid plan).{:error, {:graphql, errors}}when the API returns GraphQL errors on a 200.{:error, reason}on a transport error or a non-200 response (theTesla.Env).
Builds a Subscription struct from the GraphQL response.