Skip to content
Sign in
An image of the Stripe logo
/
Create account
Sign in
Home
Payments
Finance automation
Banking as a service
Developer tools
No-code
All products
Home
Payments
Finance automation
Home
Payments
Finance automation
Banking as a service
Developer tools
Overview
Building your integration
Developer tools
SDKs
    Overview
    Mobile SDKs
    iOS SDK
    Android SDK
    React Native SDK
    Web SDKs
    ES Module Stripe.js
    React Stripe.js
    Terminal SDKs
    iOS SDK
    Android SDK
    React Native SDK
    Community
    Community libraries
    Versions
    Versioning and support policy
    Set an API version
API
Security
Sample projects
Videos
Stripe Apps
Stripe Connectors
Partners
HomeDeveloper tools

Set a Stripe API version

Follow these guidelines to make sure that API versions match throughout your Stripe integration.

Your account has a default API version, which defines how you call the API, what functionality you have access to and what you’re guaranteed to get back as part of the response. Webhook event objects also follow the shape defined by your default API version, which may be different from the API version used by the SDK. To ensure these versions match, we recommend registering a webhook endpoint with the same API version used by the SDK. To find your version, see View your default API version.

Versioning basics

We’ve covered a few fundamental concepts you need to know about API versions used in SDKs. Choose your SDK language to get started.

Setting the API version

The stripe-ruby library allows you to set the API version globally or on a per-request basis. If you don’t set an API version, recent versions of stripe-ruby use the API version that was latest at the time your version of stripe-ruby was released. Versions of stripe-ruby before v9 use your account’s default API version.

To set the API version globally with the SDK, assign the version to the Stripe.api_version property:

require 'stripe' Stripe.api_key =
sk_test_4eC39HqLyjWDarjtT1zdp7dc
Stripe.api_version = '2023-08-16'

Or set the version per-request:

require 'stripe' intent = Stripe::PaymentIntent.retrieve( 'pi_1DlIVK2eZvKYlo2CW4yj5l2C', { stripe_version: '2023-08-16', } ) intent.capture

Note

When you override the version globally or per-request, the API response objects are also returned in that version.

Updating your API version

Before updating your API version, carefully review the following resources:

  • Stripe API changelog
  • Upgrading your API version

You can upgrade your account’s default API version in the Developers Dashboard. Update your code to use the latest version of the Ruby SDK and set the new API version when making your calls.

See also

Stripe SDKs follow their own versioning policy. See the link below to learn more.

  • Stripe versioning and support policies
Was this page helpful?
Need help? Contact Support.
Watch our developer tutorials.
Check out our product changelog.
Questions? Contact Sales.
Powered by Markdoc
You can unsubscribe at any time. Read our privacy policy.
On this page
Versioning basics
See also
Stripe Shell
Test mode
Welcome to the Stripe Shell! Stripe Shell is a browser-based shell with the Stripe CLI pre-installed. Log in to your Stripe account and press Control + Backtick (`) on your keyboard to start managing your Stripe resources in test mode. - View supported Stripe commands: - Find webhook events: - Listen for webhook events: - Call Stripe APIs: stripe [api resource] [operation] (e.g., )
The Stripe Shell is best experienced on desktop.
$