{"id":23158589,"url":"https://github.com/smartpay-co/sdk-ruby","last_synced_at":"2026-06-20T06:32:07.441Z","repository":{"id":42019962,"uuid":"392899543","full_name":"smartpay-co/sdk-ruby","owner":"smartpay-co","description":"Smartpay Ruby SDK","archived":false,"fork":false,"pushed_at":"2024-05-24T07:20:58.000Z","size":154,"stargazers_count":0,"open_issues_count":6,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-12-05T01:44:02.710Z","etag":null,"topics":["ruby","smartpay","smartpay-sdk"],"latest_commit_sha":null,"homepage":"https://docs.smartpay.co/integration","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/smartpay-co.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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-08-05T04:17:11.000Z","updated_at":"2022-11-01T09:36:42.000Z","dependencies_parsed_at":"2025-04-04T18:41:52.148Z","dependency_job_id":null,"html_url":"https://github.com/smartpay-co/sdk-ruby","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/smartpay-co/sdk-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartpay-co%2Fsdk-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartpay-co%2Fsdk-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartpay-co%2Fsdk-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartpay-co%2Fsdk-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smartpay-co","download_url":"https://codeload.github.com/smartpay-co/sdk-ruby/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartpay-co%2Fsdk-ruby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34560265,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["ruby","smartpay","smartpay-sdk"],"created_at":"2024-12-17T22:20:27.036Z","updated_at":"2026-06-20T06:32:07.406Z","avatar_url":"https://github.com/smartpay-co.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smartpay Ruby Library\n\nThe Smartpay Ruby library offers easy access to Smartpay API from applications written in Ruby.\n\n## Documentation\n\n- [Payment Flow](https://docs.smartpay.co/#payment_flow)\n- [API Document](https://api-doc.smartpay.co)\n\n## Requirements\n\n- Ruby 2.6+\n- Smartpay `API keys \u0026 secrets`. You can find your credential at the `settings \u003e credentials` page on your [dashboard](https://dashboard.smartpay.co/settings/credentials).\n\n## Installation\n\nIf you use system built-in Ruby, you might need to be the `sudoer` to be able to `sudo` in some of the following steps. We recommend you to use either [rbenv](https://github.com/rbenv/rbenv) or [rvm](https://rvm.io/) to have your own non-global Ruby to avoid potential permission issues.\n\nOnce you have your Ruby in place, add the latest version of Smartpay to your project's dependencies:\n\n```sh\ngem install smartpay\n```\n\nIf you want to build the gem yourself from source:\n\n```sh\ngem build smartpay.gemspec\n```\n\n### Bundler\n\nIf you are installing via bundler, make sure that you use the `https` resource in your Gemfile to avoid the risk of gems being compromised:\n\n```ruby\nsource 'https://rubygems.org'\n\ngem 'smartpay'\n```\n\n## Usage\n\nThe package needs to be configured with your own API keys, you can find them on your [dashboard](https://dashboard.smartpay.co/settings/credentials).\n\n```ruby\nSmartpay.configure do |config|\n  config.public_key = '\u003cYOUR_PUBLIC_KEY\u003e' # the one starts with pk_test_\n  config.secret_key = '\u003cYOUR_SECRET_KEY\u003e' # the one starts with sk_test_\nend\n```\n\n### Create Checkout session\n\nYou can find the description and requirement for request payload in [API Document](https://api-doc.smartpay.co/#8a3538b1-530c-448c-8bae-4a41cdf0b8fd).\n\n```ruby\npayloaad = {\n          currency: \"JPY\",\n          items: [\n            {\n              name: \"オリジナルス STAN SMITH\",\n              amount: 1000,\n              currency: \"JPY\",\n              quantity: 1\n            },\n            {\n              currency: \"JPY\",\n              amount: 500,\n              name: \"Merchant special discount\",\n              kind: \"discount\"\n            },\n            {\n              currency: \"JPY\",\n              amount: 100,\n              name: \"explicit taxes\",\n              kind: \"tax\"\n            }\n          ],\n          customerInfo: {\n            accountAge: 20,\n            email: \"merchant-support@smartpay.co\",\n            firstName: \"田中\",\n            lastName: \"太郎\",\n            firstNameKana: \"たなか\",\n            lastNameKana: \"たろう\",\n            address: {\n              line1: \"北青山 3-6-7\",\n              line2: \"青山パラシオタワー 11階\",\n              subLocality: \"\",\n              locality: \"港区\",\n              administrativeArea: \"東京都\",\n              postalCode: \"107-0061\",\n              country: \"JP\"\n            },\n            dateOfBirth: \"1985-06-30\",\n            gender: \"male\"\n          },\n          shippingInfo: {\n            address: {\n              line1: \"北青山 3-6-7\",\n              line2: \"青山パラシオタワー 11階\",\n              subLocality: \"\",\n              locality: \"港区\",\n              administrativeArea: \"東京都\",\n              postalCode: \"107-0061\",\n              country: \"JP\"\n            },\n            feeAmount: 100,\n            feeCurrency: \"JPY\"\n          },\n\n          captureMethod: \"manual\",\n\n          reference: \"order_ref_1234567\",\n          successUrl: \"https://docs.smartpay.co/example-pages/checkout-successful\",\n          cancelUrl: \"https://docs.smartpay.co/example-pages/checkout-canceled\"\n        }\n```\n\nCreate a checkout session by using `Smartpay::Api.create_checkout_session` with your request payload.\n\n```ruby\nsession = Smartpay::Api.create_checkout_session(payload)\n```\n\nThen, you can redirect your customer to the session url by calling `redirect_url`:\n\n```ruby\nsession.redirect_url\n```\n\n## Use with your favorite frameworks\n\n### Ruby on Rails (RoR)\n\n#### Install Rails\n\n```sh\ngem install rails\n```\n\n#### Create your app\n\n```sh\nrails new app-with-smartpay\n```\n\n#### Add Smartpay\n\n```sh\ncd app-with-smartpay\nbundle add smartpay\n```\n\n#### Generator\n\n```sh\nbundle exec rails generate smartpay:install\n```\n\nThis introduces 4 changes for a pre-built Smartpay Checkout example:\n\n\u003e 1. A new initializer - `config/initializers/smartpay.rb`. You will have to update the `config.public_key` and `config.secret_key` with your own credentials to make this work.\n\u003e 2. A new controller - `app/controllers/smartpays_controller.rb`. This is where you can see how a Checkout session is configured \u0026 created.\n\u003e 3. A new view - `app/views/smartpays/index.html.erb`. The minimum frontend required.\n\u003e 4. A new route in config/routes.rb.\n\n#### Fill in your API keys\n\nEdit the keys with your own credentials in `config/initializers/smartpay.rb`.\n\n```ruby\n  ...\n  config.public_key = '\u003cYOUR_PUBLIC_KEY\u003e' # the one starts with pk_test_\n  config.secret_key = '\u003cYOUR_SECRET_KEY\u003e' # the one starts with sk_test_\n  ...\n```\n\n#### Start your server\n\n```sh\nbundle exec rails server\n```\n\n### Test with Checkout Session\n\nVisit [http://localhost:3000/smartpays](http://localhost:3000/smartpays).\n\nClick the `checkout` button on the page to be redirected to Smartpay's Checkout.\n\nTo try out different cases, you can use the following test credit cards for different cases:\n\n- Payment succeeds: `4242 4242 4242 4242`\n- Payment is declined: `4100 0000 0000 0019`\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/smartpay-co/sdk-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/smartpay-co/sdk-ruby/blob/master/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Smartpay project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/smartpay-co/sdk-ruby/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartpay-co%2Fsdk-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartpay-co%2Fsdk-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartpay-co%2Fsdk-ruby/lists"}