ShopifexWeb.PaymentHTML (Shopifex v3.0.0)

Copy Markdown View Source

HTML for the plans/billing page rendered by ShopifexWeb.PaymentController.

Summary

Functions

The deduped list of grant identifiers the shop currently holds.

The shop's current grants as a comma-joined string (kept for back-compat).

True when plan grants exactly the shop's current grant set (the active plan).

The plans available for guard, as schema structs, for server rendering.

Human price label, e.g. $9.99/month, €100/year, or $390 one-time.

The URL the plans page's Select button POSTs {plan_id, redirect_after} to.

Functions

api_key()

current_grant_list(conn)

The deduped list of grant identifiers the shop currently holds.

current_grants(conn)

The shop's current grants as a comma-joined string (kept for back-compat).

current_plan?(conn, plan)

True when plan grants exactly the shop's current grant set (the active plan).

path_prefix()

payment_guard()

plans_for_guard(conn, guard)

The plans available for guard, as schema structs, for server rendering.

price_label(plan)

Human price label, e.g. $9.99/month, €100/year, or $390 one-time.

select_plan_path(conn)

@spec select_plan_path(Plug.Conn.t()) :: String.t()

The URL the plans page's Select button POSTs {plan_id, redirect_after} to.

Inside the Shopify admin, App Bridge attaches the Bearer id_token to that fetch, so a page that was authenticated with an id_token gets the bare /payment/select-plan path. A page authenticated without one (the non-embedded / legacy HMAC path, reached through the payment guard's redirect_token) has nothing for App Bridge to attach, so the path carries its own redirect_token from Shopifex.Plug.sign_redirect/3: signed for the current shop, bound to this one path, and valid for 3600 seconds. Because the token authenticates only this path for only this shop, a captured page can at most start a pending charge that the merchant must still approve in Shopify.

shop_url(conn)

show_plans(assigns)