Shopifex.Plug.PaymentGuard (Shopifex v2.2.1) View Source

Add payment guards to your routes or controllers!

Examples:

defmodule MyAppWeb.AdminLinkController do
  use MyAppWeb, :controller
  require Logger

  plug Shopifex.Plug.PaymentGuard, "premium_plan" when action in [:premium_function]

  def premium_function(conn, _params) do
    # Wow, much premium.
    conn
    |> send_resp(200, "success")
  end
end

Link to this section Summary

Functions

This makes sure the shop in the session contains a payment which unlocks the guard.

Link to this section Functions

Link to this function

call(conn, guard_identifier)

View Source

This makes sure the shop in the session contains a payment which unlocks the guard.

If no payment is present which unlocks the guard, the conn will be redirected to your application's PaymentController.show_plans route.