{"id":13509445,"url":"https://github.com/swelham/cashier","last_synced_at":"2025-04-13T05:34:30.858Z","repository":{"id":57482266,"uuid":"74014059","full_name":"swelham/cashier","owner":"swelham","description":"Cashier is an Elixir library that aims to be an easy to use payment gateway, whilst offering the fault tolerance and scalability benefits of being built on top of Erlang/OTP","archived":false,"fork":false,"pushed_at":"2018-02-21T19:27:11.000Z","size":85,"stargazers_count":50,"open_issues_count":11,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-26T22:51:20.389Z","etag":null,"topics":["elixir","gateway","payment","payment-gateway","paypal"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swelham.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-17T10:00:18.000Z","updated_at":"2025-01-08T15:56:09.000Z","dependencies_parsed_at":"2022-09-02T04:20:12.518Z","dependency_job_id":null,"html_url":"https://github.com/swelham/cashier","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swelham%2Fcashier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swelham%2Fcashier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swelham%2Fcashier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swelham%2Fcashier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swelham","download_url":"https://codeload.github.com/swelham/cashier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670518,"owners_count":21142896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","gateway","payment","payment-gateway","paypal"],"created_at":"2024-08-01T02:01:07.869Z","updated_at":"2025-04-13T05:34:30.576Z","avatar_url":"https://github.com/swelham.png","language":"Elixir","funding_links":["https://api.sandbox.paypal.com"],"categories":["Third Party APIs"],"sub_categories":[],"readme":"# Cashier\n\n[![Build Status](https://travis-ci.org/swelham/cashier.svg?branch=master)](https://travis-ci.org/swelham/cashier) [![Deps Status](https://beta.hexfaktor.org/badge/all/github/swelham/cashier.svg?branch=master)](https://beta.hexfaktor.org/github/swelham/cashier) [![Hex Version](https://img.shields.io/hexpm/v/cashier.svg)](https://hex.pm/packages/cashier) [![Join the chat at https://gitter.im/swelham/cashier](https://badges.gitter.im/swelham/cashier.svg)](https://gitter.im/swelham/cashier?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![Open Source Helpers](https://www.codetriage.com/swelham/cashier/badges/users.svg)](https://www.codetriage.com/swelham/cashier)\n\nCashier is an Elixir library that aims to be an easy to use payment gateway, whilst offering the fault tolerance and scalability benefits of being built on top of Erlang/OTP\n\n# Usage\n\nThe following are basic usage examples on how to use cashier in it's current state. This library is being activily developed and is likely to \nchange as we move towards the first release.\n\n### Setup\n\nAdd cashier as a dependency\n```elixir\ndefp deps do\n  {:cashier, \"~\u003e 0.2.0\"}\nend\n```\n\nMake sure the cashier application gets started\n```elixir\ndef application do\n  [applications: [:cashier]]\nend\n```\n\n### Config options\n```elixir\nuse Mix.Config\n\n# cashier options\nconfig :cashier, :cashier,\n  defaults: [\n    currency: \"USD\",\n    gateway: :paypal,\n    timeout: 20_000 # this option is the OTP timeout setting\n  ],\n  # this option is passed directly into HTTPoison and can contain any\n  # of the valid options listed here - https://hexdocs.pm/httpoison/HTTPoison.html#request/5\n  http: [\n    recv_timeout: 20_000\n  ]\n\n# PayPal specific config\nconfig :cashier, :paypal,\n  # Please note the PayPal gateway currently only supports the /v1 endpoint\n  # and this is automattically added for you\n  url: \"https://api.sandbox.paypal.com\",\n  client_id: \"\u003cpaypal_client_id\u003e\",\n  client_secret: \"\u003cpaypal_client_secret\u003e\"\n```\n\n### Cashier request examples\n\n```elixir\nalias Cashier.Address\nalias Cashier.PaymentCard\n\naddress = %Address{\n    line1: \"123\",\n    line2: \"Main\",\n    city: \"New York\",\n    state: \"New York\",\n    country_code: \"US\",\n    postal_code: \"10004\"\n}\n\ncard = %PaymentCard{\n    holder: {\"John\", \"Smith\"},\n    brand: \"visa\",\n    number: \"4032030901103714\",\n    expiry: {11, 2021},\n    cvv: \"123\"\n}\n\n# Note: The result return type for each request is currently the decoded\n#       data returned from the payment provider, this will change in the future.\n\n# Purchase request\n# the card parameter can be either a %PaymentCard or stored card id \ncase Cashier.purchase(9.99, card, [billing_address: address]) do\n    {:ok, result}     -\u003e IO.inspect result\n    {:error, reason}  -\u003e IO.inspect reason\nend\n\n# Authorize request\n# the card parameter can be either a %PaymentCard or stored card id \ncase Cashier.authorize(9.99, card, [billing_address: address]) do\n    {:ok, result}     -\u003e IO.inspect result\n    {:error, reason}  -\u003e IO.inspect reason\nend\n\n# Capture request\ncase Cashier.capture(\"\u003ccapture_id\u003e\", 19.45, [final_capture: true]) do\n    {:ok, result}     -\u003e IO.inspect result\n    {:error, reason}  -\u003e IO.inspect reason\nend\n\n#Void request\ncase Cashier.void(\"\u003cvoid_id\u003e\") do\n    {:ok, result}     -\u003e IO.inspect result\n    {:error, reason}  -\u003e IO.inspect reason\nend\n\n#Refund request\ncase Cashier.refund(\"\u003crefund_id\u003e\", [amount: 9.99]) do\n    {:ok, result}     -\u003e IO.inspect result\n    {:error, reason}  -\u003e IO.inspect reason\nend\n\n#Store request\ncase Cashier.store(card, [billing_address: address]) do\n    {:ok, result}     -\u003e IO.inspect result\n    {:error, reason}  -\u003e IO.inspect reason\nend\n\n#Unstore request\ncase Cashier.unstore(\"\u003ccard_id\u003e\") do\n    :ok               -\u003e IO.puts \"card unstored\"\n    {:error, reason}  -\u003e IO.inspect reason\nend\n```\n\n# Todo\n\nAll current todo items are listed on the [issues page](https://github.com/swelham/cashier/issues).\n\nPlease add any issues, suggestions or feature requests to this page.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswelham%2Fcashier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswelham%2Fcashier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswelham%2Fcashier/lists"}