# `Shopifex.Plug.PaymentGuard`
[🔗](https://github.com/ericdude4/shopifex/blob/main/lib/shopifex/plug/payment_guard.ex#L1)

Add payment guards to your routes or controllers!

## Examples:

```elixir
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
```

# `call`

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

If no payment is present which unlocks the guard (or remaining usages are exhausted),
the conn will be redirected to your application's PaymentController.show_plans route.

# `init`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
