ShopifexWeb.PaymentController behaviour (Shopifex v2.2.2) View Source
You can use this module inside of another controller to handle initial iFrame load and shop installation
Example:
mix phx.gen.html Shops Plan plans name:string price:string features:array grants:array test:boolean mix phx.gen.html Shops Grant grants shop:references:shops charge_id:integer grants:array
defmodule MyAppWeb.PaymentController do
use MyAppWeb, :controller
use ShopifexWeb.PaymentController
# Thats it! You can now configure your purchasable products :)
end
Link to this section Summary
Callbacks
An optional callback called after a payment is completed. By default, this function redirects the user to the app index within their Shopify admin panel.
Display the available payment plans for the user to select.
Given a shop and plan, return boolean for whether the charge should be created as a test charge.
Link to this section Callbacks
Specs
after_payment( Plug.Conn.t(), Ecto.Schema.t(), Ecto.Schema.t(), Ecto.Schema.t(), String.t() ) :: Plug.Conn.t()
An optional callback called after a payment is completed. By default, this function redirects the user to the app index within their Shopify admin panel.
Example
def after_payment(conn, shop, plan, grant, redirect_after) do
# send yourself an e-mail about payment
# follow default behaviour.
super(conn, shop, plan, grant, redirect_after)
end
Specs
render_plans( conn :: Plug.Conn.t(), guard_identifier :: String.t(), redirect_after :: String.t() ) :: Plug.Conn.t()
Display the available payment plans for the user to select.
Specs
test_charge?(shop :: Ecto.Schema.t(), plan :: map()) :: boolean()
Given a shop and plan, return boolean for whether the charge should be created as a test charge.