{"id":33901177,"url":"https://github.com/tachyon322/yookassa-elixir-api","last_synced_at":"2026-04-05T11:32:12.062Z","repository":{"id":322305368,"uuid":"1088973896","full_name":"tachyon322/yookassa-elixir-api","owner":"tachyon322","description":"An Elixir client for the YooKassa API v3.","archived":false,"fork":false,"pushed_at":"2025-11-05T13:33:51.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-12T00:51:16.480Z","etag":null,"topics":["elixir","yookassa-api"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/yookassa/readme.html","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/tachyon322.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-03T17:57:29.000Z","updated_at":"2025-11-05T14:01:01.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tachyon322/yookassa-elixir-api","commit_stats":null,"previous_names":["tachyon322/yookassa-elixir-api"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tachyon322/yookassa-elixir-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tachyon322%2Fyookassa-elixir-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tachyon322%2Fyookassa-elixir-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tachyon322%2Fyookassa-elixir-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tachyon322%2Fyookassa-elixir-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tachyon322","download_url":"https://codeload.github.com/tachyon322/yookassa-elixir-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tachyon322%2Fyookassa-elixir-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31434624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T08:13:15.228Z","status":"ssl_error","status_checked_at":"2026-04-05T08:13:11.839Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","yookassa-api"],"created_at":"2025-12-11T23:53:51.442Z","updated_at":"2026-04-05T11:32:12.053Z","avatar_url":"https://github.com/tachyon322.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yookassa Elixir Client\n\nAn idiomatic Elixir client for the YooKassa API v3. This library provides a simple and convenient way to integrate YooKassa payment processing into your Elixir applications.\n\n## Features\n\n- Create one-stage and two-stage payments.\n- Capture or cancel authorized payments.\n- Create full and partial refunds.\n- Get details for any payment or refund.\n- Includes a ready-to-use Plug for handling webhook notifications.\n\n## Installation\n\nAdd `yookassa` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:yookassa, \"~\u003e 0.1.4\"}\n  ]\nend\n```\n\nThen, run `mix deps.get`.\n\n## Configuration\n\nAdd the following configuration to your `config/dev.exs` (for development) or `config/releases.exs` (for production). Using environment variables for secrets is highly recommended.\n\n```elixir\n# in config/dev.exs\nimport Config\n\nconfig :yookassa,\n  shop_id: \"YOUR_SHOP_ID\",\n  secret_key: \"YOUR_TEST_SECRET_KEY\",\n  api_url: \"https://api.yookassa.ru/v3\"\n\n# Recommended for production:\n# config :yookassa,\n#   shop_id: System.get_env(\"YOOKASSA_SHOP_ID\"),\n#   secret_key: System.get_env(\"YOOKASSA_SECRET_KEY\"),\n#   api_url: \"https://api.yookassa.ru/v3\"\n```\n\n## Usage\n\nAll functions return `{:ok, response_body}` on success or `{:error, reason}` on failure.\nThe `response_body` is the decoded JSON from the YooKassa API.\n\n### Idempotency\n\nAll `POST` requests automatically include an `Idempotence-Key` header with a unique\nUUIDv4 value. This prevents accidental duplicate operations, ensuring that if a\nrequest is sent multiple times, it is processed only once.\n\n### Creating a Payment\n\nBy default, payments are created with `capture: true` (one-stage).\n\n```elixir\nYookassa.create_payment(\"199.50\", \"RUB\", \"https://example.com/thanks\", \"Order #72\")\n```\n\n### Two-Stage Payments\n\nTo create a two-stage payment, pass the `capture: false` option. This will authorize the amount on the user's card without charging it.\n\n```elixir\n# Step 1: Authorize the payment\n{:ok, payment} = Yookassa.create_payment(\"500.00\", \"RUB\", \"https://example.com/hold\", \"Table reservation\", capture: false)\npayment_id = payment[\"id\"]\n\n# After the user pays, the status will be \"waiting_for_capture\".\n# You can now either capture or cancel this payment.\n\n# Step 2 (Option A): Capture the payment to charge the card\n{:ok, captured_payment} = Yookassa.capture_payment(payment_id)\n\n# Step 2 (Option B): Cancel the authorization\n{:ok, canceled_payment} = Yookassa.cancel_payment(payment_id)\n```\n\n### Creating a Refund\n\nYou can only refund payments with a `succeeded` status.\n\n```elixir\n{:ok, refund} = Yookassa.create_refund(\"succeeded_payment_id\", \"50.00\", \"RUB\")\n```\n\n### Getting Information\n\n```elixir\n# Get details about a specific payment\n{:ok, payment_info} = Yookassa.get_payment_info(\"any_payment_id\")\n\n# Get details about a specific refund\n{:ok, refund_info} = Yookassa.get_refund_info(\"any_refund_id\")\n```\n\n## Handling Webhooks (Optional)\n\nThis library provides a `Yookassa.WebhookHandler` Plug to process incoming notifications. **This library does not start a web server for you.** You are responsible for integrating the handler into your own application.\n\n### Example with Plug and Cowboy\n\n1.  Add `:plug_cowboy` to your dependencies in `mix.exs`.\n2.  Add the server to your supervision tree in `lib/my_app/application.ex`. You can choose any port.\n\n    ```elixir\n    def start(_type, _args) do\n      children = [\n        # ... your other application processes ...\n        {Plug.Cowboy, scheme: :http, plug: Yookassa.WebhookHandler, options: [port: 8080]}\n      ]\n      Supervisor.start_link(children, opts)\n    end\n    ```\n3.  Set your YooKassa Webhook URL to: `https://your-domain.com/webhook`\n\n### Example with Phoenix Framework\n\n1.  Add the route to your `lib/my_app_web/router.ex`. You can choose any path.\n\n    ```elixir\n    post \"/yookassa_notifications\", to: Yookassa.WebhookHandler\n    ```\n2.  Set your YooKassa Webhook URL to: `https://your-domain.com/yookassa_notifications`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftachyon322%2Fyookassa-elixir-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftachyon322%2Fyookassa-elixir-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftachyon322%2Fyookassa-elixir-api/lists"}