Commerce.Billing

Payment processing library for Elixir. Based on Shopify'sActiveMerchant ruby gem

Supported Gateways

Advantages of using Elixir

Card processing example

alias Commerce.Billing
alias Commerce.Billing.Response

config = %{credentials: {"sk_test_BQokikJOvBiI2HlWgH4olfQ2", ""},
           default_currency: "USD"}

Billing.Worker.start_link(Billing.Gateways.Stripe, config, name: :my_gateway)

card = %Billing.CreditCard{name: "John Smith",
                            number: "4242424242424242",
                            expiration: {2017, 12},
                            cvc: "123"}

address = %Billing.Address{street1: "123 Main",
                            city: "New York",
                            region: "NY",
                            country: "US",
                            postal_code: "11111"}

case Billing.authorize(:my_gateway, 199.95, card, billing_address: address,
                                                   description: "Amazing T-Shirt") do
  {:ok, %Response{authorization: authorization}} ->
    IO.puts("Payment authorized #{authorization}")

  {:error, %Response{code: :declined, reason: reason}} ->
    IO.puts("Payment declined #{reason}")

  {:error, %Response{code: error}} ->
    IO.puts("Payment error #{error}")
end

Road Map

@joshnuss is a freelance software consultant. joshnuss@gmail.com