Coffrify.Resources.Billing (Coffrify v0.9.0)

View Source

Stripe-backed billing — subscription, usage, address, portal/checkout links.

Summary

Functions

Mint a Stripe Checkout URL for upgrading to Pro or Ultra.

Mint a Stripe Customer Portal URL.

Fetch the billing address.

Fetch the current Stripe subscription.

List metered usage rows (per period).

Update the billing address.

Functions

create_checkout_link(client, opts)

@spec create_checkout_link(Coffrify.t(), map() | keyword()) ::
  {:ok, map()} | {:error, Exception.t()}

Mint a Stripe Checkout URL for upgrading to Pro or Ultra.

create_portal_link(client, opts \\ [])

@spec create_portal_link(
  Coffrify.t(),
  keyword()
) :: {:ok, map()} | {:error, Exception.t()}

Mint a Stripe Customer Portal URL.

get_address(client)

@spec get_address(Coffrify.t()) :: {:ok, map()} | {:error, Exception.t()}

Fetch the billing address.

get_subscription(client)

@spec get_subscription(Coffrify.t()) :: {:ok, map()} | {:error, Exception.t()}

Fetch the current Stripe subscription.

get_usage(client, opts \\ [])

@spec get_usage(
  Coffrify.t(),
  keyword()
) :: {:ok, map()} | {:error, Exception.t()}

List metered usage rows (per period).

update_address(client, patch)

@spec update_address(Coffrify.t(), map()) :: {:ok, map()} | {:error, Exception.t()}

Update the billing address.