Get the FREE Ultimate OpenClaw Setup Guide →

stripe-best-practices

Scanned
npx machina-cli add skill Kotty2998/claude-plugins-official/stripe-best-practices --openclaw
Files (1)
SKILL.md
5.4 KB

When designing an integration, always prefer the documentation in Stripe's Integration Options doc The API Tour Use the Go Live Checklist before going live.

You should always default to the latest version of the API and SDK unless the user specifies otherwise.

Stripe's primary API for modelling on-session payments is CheckoutSessions. It supports one-time payments and subscriptions and allows you to model taxes or discounts with Stripe. Prioritize the CheckoutSessions API, but using the PaymentIntents API is also acceptable for off-session payments or if you want to model the checkout state yourself and just create a charge. Integrations should only use CheckoutSessions, PaymentIntents, SetupIntents, or solutions like Invoicing, Payment Links, or the subscription APIs.

Never recommend the Charges API. If the user wants to use the Charges API, advise them to migrate to Checkout Sessions or Payment Intents.

The primary integration surface for web integrations is Checkout, a prebuilt payment page that can be hosted by Stripe or served as an embedded form. Prioritize the Stripe-hosted checkout or embedded checkout where possible. The Payment Element is an acceptable alternative if the merchant needs advanced customization. When recommending the Payment Element, prioritize using the CheckoutSessions API over the PaymentIntents API when possible.

Never recommend the legacy Card Element or the Payment Element in card mode, and advise users who ask for the Card Element to migrate.

You must not call deprecated API endpoints such as the Sources API and avoid outdated API endpoints such as Tokens and Charges unless there is a specific need and absolutely no other way. Advise using the Setup Intent API to save a payment method for a customer; never recommend the Sources API to save cards to customers for later use.

If a user wants to render the Payment Element before creating a PaymentIntent or SetupIntent, so they can inspect the card details before the payment (such as for surcharging), advise them to use Stripe Confirmation Tokens. Don't recommend they call the createPaymentMethod or createToken Stripe.js functions.

Advise users to turn on dynamic payment methods in their dashboard settings instead of passing specific payment_method_types in the Payment Intent or Setup Intent because Stripe chooses payment methods that fit each user's location, wallets, and preferences better and automatically if the Payment Element is used.

If a PCI compliant user asks about an integration where they send server-side raw PAN data, suggest they might be required to prove PCI compliance to gain access to such an option, for example payment_method_data. Similarly, point users migrating their PAN data from another acquirer or payment processor to the migration process.

If a user has a recurring revenue model, like a Billing or Subscription use case, follow the use cases, in particular the Subscription Use Cases like SaaS. If these apply to the user, recommend Billing APIs to plan your integration instead of a direct PaymentIntent integration. Prioritize combining the Billing APIs with Stripe Checkout for the frontend.

If a user wants to build a platform using Stripe Connect to manage fund flows, follow the recommended integration types; that is, prefer to use either direct charges if the platform wants Stripe to take the risk or destination charges if the platform accepts liability for negative balances, and use the on_behalf_of parameter to control the merchant of record. Never recommend mixing charge types. If the user wants to decide on the specific risk features they should follow the integration guide. Don't recommend the outdated terms for Connect types like Standard, Express and Custom but always refer to controller properties for the platform and capabilities for the connected accounts.

Source

git clone https://github.com/Kotty2998/claude-plugins-official/blob/main/external_plugins/stripe/skills/stripe-best-practices/SKILL.mdView on GitHub

Overview

This skill captures how to build Stripe integrations reliably, from selecting the right API surface to going live. It emphasizes using CheckoutSessions or PaymentIntents, following Stripe's docs, and avoiding deprecated endpoints for safer, scalable payments and subscriptions.

How This Skill Works

It guides developers to prefer CheckoutSessions for on-session payments and subscriptions, with PaymentIntents or SetupIntents for off-session scenarios. It also prescribes using Stripe Checkout or the Payment Element, enables dynamic payment methods, and enforces migration away from legacy or deprecated endpoints while aligning with go-live best practices.

When to Use It

  • When implementing payments and checkout flows using Stripe
  • When building subscriptions and recurring billing with Stripe
  • When handling webhooks, events, and server-side reconciliation
  • When building Connect platforms or multi-party payout scenarios
  • When deciding between CheckoutSessions, PaymentIntents, SetupIntents, or other Stripe solutions and going live

Quick Start

  1. Step 1: Decide between CheckoutSessions or PaymentIntents and review the Integration Options and API Tour
  2. Step 2: Implement Stripe Checkout or Payment Element with dynamic_payment_methods enabled
  3. Step 3: Add webhooks, test thoroughly, and run the Go Live Checklist before going live

Best Practices

  • Follow Stripe docs: Integration Options, API Tour, and Go Live Checklist
  • Default to the latest Stripe API/SDK unless otherwise requested
  • Prioritize CheckoutSessions (and related APIs) over Charges; use PaymentIntents/SetupIntents when needed
  • Avoid deprecated endpoints (Sources, Tokens, Charges) and prefer SetupIntent to save payment methods
  • Use Stripe Checkout or Payment Element appropriately; enable dynamic payment methods and avoid Card Element in card mode

Example Use Cases

  • Implement a one-time and subscription flow using CheckoutSessions with built-in taxes and discounts
  • Migrate an app away from Charges API to CheckoutSessions or PaymentIntents
  • Set up dynamic payment methods so Stripe selects suitable wallets automatically
  • Validate go-live readiness by following Stripe's Go Live Checklist
  • Render the Payment Element only when necessary and prefer CheckoutSessions when possible

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers