{"id":26767750,"url":"https://github.com/ministryofjustice/govuk-pay-ruby-client","last_synced_at":"2025-04-15T14:40:54.647Z","repository":{"id":56875041,"uuid":"269070985","full_name":"ministryofjustice/govuk-pay-ruby-client","owner":"ministryofjustice","description":"Ruby client for GOV.UK Pay API (basic functionality)","archived":false,"fork":false,"pushed_at":"2022-01-26T12:38:35.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-27T15:10:18.956Z","etag":null,"topics":["payments","ruby","x-justice-delivery-team"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/ministryofjustice.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-03T11:33:36.000Z","updated_at":"2024-04-23T05:41:24.000Z","dependencies_parsed_at":"2022-08-20T10:40:35.104Z","dependency_job_id":null,"html_url":"https://github.com/ministryofjustice/govuk-pay-ruby-client","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ministryofjustice%2Fgovuk-pay-ruby-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ministryofjustice%2Fgovuk-pay-ruby-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ministryofjustice%2Fgovuk-pay-ruby-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ministryofjustice%2Fgovuk-pay-ruby-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ministryofjustice","download_url":"https://codeload.github.com/ministryofjustice/govuk-pay-ruby-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249090990,"owners_count":21211269,"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":["payments","ruby","x-justice-delivery-team"],"created_at":"2025-03-28T21:17:29.412Z","updated_at":"2025-04-15T14:40:54.627Z","avatar_url":"https://github.com/ministryofjustice.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GOV.UK Pay ruby client (basic functionality)\n\n[![Gem Version](https://badge.fury.io/rb/govuk-pay-ruby-client.svg)](https://badge.fury.io/rb/govuk-pay-ruby-client)\n\nThis is a basic little gem to serve as an API client for [GOV.UK Pay](https://www.payments.service.gov.uk).\n\nCurrently it supports:\n\n* Create a credit card payment\n* Get payment details by ID\n\nIt might support more operations in the future.\n\nIt is not intended to be a full featured API client and in fact is made simple on purpose. There are other clients out there with more functionality.\n\n## Installation\n\nPrior to usage a GOV.UK Pay account must be created. This will provide the API credentials needed in you application.\n\nYou can then install the gem or require it in your application.\n\n```ruby\ngem 'govuk-pay-ruby-client'\n```\n\n## Usage\n\n### Configuration\n\nYou need to configure the client before you can use it. You can do this, for example with an initializer:\n\n```ruby\nrequire 'payments_api'\n\nPaymentsApi.configure do |config|\n  config.api_key = ENV['GOVUK_PAY_API_KEY']\nend\n````\n\nThere are several options you can configure, like open and read timeouts, logging, and more. Please refer to the [Configuration class](lib/payments_api/configuration.rb) for more details.\n\n### Creating a payment\n\nRefer to the [API documentation](https://govukpay-api-browser.cloudapps.digital/#create-a-payment) to know the properties you can post.\n\n```ruby\nresponse = PaymentsApi::Requests::CreateCardPayment.new(\n  amount: 215_00,\n  description: 'Payment description',\n  reference: 'Payment reference',\n  return_url: 'https://myservice.justice.uk',\n  \n  # Any other optional properties, for example:\n  email: 'user@test.com',\n  metadata: {\n    foo: 'bar',\n  }\n).call\n```\n\nThis will return a `Responses::PaymentResult` class with the API response mapped to instance attributes, and some helper methods. For example:\n\n```ruby\nresponse.payment_id  # \"1234567890\"\nresponse.state       # {\"status\"=\u003e\"created\", \"finished\"=\u003efalse}\nresponse.status      # \"created\"\nresponse.finished?   # false\nresponse.payment_url # URL where to redirect your user to complete the payment\n```\n\n### Retrieving a payment\n\nRefer to the [API documentation](https://govukpay-api-browser.cloudapps.digital/#get-a-payment) for more details.\n\n```ruby\nresponse = PaymentsApi::Requests::GetCardPayment.new(\n  payment_id: '1234567890'\n).call\n```\n\nThis, as with the create action, will return a `Responses::PaymentResult` class with the API response mapped to instance attributes, and some helper methods. For example:\n\n```ruby\nresponse.payment_id # \"1234567890\"\nresponse.state      # {\"status\"=\u003e\"success\", \"finished\"=\u003etrue}\nresponse.status     # \"success\"\nresponse.finished?  # true\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nThis gem uses rubocop and simplecov (at 100% coverage).\n\n## Contributing\n\nBug reports and pull requests are welcome.\n\n1. Fork the project\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit until you are happy with your contribution (`git commit -am 'Add some feature'`)\n4. Push the branch (`git push origin my-new-feature`)\n5. Make sure your changes are covered by tests, so that we don't break it unintentionally in the future.\n6. Create a new pull request.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fministryofjustice%2Fgovuk-pay-ruby-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fministryofjustice%2Fgovuk-pay-ruby-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fministryofjustice%2Fgovuk-pay-ruby-client/lists"}