{"id":21939194,"url":"https://github.com/grottopress/haystack","last_synced_at":"2025-04-22T14:50:11.691Z","repository":{"id":85788038,"uuid":"383774641","full_name":"GrottoPress/haystack","owner":"GrottoPress","description":"A low-level API client for Paystack","archived":false,"fork":false,"pushed_at":"2024-08-15T17:29:21.000Z","size":283,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-15T19:13:27.054Z","etag":null,"topics":["api","crystal","http-client","payment","paystack","rest"],"latest_commit_sha":null,"homepage":"","language":"Crystal","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/GrottoPress.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-07-07T11:26:59.000Z","updated_at":"2024-08-15T17:29:25.000Z","dependencies_parsed_at":"2024-03-30T15:31:04.894Z","dependency_job_id":null,"html_url":"https://github.com/GrottoPress/haystack","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrottoPress%2Fhaystack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrottoPress%2Fhaystack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrottoPress%2Fhaystack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrottoPress%2Fhaystack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GrottoPress","download_url":"https://codeload.github.com/GrottoPress/haystack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227025005,"owners_count":17719205,"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":["api","crystal","http-client","payment","paystack","rest"],"created_at":"2024-11-29T02:17:19.830Z","updated_at":"2024-11-29T02:17:21.858Z","avatar_url":"https://github.com/GrottoPress.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Haystack\n\n*Haystack* is a low-level API client for [*Paystack*](https://paystack.com). It features an intuitive interface that maps directly to the *Paystack* API.\n\n*Haystack* comes with a webhook handler that intercepts events received from *Paystack*, and allows you to perform actions based on the event type.\n\n### Usage Examples\n\n1. Create client:\n\n   ```crystal\n   paystack = Haystack.new(secret_key: \"secret-key\")\n   ```\n\n1. Create charge:\n\n   ```crystal\n   paystack.charges.create(\n     email: \"customer@email.com\",\n     amount: \"20000\"\n   ) do |response|\n     return puts response.message unless response.success?\n\n     response.data.try do |transaction|\n       puts transaction.transaction_date.try \u0026.second\n       puts transaction.subaccount.try \u0026.account_number\n       puts transaction.status\n       # ...\n     end\n   end\n   ```\n\n1. Initialize transaction:\n\n   ```crystal\n   paystack.transactions.initiate(\n     email: \"customer@email.com\",\n     amount: \"20000\",\n     currency: \"GHS\"\n   ) do |response|\n     return puts response.message unless response.success?\n\n     response.data.try do |authorization|\n       puts authorization.access_code\n       puts authorization.authorization_url\n       puts authorization.reference\n     # ...\n     end\n   end\n   ```\n\n1. Verify transaction:\n\n   ```crystal\n   paystack.transactions.verify(reference: \"abcdef\") do |response|\n     return puts response.message unless response.success?\n\n     response.data.try do |transaction|\n       puts transaction.status\n       puts transaction.authorization.try \u0026.authorization_code\n       puts transaction.channel\n     # ...\n     end\n   end\n   ```\n\n1. List invoices:\n\n   ```crystal\n   paystack.invoices.list(perPage: \"20\", page: \"2\") do |response|\n     return puts response.message unless response.success?\n\n     response.data.try \u0026.each do |invoice|\n       puts invoice.archived\n       puts invoice.currency\n       puts invoice.description\n       # ...\n     end\n   end\n   ```\n\n## Documentation\n\nFind the complete documentation in the `docs/` directory of this repository.\n\n## Development\n\n1. Copy your **test** secret key from your [Paystack dashboard](https://dashboard.paystack.com).\n\n1. Create a `.env.sh` file:\n\n   ```bash\n   #!/bin/bash\n   #\n   export PAYSTACK_SECRET_KEY='your-paystack-test-secret-key-here'\n   ```\n\n1. Update the file with your own details. Then run tests with `source .env.sh \u0026\u0026 crystal spec`.\n\n**IMPORTANT**: Remember to set permissions for your env file to `0600` or stricter: `chmod 0600 .env*`.\n\n## Contributing\n\n1. [Fork it](https://github.com/GrottoPress/haystack/fork)\n1. Switch to the `master` branch: `git checkout master`\n1. Create your feature branch: `git checkout -b my-new-feature`\n1. Make your changes, updating changelog and documentation as appropriate.\n1. Commit your changes: `git commit`\n1. Push to the branch: `git push origin my-new-feature`\n1. Submit a new *Pull Request* against the `GrottoPress:master` branch.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrottopress%2Fhaystack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrottopress%2Fhaystack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrottopress%2Fhaystack/lists"}