{"id":13509586,"url":"https://github.com/era/pay","last_synced_at":"2026-01-17T15:46:33.833Z","repository":{"id":68490047,"uuid":"43459534","full_name":"era/pay","owner":"era","description":"Pay is an Elixir Lib to deal with Paypal and other payment solutions.","archived":false,"fork":false,"pushed_at":"2017-09-23T11:41:57.000Z","size":45,"stargazers_count":26,"open_issues_count":5,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-22T13:34:00.384Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/era.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-09-30T21:13:26.000Z","updated_at":"2023-06-07T13:53:40.000Z","dependencies_parsed_at":"2023-06-09T00:45:39.256Z","dependency_job_id":null,"html_url":"https://github.com/era/pay","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/era%2Fpay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/era%2Fpay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/era%2Fpay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/era%2Fpay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/era","download_url":"https://codeload.github.com/era/pay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246324127,"owners_count":20759079,"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":[],"created_at":"2024-08-01T02:01:09.958Z","updated_at":"2026-01-17T15:46:33.780Z","avatar_url":"https://github.com/era.png","language":"Elixir","funding_links":[],"categories":["Third Party APIs"],"sub_categories":[],"readme":"![](eric.jpeg) \nPay\n===\n\nPay is an Elixir Lib to deal with Paypal and other payment solutions. The lib's main goal is to be easy to extend other payment solutions.\n\nIt also uses Maru to receive the callback from the payment, so you don't need to worry about it. Just add the function that you want to run everytime that a payment is confirmed (or denied). {TODO}\n\nUsage\n-------\n\nCreating a Payment (you must use the PaypalPayment struct):\n\n```elixir\nPayment.create_payment(%Paypal.Payment{intent: \"authorize\", payer: %{\"funding_instruments\" =\u003e [%{\"credit_card\" =\u003e %{\"billing_address\" =\u003e %{\"city\" =\u003e \"Saratoga\", \"country_code\" =\u003e \"US\", \"line1\" =\u003e \"111 First Street\", \"postal_code\" =\u003e \"95070\", \"state\" =\u003e \"CA\"}, \"cvv2\" =\u003e \"874\", \"expire_month\" =\u003e 11, \"expire_year\" =\u003e 2018, \"first_name\" =\u003e \"Betsy\", \"last_name\" =\u003e \"Buyer\", \"number\" =\u003e \"4417119669820331\", \"type\" =\u003e \"visa\"}}], \"payment_method\" =\u003e \"credit_card\"}, transactions: [%{\"amount\" =\u003e %{\"currency\" =\u003e \"USD\", \"details\" =\u003e %{\"shipping\" =\u003e \"0.03\", \"subtotal\" =\u003e \"7.41\", \"tax\" =\u003e \"0.03\"}, \"total\" =\u003e \"7.47\"}, \"description\" =\u003e \"This is the payment transaction description.\"}]})\n\n```\nor if using Paypal as the payment method:\n```elixir\n# create payment\npayment = Payment.create_payment(%Paypal.Payment{\n  intent: \"sale\",\n  payer: %{\"payment_method\" =\u003e \"paypal\"},\n  transactions: [%{\"amount\" =\u003e %{\"currency\" =\u003e \"USD\", \"details\" =\u003e %{\"shipping\" =\u003e \"0.03\", \"subtotal\" =\u003e \"7.41\", \"tax\" =\u003e \"0.03\"}, \"total\" =\u003e \"7.47\"}, \"description\" =\u003e \"This is the payment transaction description.\"}],\n  redirect_urls: %{\"return_url\" =\u003e \"http://YOUR_RETURN_URL\", \"cancel_url\" =\u003e \"http://YOUR_CANCEL_URL\"}\n})\napproval_url = Enum.find(payment[\"links\"], fn (x) -\u003e x[\"rel\"] == \"approval_url\" and x[\"method\"] == \"REDIRECT\" end)\n# redirect user to approval_url[\"href\"]\n# after user has approved the payment, we can execute it on return url call.\nPayment.execute_payment(%Paypal.Payment{id: \"PAYMENT_ID_FROM_RETURN_CALL\", payer: %{id: \"PAYER_ID_FROM_RETURN_CALL\"}})\n```\n\nthen add the `pay` to your `config/config.exs`\n```elixir\nconfig :pay, type: :paypal\n```\nAnd also your key from paypal:\n```elixir\nconfig :pay, :paypal,\n  client_id: \"EOJ2S-Z6OoN_le_KS1d75wsZ6y0SFdVsY9183IvxFyZp\",\n  secret: \"EClusMEUk8e9ihI7ZdVLF5cZ6y0SFdVsY9183IvxFyZp\",\n  env: :prod\n```\n\nIn your mix file:\n\n```elixir\ndef deps do\n  [{:pay, github: \"era/pay\"}]\nend\n\n\ndef application do\n  [applications: [:pay]]\nend\n```\n\nPhoenix + Pay\n----\nIf you want an example of how to use it, take a look at [era/extip](http://www.github.com/era/extip). It's a very simple example of how to use pay with Phoenix Apps.\n\nContributing\n------------\n\n  * Fork it\n  * Create your feature branch (`git checkout -b my-new-feature`)\n  * Create a Pull Request\n\n\nTODO\n---\n* Support all Paypal API.\n* Add pagar.me support.\n* Add pagseguro support.\n\nLicense\n-----\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fera%2Fpay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fera%2Fpay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fera%2Fpay/lists"}