Create account
Sign in
Home
Payments
Business operations
Financial services
Developer tools
Security
All products
Home
Payments
Business operations
Home
Payments
Business operations
Financial services
Developer tools
Support
Overview
Quickstart
Stripe CLI
Stripe for Visual Studio Code
Webhooks
File uploads
Error handling
Error codes
API
Keys
Libraries
Upgrades
Rate limits
Card testing
Expanding responses
Domains and IP addresses
Building With Stripe
Stripe.js and Elements
Prebuilt iOS UI
Prebuilt Android UI
Extensions
Plugins
Samples
Checklist
HomeDeveloper tools

API libraries

Stripe has official libraries for different programming languages and mobile platforms. There are also many more third-party libraries and plugins created by the Stripe community.

Client-side and UI libraries

Use Stripe on the web with Elements, a set of prebuilt UI components for collecting and validating card details. Elements uses Stripe.js, our foundational JavaScript library for building payment flows.

You need to include Stripe.js on your checkout page by either adding the script tag to the head of your HTML file, or importing it from the stripe-js module:

<script src="https://js.stripe.com/v3/"></script>

Next, create an instance of the Stripe object by providing your publishable API key as the first parameter:

var stripe = Stripe(
'pk_test_TYooMQauvdEDq54NiTphI7jx'
);

Finally, create an instance of the Elements UI library:

var elements = stripe.elements();

Now you can use Elements to create payment forms with prebuilt input fields to collect payment method details. See accept a payment for detailed instructions.

Server-side libraries

Terminal
# Available as a gem sudo gem install stripe
Gemfile
# If you use bundler, you can add this line to your Gemfile gem 'stripe'

For more details, check out the API reference or see the source code on GitHub.

Versioning

When backwards-incompatible changes are made to the API, a new, dated version is released. Read our API upgrades guide to see our API changelog and to learn more about backwards compatibility.

All requests use your account API settings, unless you override the API version. The changelog lists every available version. Note that by default webhook events are structured according to your account API version, unless you set an API version during endpoint creation.

To override the API version, assign the version to the Stripe.api_version property:

require 'stripe' Stripe.api_key =
sk_test_4eC39HqLyjWDarjtT1zdp7dc
Stripe.api_version = '2020-08-27'

Or set it per-request:

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

When overriding it per-request, methods on the returned object reuse the same Stripe version.

You can visit your Dashboard to upgrade your account API version.

Upgrading your server-side library

Minor updates to our libraries are backwards compatible and are generally safe to upgrade to. Major updates often include breaking changes, which may require changes to your code when upgrading. A major version upgrade is sometimes required to use new features.

Major version upgrades may contain breaking changes. When upgrading, carefully review the library changelog, read the relevant migration guide, and test your integration.

Before upgrading your API version in the Dashboard, review both the API changelog and the library changelog.

Update the version in your Gemfile. You can find the latest library version at the top of the changelog file.

Gemfile
# If you use bundler, you can add this line to your Gemfile gem 'stripe', 'X.XX.X'
Terminal
bundle install

Community libraries

Find some of the many community-supported libraries available for Stripe listed below.

List of libraries

Was this page helpful?
Questions? Contact us.
Developer tutorials on YouTube.
You can unsubscribe at any time. Read our privacy policy.
On this page
Client-side and UI libraries
Server-side libraries
Community libraries