{"id":16611341,"url":"https://github.com/shufo/paidy-elixir","last_synced_at":"2025-03-21T14:31:05.771Z","repository":{"id":23101450,"uuid":"98127220","full_name":"shufo/paidy-elixir","owner":"shufo","description":"An Elixir library for working with Paidy","archived":false,"fork":false,"pushed_at":"2023-12-15T08:56:51.000Z","size":62,"stargazers_count":2,"open_issues_count":11,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T11:11:29.817Z","etag":null,"topics":["elixir"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/paidy","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/shufo.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-23T21:43:20.000Z","updated_at":"2021-01-18T09:50:41.000Z","dependencies_parsed_at":"2024-10-28T10:29:55.606Z","dependency_job_id":"999e216d-f4d3-46d9-8b4a-2af6bd6f5f45","html_url":"https://github.com/shufo/paidy-elixir","commit_stats":{"total_commits":26,"total_committers":2,"mean_commits":13.0,"dds":"0.11538461538461542","last_synced_commit":"7e61990209339cf01dc88504855b29402526c09f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shufo%2Fpaidy-elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shufo%2Fpaidy-elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shufo%2Fpaidy-elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shufo%2Fpaidy-elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shufo","download_url":"https://codeload.github.com/shufo/paidy-elixir/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244815122,"owners_count":20514893,"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"],"created_at":"2024-10-12T01:36:44.672Z","updated_at":"2025-03-21T14:31:05.485Z","avatar_url":"https://github.com/shufo.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Paidy for Elixir\n\n![GitHub Workflow Status](https://img.shields.io/github/workflow/status/shufo/paidy-elixir/CI)\n[![Hex.pm](https://img.shields.io/hexpm/v/paidy.svg)](https://hex.pm/packages/paidy)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-9768d1.svg)](https://hexdocs.pm/paidy)\n[![Coverage Status](https://coveralls.io/repos/github/shufo/paidy-elixir/badge.svg?branch=master)](https://coveralls.io/github/shufo/paidy-elixir?branch=master)\n\nAn Elixir library for working with [Paidy](https://paidy.com/).\n\n## Features\n\n### Payments\n* create a payment\n* retrieve a payment\n* update a payment\n* capture a payment\n* refund/partially refund a payment\n* close a payment\n\n### Tokens\n* retrieve a token\n* retrieve all tokens\n* suspend a token\n* resume a token\n* delete a token\n\n\n## Installation\n\n\n```elixir\ndef deps do\n  [{:paidy, \"~\u003e 0.2.0\"}]\nend\n```\n\n## Usage\n\n### Create a payment\n\n```elixir\nparams = %{\n  amount: 12500,\n  shipping_address: %{\n      line1: \"AXIS building 10F\",\n      line2: \"roppongi 4-22-1\",\n      state: \"Minato-ku\",\n      city: \"Tokyo\",\n      zip: \"106-2004\"\n  },\n  order: %{\n      order_ref: \"your_order_ref\",\n      items: [%{\n              quantity: 1,\n              id: \"PDI001\",\n              title: \"Paidy shoes\",\n              description: \"Paidy shoes\",\n              unit_price: 12000\n          }],\n      tax: 300,\n      shipping: 200\n  },\n  store_name: \"Paidy sample store\",\n  buyer_data: %{\n      age: 29,\n      order_count: 1000,\n      ltv: 250000,\n      last_order_amount: 20000,\n      last_order_at: 20\n  },\n  description: \"hoge\",\n  token_id: \"tok_foobar\",\n  currency: \"JPY\",\n  metadata: %{}\n}\n\n{:ok, payment} = Paidy.Payment.create(params)\n```\n\n### Retrieve a payment\n\n```elixir\n{:ok, payment} = Paidy.Payment.get(\"payment_id\")\n```\n\n### Update a payment\n\n```elixir\nparams = %{\n  description: \"Changed payment\"\n}\n\n{:ok, payment} = Paidy.Payment.change(\"payment_id\", params)\n```\n\n### Capture a payment\n\n```elixir\n{:ok, captured} = Paidy.Payment.capture(\"payment_id\")\n```\n\n### Refund a payment\n\n```elixir\n{:ok, payment} = Paidy.Payment.capture(\"payment_id\")\ncapture_id = payment.captures |\u003e List.first |\u003e Map.get(\"id\")\n\n{:ok, payment} = Paidy.Payment.refund(\"payment_id\", capture_id)\n```\n\n### Partially refund a payment\n\n```elixir\n{:ok, payment} = Paidy.Payment.capture(\"payment_id\")\ncapture_id = payment.captures |\u003e List.first |\u003e Map.get(\"id\")\n\n{:ok, payment} = Paidy.Payment.refund(\"payment_id\", capture_id, 500)\n```\n\n### Close a payment\n\n```elixir\n{:ok, payment} = Paidy.Payment.close(\"payment_id\")\n```\n\n### Retrieve a token\n\n```elixir\n{:ok, token} = Paidy.Token.get \"token_id\"\n```\n\n### Retrieve all tokens\n\n```elixir\n{:ok, tokens} = Paidy.Token.all\n```\n\n### Suspend a token\n\n```elixir\nparams = %{\n  reason: %{\n    code: \"fraud.suspected\",\n    description: \"Token suspended because fraud suspected.\"\n  }\n}\n\n{:ok, token} = Paidy.Token.suspend \"token_id\", params\n```\n\n### Resume a token\n\n```elixir\nparams = %{\n  reason: %{\n    code: \"merchant.requested\",\n    description: \"Token is being resumed because the subscription item is back in stock\"\n  }\n}\n\n{:ok, token} = Paidy.Token.resume \"token_id\", params\n```\n\n### Delete a token\n\n```elixir\n{:ok, token} = Paidy.Token.delete \"token_id\", params\n```\n\n## Testing\nIf you start contributing and you want to run mix test, first you need to export PAIDY_SECRET_KEY environment variable in the same shell as the one you will be running mix test in.\n\n```bash\nexport PAIDY_SECRET_KEY=\"yourkey\"\nmix test\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshufo%2Fpaidy-elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshufo%2Fpaidy-elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshufo%2Fpaidy-elixir/lists"}