Skip to content

Stripe SDKs Fresh

Official libraries and tools for interacting with Stripe's APIs across different platforms and languages.

Stripe uses semantic versioning for SDKs and versions APIs by release date. Breaking API changes increase the SDK's major version.

Server-side SDKs

Use server-side SDKs to interact with the Stripe API from your backend. Never expose your secret API key on the client.

LanguagePackage
Node.jsnpm install stripe
Pythonpip install stripe
Rubygem install stripe
PHPcomposer require stripe/stripe-php
Gogo get github.com/stripe/stripe-go/v82
JavaMaven: com.stripe:stripe-java:27.1.0
.NETdotnet add package Stripe.net

Node.js

javascript
const stripe = require('stripe')('sk_test_YOUR_SECRET_KEY');

// List customers
const customers = await stripe.customers.list({ limit: 10 });

// Create a PaymentIntent
const paymentIntent = await stripe.paymentIntents.create({
  amount: 2000,
  currency: 'usd',
});

Python

python
import stripe
stripe.api_key = 'sk_test_YOUR_SECRET_KEY'

# Create a customer
customer = stripe.Customer.create(email='customer@example.com')

# Create a PaymentIntent
intent = stripe.PaymentIntent.create(amount=2000, currency='usd')

Ruby

ruby
require 'stripe'
Stripe.api_key = 'sk_test_YOUR_SECRET_KEY'

customer = Stripe::Customer.create(email: 'customer@example.com')
intent = Stripe::PaymentIntent.create(amount: 2000, currency: 'usd')

Go

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

stripe.Key = "sk_test_YOUR_SECRET_KEY"

params := &stripe.PaymentIntentParams{
  Amount:   stripe.Int64(2000),
  Currency: stripe.String(string(stripe.CurrencyUSD)),
}
pi, err := paymentintent.New(params)

Web (frontend) SDKs

Use these on the client side to collect payment details securely.

Stripe.js (ES Module)

html
<script src="https://js.stripe.com/v3/"></script>
<script>
  const stripe = Stripe('pk_test_YOUR_PUBLISHABLE_KEY');
</script>

Or as an ES module:

javascript
import { loadStripe } from '@stripe/stripe-js';
const stripe = await loadStripe('pk_test_YOUR_PUBLISHABLE_KEY');

React Stripe.js

bash
npm install @stripe/react-stripe-js @stripe/stripe-js
jsx
import { loadStripe } from '@stripe/stripe-js';
import { Elements } from '@stripe/react-stripe-js';

const stripePromise = loadStripe('pk_test_YOUR_PUBLISHABLE_KEY');

function App() {
  return (
    <Elements stripe={stripePromise} options={{ clientSecret }}>
      <CheckoutForm />
    </Elements>
  );
}

Mobile SDKs

PlatformPackage
iOSpod 'Stripe'
Androidimplementation 'com.stripe:stripe-android:21.x.x'
React Nativenpm install @stripe/stripe-react-native

API versioning

  • Strongly typed SDKs (Go, Java, TypeScript, .NET) — pin the API version to the library version. Upgrade the library to get new API versions.
  • Dynamic language SDKs (Node.js, PHP, Python, Ruby) — set the API version explicitly in the library, or use your account's default API version.

Set API version in Node.js:

javascript
const stripe = require('stripe')('sk_test_...', {
  apiVersion: '2024-11-20.acacia',
});

OpenAPI and Postman

Stripe publishes an OpenAPI specification and a Postman collection for the full API. The Postman collection includes pre-built requests for all endpoints.

  • OpenAPI spec: github.com/stripe/openapi
  • Postman workspace: postman.com/stripedev

Infrastructure as code

Stripe provides a Terraform provider for managing Stripe resources as code:

hcl
provider "stripe" {
  api_key = var.stripe_api_key
}

resource "stripe_product" "my_product" {
  name = "My SaaS Plan"
}

Stripe API Reference - Self-contained docs reference, refreshed 2026-05-18