---
title: "Use Stripe for payments · Agent Wranglers"
url: https://agentwranglers.se/playbook/stack/product-services/stripe-payments
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Use Stripe for payments

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Product services](https://agentwranglers.se/playbook/stack/product-services.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

- Level: Recommended
- Chapter: [Product services](https://agentwranglers.se/playbook/stack/product-services)
- Rule: Take card payments and subscriptions through Stripe's hosted checkout and official SDK, and pin the SDK's major version.
- Applies when: The project takes payments.
- Cost: Paid. Stripe charges a fee per transaction. No open source service can move card payments, because that needs a licensed payment provider.
- How: Stripe's npm package dates from 2011 and its 1.0.0 shipped in December 2011. Version 23.0.0 shipped on 1 October 2026. The npm package had about 14.5 million weekly downloads in October 2026, and the Python package about 10.7 million. Both are MIT-licensed. Since September 2024, Stripe ships a backwards-compatible API version every month and a breaking release twice a year. Each SDK release pins the API version it was built for, so upgrade as [Pin the provider's API version](https://agentwranglers.se/playbook/payments/payment-events-and-reconciliation/provider-api-version) says. To leave, ask Stripe to send saved cards to another PCI DSS Level 1 processor as an encrypted JSON file. Copy orders, invoices and subscriptions out through the API, because the card export leaves them out. Build the checkout as [Choose a checkout that keeps you on SAQ A](https://agentwranglers.se/playbook/payments/checkout-and-card-data/pci-saq-a-integration) says. Choose something else when you want a merchant of record to collect and pay sales tax and VAT for you. Paddle does that, but its current SDKs reached 1.0 in 2024, so record the exception. Adyen suits large card volumes, and Mollie suits local European payment methods.
- Check: The lock file pins one Stripe SDK major version, and the webhook endpoint uses the API version that SDK pins. Every payment form runs on a Stripe-hosted page or embedded field.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
import Stripe from 'stripe';

const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);

export const startCheckout = (order) => stripe.checkout.sessions.create({
  mode: 'payment',
  line_items: [{ price: order.priceId, quantity: 1 }],
  success_url: 'https://example.com/orders/done',
}, { idempotencyKey: `checkout-${order.id}` });
```

### Python example

```python
import os
import stripe

stripe.api_key = os.environ["STRIPE_SECRET_KEY"]

def start_checkout(order):
    return stripe.checkout.Session.create(
        mode="payment",
        line_items=[{"price": order.price_id, "quantity": 1}],
        success_url="https://example.com/orders/done",
        idempotency_key=f"checkout-{order.id}",
    )
```

## Sources

- [Stripe API versioning](https://docs.stripe.com/api/versioning)
- [Request a payment data export](https://docs.stripe.com/get-started/data-migrations/pan-export)

## Related rules

- [Pin the provider's API version](https://agentwranglers.se/playbook/payments/payment-events-and-reconciliation/provider-api-version) in Payments
- [Choose a checkout that keeps you on SAQ A](https://agentwranglers.se/playbook/payments/checkout-and-card-data/pci-saq-a-integration) in Payments

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/stack/product-services/stripe-payments">Agent Wranglers software choices playbook</a>`. In code you write, add a comment next to it with the same link.

- Next: [Use Amazon SES to send transactional email](https://agentwranglers.se/playbook/stack/product-services/ses-transactional-email)
- [Product services](https://agentwranglers.se/playbook/stack/product-services)
