Does Stripe Have an API for Payments? Yes: Options, Example and Costs

Published

Does Stripe have an API for payments? Yes. Stripe is built API-first, and every payment you can make in the Dashboard can also be created through the API. This guide explains which payment APIs exist, which one to choose and how to make your first call. For the history, read Stripe's Payments APIs: The First Ten Years.

Does Stripe Have an API for Payments? The Main Options

APIWhat it doesWhen to use it
Checkout Sessions APICreates a hosted, embedded or Payment Element checkoutRecommended for most new integrations
Payment Intents APITracks a payment through its whole life cycleFully custom flows
Payment LinksNo-code shareable payment pagesSelling without a website
Setup Intents / Payment MethodsSave cards for laterSubscriptions and future charges

Stripe states that it recommends the Checkout Sessions API with the Payment Element over Payment Intents for most integrations, since Payment Intents requires you to build more of the checkout logic yourself.

Your First Stripe Payments API Call

This cURL request creates a Checkout Session in test mode. Replace the key with your own test secret key:

curl https://api.stripe.com/v1/checkout/sessions \
  -u "sk_test_YOUR_KEY:" \
  -d mode=payment \
  -d "line_items[0][price_data][currency]=usd" \
  -d "line_items[0][price_data][product_data][name]=Test product" \
  -d "line_items[0][price_data][unit_amount]=2000" \
  -d "line_items[0][quantity]=1" \
  -d "success_url=https://example.com/success" \
  -d "cancel_url=https://example.com/cancel"

The response contains a url. Open it to see a Stripe payment page for $20.00. Pay with the test card 4242 4242 4242 4242.

Stripe API Libraries and Tools

  • Official libraries for Node.js, PHP, Python, Ruby, Java, Go and .NET.
  • Webhooks to receive events such as checkout.session.completed.
  • The Stripe CLI to forward webhooks to your local machine.
  • Test mode with separate keys so you never move real money by accident.

Stripe API Security Basics

  • Secret keys (sk_) stay on the server.
  • Use restricted keys where possible.
  • Verify the signature on every webhook.
  • Never let a client send the amount you charge.

What Does Using the Stripe API Cost?

The API is free to use. You pay the normal Stripe fee when a payment succeeds: 2.9% + 30¢ for US domestic cards. See how much it costs to use Stripe and how much Stripe charges per transaction.

Related Guides

Frequently Asked Questions

Does Stripe have an API for payments?

Yes. The Checkout Sessions API and the Payment Intents API are the main payment APIs.

Is the Stripe API free?

Yes. There is no charge for API access; you pay processing fees only on successful payments.

Which languages does Stripe support?

Official libraries cover Node.js, PHP, Python, Ruby, Java, Go and .NET, and any language can call the REST API directly.

Sources

Educational use only. Not financial advice. FeeCalculatorBuzz is not affiliated with Stripe, Venmo or Toast. Fees change, so confirm current rates on the provider's official pricing page before you set prices.