Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Silver

Silver a payment library for elixir.

Installation

If available in Hex, the package can be installed as:

  1. Add silver to your list of dependencies in mix.exs:

    def deps do [{:silver, "~> 0.0.1"}] end

  2. Ensure silver is started before your application:

    def application do [applications: [:silver]] end

Usage

Stripe

address = %Silver.Address {
  street1: "123 Street",
  street2: "",
  city: "Dubai",
  state: "Dubai",
  country: "UAE",
  postal_code: "10001",
  phone: ""
}

credit_card = %Silver.CreditCard {
  first_name: "John",
  last_name: "Doe",
  expiry_month: 07,
  expiry_year: 2021,
  type: "visa",
  number: 4032038439477542,
  cvv: 123
}

case CreditCard.valid?(credit_card) do
  {:ok, card} -> 
    # authorize using Silver.authorize() or make the purcahse
    Silver.charge(:stripe, 100.00, credit_card, address: address, description: "Frog Tshirt - Order # 1")
  {:error, errors} ->
    "Credit Card is not valid, do you have another one?"
end

Paypal example

Silver.authorize(:paypal, 7.47, credit_card, currency: "USD", description: "Payment Description.")

Note

Please note this is WIP, I am only working on it after hours, if you would like to sponser this project, please contact me.

License

MIT copyright @ al-razi (saytoally@hotmail.com)

About

Payment library for elixir and phoenix based on an existing library which is not open source - [WIP]

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages