View Source ExCheckout

A general store checkout system



If available in Hex, the package can be installed by adding ex_checkout to your list of dependencies in mix.exs:

def deps do
    {:ex_checkout, ">= 0.0.0"}


Example implementation

defp function do
  alias ExCheckout.Server, as: Checkout
  alias ExCheckout.Transaction
  alias ExCheckout.Transaction.Paypal, as: Paypal

    customer = %{first_name: "mithereal", last_name: "nil", email: "", phone: "1234567"}
    items = [{"sku-123", 11.00}, {"sku-123-456", 15.00}]
    adjustments = []
    transaction_data = %{data: %{id: 12345, response: "JSON"}}

    {:ok, pid} =
   ## {:ok, pid} ="my_checkout")
   ## {pid, value} = ExCheckout.Cache.lookup("my_checkout")

    Checkout.customer(pid, customer)
    Checkout.items(pid, items)
    Checkout.adjustments(pid, adjustments)

    _subtotal = Checkout.subtotal(pid)

    total =

    _invoice = Checkout.invoice(pid)

  #select payment provider to await on the ipn data 
    Checkout.ipn(pid, Paypal)
  #incoming data from payment provider
    _state = Checkout.payment_transaction(pid, transaction_data)
#    _state = Checkout.payment_transaction("my_checkout", transaction_data)
   receipt = Checkout.receipt(pid)
  {:ok, receipt}


Custom Shipping Modules

there are 2 ways of setting up your own shipping module either specifying it in the config if its in its own namespace or creating a module in your project with following module naming conventions

defmodule applicationname.ExCheckout.Carrier.Modulename do

then set up the config carriers key to match the modules config() return. see the config, carrier/null or payment/null module for syntax examples,

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at