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.

    Server-side libraries

    Available as a gem:

    sudo gem install stripe

    If you use bundler, you can use this line:

    gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby'

    Check out the Ruby API docs, or see the source on GitHub.

    Available through pip:

    pip install --upgrade stripe

    Alternatively, you can also use easy_install:

    easy_install --upgrade stripe

    Check out the Python API docs, or see the source on GitHub. You can also find the Stripe package on PyPI.

    The PHP library can be installed via Composer:

    composer require stripe/stripe-php

    Alternatively, you can download the source directly.

    Check out the PHP API docs, or see the source on GitHub.

    For Gradle, add the following dependency to your build.gradle:

    implementation "com.stripe:stripe-java:{VERSION}"
    (Replace {VERSION} with the actual version number you want to use. You can find the most recent version on Maven Repository or GitHub.)

    For Maven, add the following dependency to your POM:

    <dependency>
      <groupId>com.stripe</groupId>
      <artifactId>stripe-java</artifactId>
      <version>{VERSION}</version>
    </dependency>
    (Replace {VERSION} with the actual version number you want to use. You can find the most recent version on Maven Repository or GitHub.)

    In other environments, manually install the following JARs:

    Check out the Java API docs, or see the source on GitHub.

    Install via npm:

    npm install stripe

    Check out the node.js API docs, or see the source on GitHub.

    Install via go:

    go get github.com/stripe/stripe-go

    Then import the package:

    import (
      "github.com/stripe/stripe-go"
    )

    For more details, check out the Go API docs and GoDoc, or see the source on GitHub.

    Install via dotnet:

    dotnet add package Stripe.net
    dotnet restore

    Or using NuGet:

    PM> Install-Package Stripe.net

    For more details, check out the .NET API docs, or see the source on GitHub.

    Client-side 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.

    Include the Stripe.js script on your checkout page by adding it to the head of your HTML file:

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

    Create an instance of Elements with the following JavaScript on your checkout page:

    // Set your publishable key: remember to change this to your live secret key in production
    // See your keys here: https://dashboard.stripe.com/account/apikeys
    var stripe = Stripe('pk_test_TYooMQauvdEDq54NiTphI7jx');
    var elements = stripe.elements();
    

    Now you can use Elements to create payment forms with prebuilt input fields to collect payment method details.

    First, install react-stripe-elements with npm, yarn, or UDM:

    npm install --save react-stripe-elements
    yarn add react-stripe-elements
    <!-- exports a global ReactStripeElements object -->
    <script src="https://unpkg.com/react-stripe-elements@latest/dist/react-stripe-elements.min.js"></script>

    Second, include the Stripe.js script on your checkout page.

    To include the script, add it to the head of your HTML file:

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

    Now you can use individual *Element components, such as CardElement, to build your form.

    
    import React from 'react';
    import {CardElement} from 'react-stripe-elements';
    
    class CardSection extends React.Component {
      render() {
        return (
          <label>
            Card details
            <CardElement style={{base: {fontSize: '18px'}}} />
          </label>
        );
      }
    }
    
    export default CardSection;
    

    Now you can use Elements with React apps to create payment forms with prebuilt input fields to collect payment method details.

    The iOS SDK is open source, fully documented, and compatible with apps supporting iOS 9 or above.

    1. If you haven't already, install the latest version of CocoaPods.
    2. If you don't have an existing Podfile, run the following command to create one:
      pod init
    3. Add this line to your Podfile:
      pod 'Stripe'
    4. Run the following command:
      pod install
    5. Don't forget to use the .xcworkspace file to open your project in Xcode, instead of the .xcodeproj file, from here on out.
    6. In the future, to update to the latest version of the SDK, just run:
      pod update Stripe
    1. If you haven't already, install the latest version of Carthage.
    2. Add this line to your Cartfile:
      github "stripe/stripe-ios"
    3. Follow the Carthage installation instructions.
    4. In the future, to update to the latest version of the SDK, run the following command:
      carthage update stripe-ios --platform ios
    1. Head to our GitHub releases page and download and unzip Stripe.framework.zip.
    2. Drag Stripe.framework to the "Embedded Binaries" section of your Xcode project's "General" settings. Make sure to select "Copy items if needed".
    3. Head to the "Build Phases" section of your Xcode project settings, and create a new "Run Script Build Phase". Paste the following snippet into the text field:
      bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/Stripe.framework/integrate-dynamic-framework.sh"
    4. In the future, to update to the latest version of our SDK, just repeat steps 1 and 2.

    When your app starts, configure the SDK with your Stripe publishable key so that it can make requests to the Stripe API.

    import UIKit
    import Stripe
    
    @UIApplicationMain
    class AppDelegate: UIResponder, UIApplicationDelegate {
    
        func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
            Stripe.setDefaultPublishableKey("pk_test_TYooMQauvdEDq54NiTphI7jx")
            // do any other necessary launch configuration
            return true
        }
    }
    #import "AppDelegate.h"
    #import <Stripe/Stripe.h>
    
    @implementation AppDelegate
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        [Stripe setDefaultPublishableKey:@"pk_test_TYooMQauvdEDq54NiTphI7jx"];
        // do any other necessary launch configuration
        return YES;
    }
    @end

    The Android SDK is open source and fully documented.

    To install the SDK, add stripe-android to the dependencies block of your app/build.gradle file:

    apply plugin: 'com.android.application'
    
    android { ... }
    
    dependencies {
      // ...
    
      // Stripe Android SDK
      implementation 'com.stripe:stripe-android:12.4.0'
    }
    

    Configure the SDK with your Stripe publishable key so that it can make requests to the Stripe API, such as in your Application subclass:

    import com.stripe.android.PaymentConfiguration
    
    class MyApp: Application() {
        override fun onCreate() {
            super.onCreate()
            PaymentConfiguration.init(applicationContext, "pk_test_TYooMQauvdEDq54NiTphI7jx")
        }
    }
    
    import com.stripe.android.PaymentConfiguration;
    
    public class MyApp extends Application {
        @Override
        public void onCreate() {
            super.onCreate();
            PaymentConfiguration.init(getApplicationContext(), "pk_test_TYooMQauvdEDq54NiTphI7jx");
        }
    }
    

    Community Libraries

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

    Plugins for third-party services

    Want to make an existing tool better with Stripe? Here are some plugins to help you get started without any programming needed.

    Developed by Stripe

    Developed by the community

    Implemented your own library or an example you'd like to share? Send a link to your code and we'll be happy to add it to the list!

    Was this page helpful?

    Thank you for helping improve Stripe's documentation. If you need help or have any questions, please consider contacting support.

    On this page