[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8040":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":17,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},8040,"stripe-ruby","stripe\u002Fstripe-ruby","stripe","Ruby library for the Stripe API.    ","https:\u002F\u002Fstripe.com",null,"Ruby",2139,652,62,19,0,1,23,30.44,"MIT License",false,"master",true,[7,25],"stripe-sdk","2026-06-12 02:01:48","# Stripe Ruby Library\n\n[![Gem Version](https:\u002F\u002Fbadge.fury.io\u002Frb\u002Fstripe.svg)](https:\u002F\u002Fbadge.fury.io\u002Frb\u002Fstripe)\n[![Build Status](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-ruby\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg?branch=master)](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-ruby\u002Factions?query=branch%3Amaster)\n\n> [!TIP]\n> Want to chat live with Stripe engineers? Join us on our [Discord server](https:\u002F\u002Fstripe.com\u002Fgo\u002Fdiscord\u002Fruby).\n\nThe Stripe Ruby library provides convenient access to the Stripe API from\napplications written in the Ruby language. It includes a pre-defined set of\nclasses for API resources that initialize themselves dynamically from API\nresponses which makes it compatible with a wide range of versions of the Stripe\nAPI.\n\nThe library also provides other features. For example:\n\n- Easy configuration path for fast setup and use.\n- Helpers for pagination.\n- Built-in mechanisms for the serialization of parameters according to the\n  expectations of Stripe's API.\n\n## Documentation\n\nSee the [Ruby API docs](https:\u002F\u002Fstripe.com\u002Fdocs\u002Fapi?lang=ruby).\n\n## Installation\n\nYou don't need this source code unless you want to modify the gem. If you just\nwant to use the package, just run:\n\n```sh\ngem install stripe\n```\n\nIf you want to build the gem from source:\n\n```sh\ngem build stripe.gemspec\n```\n\n### Requirements\n\nPer our [Language Version Support Policy](https:\u002F\u002Fdocs.stripe.com\u002Fsdks\u002Fversioning?lang=ruby#stripe-sdk-language-version-support-policy), we currently support **Ruby 2.7+**.\n\nSupport for Ruby 2.7 is deprecated and will be removed in upcoming major versions. Read more and see the full schedule in the docs: https:\u002F\u002Fdocs.stripe.com\u002Fsdks\u002Fversioning?lang=ruby#stripe-sdk-language-version-support-policy\n\n### Bundler\n\nIf you are installing via bundler, you should be sure to use the https rubygems\nsource in your Gemfile, as any gems fetched over http could potentially be\ncompromised in transit and alter the code of gems fetched securely over https:\n\n```ruby\nsource 'https:\u002F\u002Frubygems.org'\n\ngem 'rails'\ngem 'stripe'\n```\n\n## Usage\n\nThe library needs to be configured with your account's secret key which is\navailable in your [Stripe Dashboard][api-keys]. Initialize a new client with your API key:\n\n```ruby\nrequire 'stripe'\n\nclient = Stripe::StripeClient.new(\"sk_test_...\")\n\n# list customers\ncustomers = client.v1.customers.list()\n\n# retrieve single customer\ncustomer = client.v1.customers.retrieve('cus_123456789')\n```\n\n### Per-request Configuration\n\nFor apps that need to use multiple keys during the lifetime of a process, like\none that uses [Stripe Connect][connect], it's also possible to set a\nper-request key and\u002For account:\n\n```ruby\nrequire \"stripe\"\n\nclient = Stripe::StripeClient.new(\"sk_test_...\")\n\nclient.v1.customers.list(\n  {},\n  {\n    api_key: 'sk_test_...',\n    stripe_account: 'acct_...',\n    stripe_version: '2018-02-28',\n  }\n)\n```\n\n### StripeClient vs legacy pattern\n\nWe introduced the `StripeClient` class in v13 of the Ruby SDK. The legacy pattern used prior to that version is still available to use but will be marked as deprecated soon. Review the [migration guide to use StripeClient](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-ruby\u002Fwiki\u002FMigration-guide-for-v13) to move from the legacy pattern.\n\nOnce the legacy pattern is deprecated, new API endpoints will only be accessible in the StripeClient. While there are no current plans to remove the legacy pattern for existing API endpoints, this may change in the future.\n\n### Accessing resource properties\n\nBoth indexer and accessors can be used to retrieve values of resource properties.\n\n```ruby\ncustomer = client.v1.customers.retrieve('cus_123456789')\nputs customer['id']\nputs customer.id\n```\n\nNOTE: If the resource property is not defined, the accessors will raise an exception, while the indexer will return `nil`.\n\n```ruby\ncustomer = client.v1.customers.retrieve('cus_123456789')\nputs customer['unknown'] # nil\nputs customer.unknown # raises NoMethodError\n```\n\n### Accessing a response object\n\nGet access to response objects by using the `last_response` property of the returned resource:\n\n```ruby\ncustomer = client.v1.customers.retrieve('cus_123456789')\n\nprint(customer.last_response.http_status) # to retrieve status code\nprint(customer.last_response.http_headers) # to retrieve headers\n```\n\nIf you are accessing a response field with custom hashes provided by you, such as `Customer.metadata`,\nplease access your fields with the `[]` accessor.\n\n### Configuring a proxy\n\nA proxy can be configured with `Stripe.proxy`:\n\n```ruby\nStripe.proxy = 'https:\u002F\u002Fuser:pass@example.com:1234'\n```\n\n### Configuring an API Version\n\nBy default, the library will use the API version pinned to the account making\na request. This can be overridden with this global option:\n\n```ruby\nStripe.api_version = '2018-02-28'\n```\n\nSee [versioning in the API reference][versioning] for more information.\n\n### Configuring CA Bundles\n\nBy default, the library will use its own internal bundle of known CA\ncertificates, but it's possible to configure your own:\n\n```ruby\nStripe.ca_bundle_path = 'path\u002Fto\u002Fca\u002Fbundle'\n```\n\n### Configuring Automatic Retries\n\nYou can enable automatic retries on requests that fail due to a transient\nproblem by configuring the maximum number of retries:\n\n```ruby\nStripe.max_network_retries = 2\n```\n\nVarious errors can trigger a retry, like a connection error or a timeout, and\nalso certain API responses like HTTP status `409 Conflict`.\n\n[Idempotency keys][idempotency-keys] are added to requests to guarantee that\nretries are safe.\n\n### Configuring Timeouts\n\nOpen, read and write timeouts are configurable:\n\n```ruby\nStripe.open_timeout = 30 # in seconds\nStripe.read_timeout = 80\nStripe.write_timeout = 30 # only supported on Ruby 2.6+\n```\n\nPlease take care to set conservative read timeouts. Some API requests can take\nsome time, and a short timeout increases the likelihood of a problem within our\nservers.\n\n### Logging\n\nThe library can be configured to emit logging that will give you better insight\ninto what it's doing. The `info` logging level is usually most appropriate for\nproduction use, but `debug` is also available for more verbosity.\n\nThere are a few options for enabling it:\n\n1. Set the environment variable `STRIPE_LOG` to the value `debug` or `info`:\n\n   ```sh\n   $ export STRIPE_LOG=info\n   ```\n\n2. Set `Stripe.log_level`:\n\n   ```ruby\n   Stripe.log_level = Stripe::LEVEL_INFO\n   ```\n\n### Instrumentation\n\nThe library has various hooks that user code can tie into by passing a block to\n`Stripe::Instrumentation.subscribe` to be notified about specific events.\n\n#### `request_begin`\n\nInvoked when an HTTP request starts. Receives `RequestBeginEvent` with the\nfollowing properties:\n\n- `method`: HTTP method. (`Symbol`)\n- `path`: Request path. (`String`)\n- `user_data`: A hash on which users can set arbitrary data, and which will be\n  passed through to `request_end` invocations. This could be used, for example,\n  to assign unique IDs to each request, and it'd work even if many requests are\n  running in parallel. All subscribers share the same object for any particular\n  request, so they must be careful to use unique keys that will not conflict\n  with other subscribers. (`Hash`)\n\n#### `request_end`\n\nInvoked when an HTTP request finishes, regardless of whether it terminated with\na success or error. Receives `RequestEndEvent` with the following properties:\n\n- `duration`: Request duration in seconds. (`Float`)\n- `http_status`: HTTP response code (`Integer`) if available, or `nil` in case\n  of a lower level network error.\n- `method`: HTTP method. (`Symbol`)\n- `num_retries`: The number of retries. (`Integer`)\n- `path`: Request path. (`String`)\n- `user_data`: A hash on which users may have set arbitrary data in\n  `request_begin`. See above for more information. (`Hash`)\n- `request_id`: HTTP request identifier. (`String`)\n- `response_header`: The response headers. (`Hash`)\n- `response_body` = The response body. (`String`)\n- `request_header` = The request headers. (`Hash`)\n- `request_body` = The request body. (`String`)\n\n#### Example\n\nFor example:\n\n```ruby\nStripe::Instrumentation.subscribe(:request_end) do |request_event|\n  # Filter out high-cardinality ids from `path`\n  path_parts = request_event.path.split(\"\u002F\").drop(2)\n  resource = path_parts.map { |part| part.match?(\u002F\\A[a-z_]+\\z\u002F) ? part : \":id\" }.join(\"\u002F\")\n\n  tags = {\n    method: request_event.method,\n    resource: resource,\n    code: request_event.http_status,\n    retries: request_event.num_retries\n  }\n  StatsD.distribution('stripe_request', request_event.duration, tags: tags)\nend\n```\n\n### How to use undocumented parameters and properties\n\nIn some cases, you might encounter parameters on an API request or fields on an API response that aren’t available in the SDKs.\nThis might happen when they’re undocumented or when they’re in preview and you aren’t using a preview SDK.\nSee [undocumented params and properties](https:\u002F\u002Fdocs.stripe.com\u002Fsdks\u002Fserver-side?lang=ruby#undocumented-params-and-fields) to send those parameters or access those fields.\n\n### Writing a Plugin\n\nIf you're writing a plugin that uses the library, we'd appreciate it if you\nidentified using `#set_app_info`:\n\n```ruby\nStripe.set_app_info('MyAwesomePlugin', version: '1.2.34', url: 'https:\u002F\u002Fmyawesomeplugin.info')\n```\n\nThis information is passed along when the library makes calls to the Stripe\nAPI.\n\n### Telemetry\n\nBy default, the library sends telemetry to Stripe regarding request latency and feature usage. These\nnumbers help Stripe improve the overall latency of its API for all users, and\nimprove popular features.\n\nYou can disable this behavior if you prefer:\n\n```ruby\nStripe.enable_telemetry = false\n```\n\n### Types\n\nIn [v14.0.0](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-python\u002Freleases\u002Ftag\u002Fv7.1.0) and newer, the library provides RBI\nstatic type annotations. See [the wiki](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-ruby\u002Fwiki\u002FStatic-Type-Annotations-(with-Sorbet))\nfor an detailed guide.\n\nPlease note that these types are available only for static analysis and we only support RBIs at the moment.\nPlease [report an issue](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-ruby\u002Fissues\u002Fnew\u002Fchoose)\nif you find discrepancies or have issues using types.\n\nThe RBIs can be found in the `rbi\u002Fstripe\u002F` directory, and to decrease `Tapioca` loading time we pack the gem with the\ncombined RBI at `rbi\u002Fstripe.rbi`.\n\n#### Types and the Versioning Policy\n\nWe release type changes in minor releases. While stripe-ruby follows semantic versioning, our semantic\nversions describe the runtime behavior of the library alone. Our type annotations are not reflected in the\nsemantic version. That is, upgrading to a new minor version of `stripe-ruby` might result in your type checker\nproducing a type error that it didn't before. You can use `~> x.x` or `x.x.x` constrain the version\nof `stripe-ruby` in your Gemfile to a certain version or range of `stripe-ruby`.\n\n#### Types and API Versions\n\nThe types describe the [Stripe API version](https:\u002F\u002Fstripe.com\u002Fdocs\u002Fapi\u002Fversioning)\nthat was the latest at the time of release. This is the version that your library sends\nby default. If you are overriding `Stripe.api_version` \u002F `stripe_version` on the StripeClient,\nor using a webhook endpoint tied to an older version, be aware that the data\nyou see at runtime may not match the types.\n\n### Public Preview SDKs\n\nStripe has features in the [public preview phase](https:\u002F\u002Fdocs.stripe.com\u002Frelease-phases) that can be accessed via versions of this package that have the `-beta.X` suffix like `11.2.0-beta.2`.\nWe would love for you to try these as we incrementally release new features and improve them based on your feedback.\n\nTo install, pick the latest version with the `beta` suffix by reviewing the [releases page](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-ruby\u002Freleases\u002F) and use it in the `gem install` command:\n\n```sh\ngem install stripe -v \u003Creplace-with-the-version-of-your-choice>\n```\n\n> **Note**\n> There can be breaking changes between two versions of the public preview SDKs without a bump in the major version. Therefore we recommend pinning the package version to a specific version in your Gemfile. This way you can install the same version each time without breaking changes unless you are intentionally looking for the latest version of the public preview SDK.\n\nWe highly recommend keeping an eye on when the beta feature you are interested in goes from beta to stable so that you can move from using a beta version of the SDK to the stable version.\n\nSome preview features require a name and version to be set in the `Stripe-Version` header like `feature_beta=v3`. If your preview feature has this requirement, use the `Stripe.add_beta_version` function (available only in the public preview SDKs):\n\n```python\nStripe.add_beta_version(\"feature_beta\", \"v3\")\n```\n\n### Private Preview SDKs\n\nStripe has features in the [private preview phase](https:\u002F\u002Fdocs.stripe.com\u002Frelease-phases) that can be accessed via versions of this package that have the `-alpha.X` suffix like `11.2.0-alpha.2`. These are invite-only features. Once invited, you can install the private preview SDKs by following the same instructions as for the [public preview SDKs](https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-ruby?tab=readme-ov-file#public-preview-sdks) above and replacing the term `beta` with `alpha`.\n\n### Custom requests\n\n> This feature is only available from version 13 of this SDK.\n\nIf you:\n\n- would like to send a request to an undocumented API (for example you are in a private beta)\n- prefer to bypass the method definitions in the library and specify your request details directly,\n- used the method `Stripe::APIResource.request(...)` to specify your own requests, which was removed in v13+\n\nyou can now use the `raw_request` method on `StripeClient`.\n\n```ruby\nclient = Stripe::StripeClient.new('sk_test_...')\nresp = client.raw_request(:post, \"\u002Fv1\u002Fbeta_endpoint\", params: {param: 123}, opts: {stripe_version: \"2022-11-15; feature_beta=v3\"})\n\n# (Optional) resp is a StripeResponse. You can use `Stripe.deserialize` to get a StripeObject.\ndeserialized_resp = client.deserialize(resp.http_body)\n```\n\n## Support\n\nNew features and bug fixes are released on the latest major version of the Stripe Ruby library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.\n\n## Development\n\n[Contribution guidelines for this project](CONTRIBUTING.md)\n\nThe test suite depends on [stripe-mock], so make sure to fetch and run it from a background terminal ([stripe-mock's README][stripe-mock] also contains instructions for installing via Homebrew and other methods):\n\n```sh\ngo install github.com\u002Fstripe\u002Fstripe-mock@latest\nstripe-mock\n```\n\nWe use [just](https:\u002F\u002Fgithub.com\u002Fcasey\u002Fjust) for common development tasks. You can install it or run the underlying commands directly (by copying them from the `justfile`). Common tasks include:\n\nRun all tests:\n\n```sh\njust test\n# or: bundle exec rake test\n```\n\nRun a single test suite:\n\n```sh\nbundle exec ruby -Ilib\u002F test\u002Fstripe\u002Futil_test.rb\n```\n\nRun a single test:\n\n```sh\nbundle exec ruby -Ilib\u002F test\u002Fstripe\u002Futil_test.rb -n \u002Fshould.convert.names.to.symbols\u002F\n```\n\nRun the linter:\n\n```sh\njust lint\n# or: bundle exec rubocop\n```\n\nUpdate bundled CA certificates from the [Mozilla cURL release][curl]:\n\n```sh\njust update-certs\n# or: bundle exec rake update_certs\n```\n\n[api-keys]: https:\u002F\u002Fdashboard.stripe.com\u002Faccount\u002Fapikeys\n[connect]: https:\u002F\u002Fstripe.com\u002Fconnect\n[curl]: http:\u002F\u002Fcurl.haxx.se\u002Fdocs\u002Fcaextract.html\n[idempotency-keys]: https:\u002F\u002Fstripe.com\u002Fdocs\u002Fapi\u002Fidempotent_requests?lang=ruby\n[stripe-mock]: https:\u002F\u002Fgithub.com\u002Fstripe\u002Fstripe-mock\n[versioning]: https:\u002F\u002Fstripe.com\u002Fdocs\u002Fapi\u002Fversioning?lang=ruby\n\n\u003C!--\n# vim: set tw=79:\n-->\n","Stripe Ruby库是一个用于访问Stripe API的Ruby语言库，旨在为使用Ruby编写的程序提供便捷的支付处理功能。其核心功能包括预定义的API资源类、易于配置的初始化设置、分页辅助工具以及参数序列化机制，确保与不同版本的Stripe API兼容性良好。此外，该库支持多种密钥配置方式，适用于需要在单个进程中使用多个密钥的应用场景，如Stripe Connect项目。适用于任何希望通过Ruby应用程序集成支付功能的开发者或企业。",2,"2026-06-11 03:15:47","top_language"]