Stripe API
The Stripe API is the REST API of the payment company Stripe. Developers use it to accept card and wallet payments, run subscriptions and invoices, refund money and build marketplaces. Requests are authenticated with secret keys, events arrive through webhooks, and new API versions are released monthly, with two major releases a year.
Key facts
| Type | REST API for payments and financial services |
| Owner | Stripe |
| Base URL | https://api.stripe.com |
| Format | Form-encoded requests, JSON responses |
| Authentication | Secret API key, sent as a Bearer token or HTTP Basic username |
| Versions | Date-based, with named major releases twice a year; the latest major release is Endive (2026-09-30.endive) as of November 2026 |
| Official server libraries | Node.js, Python, Ruby, PHP, Java, Go, .NET |
| Documentation | docs.stripe.com/api |
What is the Stripe API?
The Stripe API is a REST API that gives programs access to Stripe's payment infrastructure: an application creates payments, customers and subscriptions by sending HTTP requests to api.stripe.com and receives JSON objects in response. The API itself is free; Stripe charges fees on transactions.
Each business object — a payment, customer, product, invoice or refund — is a resource with its own URL and an ID such as pi_3Q... for a PaymentIntent or cus_... for a customer.
What can you do with the Stripe API?
- Accept payments — PaymentIntents track a payment from creation to confirmation; Checkout Sessions create a ready-made payment page hosted by Stripe.
- Subscriptions and invoices — Products, Prices, Subscriptions and Invoices handle recurring and usage-based billing.
- Customers and saved payment methods — store cards and wallets for repeat purchases.
- Refunds and disputes — return money fully or partly and respond to chargebacks.
- Marketplaces — Connect splits payments between a platform and sellers and sends them payouts.
- In-person payments — Terminal connects card readers.
How do you authenticate with the Stripe API?
Every Stripe account has two kinds of API keys, shown in the Dashboard:
- Publishable keys (
pk_test_...,pk_live_...) are used in the browser or a mobile app to collect payment details safely. - Secret keys (
sk_test_...,sk_live_...) can perform any operation on the account and must stay on the server. Restricted keys (rk_...) give a server or integration access to selected resources only.
Test keys work in a sandbox, where no real money moves; live keys process real payments. A leaked secret key should be rolled (replaced) in the Dashboard immediately.
Example
Creating a PaymentIntent for $20.00 with curl. Amounts are given in the smallest currency unit, so 2000 means 2000 cents:
curl https://api.stripe.com/v1/payment_intents \
-u "sk_test_your_key:" \
-H "Idempotency-Key: 8a1f3c2e-6b7d-4e0a-9c55-2f7e1d4b9a10" \
-d amount=2000 \
-d currency=usd \
-d "automatic_payment_methods[enabled]=true"
The same request with the official Node.js library:
import Stripe from 'stripe';
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
const paymentIntent = await stripe.paymentIntents.create({
amount: 2000, // $20.00 in cents
currency: 'usd',
automatic_payment_methods: { enabled: true },
});
console.log(paymentIntent.client_secret); // passed to the browser to confirm the payment
The response contains the PaymentIntent ID, its status and a client_secret that the front end uses with Stripe.js to collect card details and confirm the payment.
How do Stripe webhooks work?
A webhook is an HTTP request that Stripe sends to the application's server when something happens on the account: payment_intent.succeeded, invoice.paid, customer.subscription.deleted and hundreds of other events. Webhooks are the reliable way to learn that a payment went through, because the customer may close the browser before returning to the site.
The endpoint must check the Stripe-Signature header with the endpoint's signing secret (whsec_...) and reply with a 2xx status quickly. If delivery fails, Stripe retries it with increasing intervals for up to three days in live mode. The Stripe CLI forwards events to a local server during development: stripe listen --forward-to localhost:3000/webhooks.
How does Stripe API versioning work?
Every account has a default API version, and a request can override it with the Stripe-Version header; official libraries pin the version they were built for. Stripe releases a new version each month without breaking changes, and twice a year starts a new major release that may contain breaking changes. Major releases are named after plants: Acacia, Basil, Clover, Dahlia (March 2026) and Endive (September 2026).
Limits and pricing
- Rate limits — 100 requests per second in live mode and 25 in a sandbox by default; some endpoints have lower limits, for example 20 read requests per second for the Search API. Exceeding a limit returns HTTP
429, and the request should be retried with an increasing delay. - Idempotency — a POST request with an
Idempotency-Keyheader (up to 255 characters, Stripe suggests a V4 UUID) can be safely retried after a network error: Stripe returns the saved result instead of charging twice. Keys may be removed after 24 hours. - Pricing — the API is free to use; Stripe charges per transaction. Standard US pricing for domestic online card payments is 2.9% + 30¢ as of November 2026, according to stripe.com/pricing; fees differ by country.
Can you use the Stripe API from Kazakhstan?
As of November 2026, Kazakhstan is not on Stripe's list of supported countries, so a company registered in Kazakhstan cannot open its own Stripe account and process payments through the API. Founders from Kazakhstan usually work through a company in a supported country; the options are covered in the article on Stripe. For local payments, businesses in Kazakhstan use payment gateways of Kazakh banks and providers.
Documentation
The full reference with examples in every official language is at docs.stripe.com/api. In a sandbox, the test card 4242 4242 4242 4242 with any future expiry date and any CVC completes a successful payment.
Sources
- Stripe API Reference — Stripe (accessed 30 November 2026)
- API keys — Stripe Docs (accessed 30 November 2026)
- How API versioning works — Stripe Docs (accessed 30 November 2026)
- Changelog: Endive — Stripe Docs (accessed 30 November 2026)
- Rate limits — Stripe Docs (accessed 30 November 2026)
- Idempotent requests — Stripe API Reference (accessed 30 November 2026)
- Receive Stripe events in your webhook endpoint — Stripe Docs (accessed 30 November 2026)
- Stripe Pricing — Stripe (accessed 30 November 2026)
- Stripe global availability — Stripe (accessed 30 November 2026)