PluginBench
Skill
Fail
Audit score 45

stripe-integration

wshobson/agents

Implement Stripe payment processing with checkout, subscriptions, and webhooks for PCI-compliant payment flows.

What is stripe-integration?

Stripe Integration enables robust payment processing including one-time payments, recurring subscriptions, and webhook handling. Use this skill when building payment systems, subscription billing, or secure checkout flows that require PCI compliance.

  • Create and manage Checkout Sessions for hosted or custom payment flows
  • Process one-time and recurring subscription payments
  • Handle Setup Intents to save payment methods for future use
  • Manage customers, payment methods, and billing details
  • Process refunds and handle payment disputes
  • Implement webhooks for payment lifecycle events (succeeded, failed, refunded)

How to install stripe-integration

npx skills add https://github.com/wshobson/agents --skill stripe-integration
Prerequisites
  • Stripe account with API keys (test and live)
  • Stripe Python SDK or equivalent client library
  • Server endpoint to handle webhook events
Claude Code
Cursor
Windsurf
Cline

How to use stripe-integration

  1. 1.Set your Stripe API key in your environment (sk_test_... for testing)
  2. 2.Create a Checkout Session or Payment Intent depending on your use case (Checkout recommended for most integrations)
  3. 3.For subscriptions: define Products and Prices in Stripe, then create subscriptions via API
  4. 4.Implement webhook handlers for critical events (payment_intent.succeeded, customer.subscription.updated, charge.refunded)
  5. 5.Test using Stripe test card numbers (4242424242424242 for success, 4000000000000002 for decline)
  6. 6.Deploy webhook endpoint and register it in Stripe Dashboard
  7. 7.Transition to live keys (sk_live_...) when ready for production

Use cases

Good for
  • Building e-commerce checkout with one-time purchases or subscriptions
  • Setting up recurring billing systems with automatic invoice generation
  • Implementing marketplace payments using Stripe Connect
  • Collecting and storing customer payment methods for future charges
  • Processing refunds and handling payment failures
Who it's for
  • Backend developers integrating payment processing
  • Full-stack engineers building subscription platforms
  • Fintech and marketplace developers
  • E-commerce platform builders

stripe-integration FAQ

Should I use Checkout Sessions or Payment Intents?

Use Checkout Sessions for most integrations—they handle taxes, discounts, shipping, and saved payment methods with lower maintenance burden. Use Payment Intents only when you need bespoke control and are willing to manage complexity yourself.

How do I save a customer's payment method for future charges?

Use Setup Intents to collect and save a payment method without charging. Store the payment method ID on the customer record, then use it for future Payment Intents or subscriptions.

What webhook events must I handle?

Critical events include: payment_intent.succeeded (payment completed), payment_intent.payment_failed (payment failed), customer.subscription.updated (subscription changed), customer.subscription.deleted (subscription canceled), and charge.refunded (refund processed).

How do I test payments before going live?

Use test mode API keys (sk_test_...) and test card numbers provided in the skill documentation. Test cards include 4242424242424242 for success and 4000000000000002 for decline scenarios.

Do I need to handle PCI compliance myself?

No. Stripe handles PCI compliance when you use Checkout Sessions or Stripe.js with Payment Elements. Avoid handling raw card data directly.

Full instructions (SKILL.md)

Source of truth, from wshobson/agents.


name: stripe-integration description: Implement Stripe payment processing for robust, PCI-compliant payment flows including checkout, subscriptions, and webhooks. Use when integrating Stripe payments, building subscription systems, or implementing secure checkout flows.

Stripe Integration

Master Stripe payment processing integration for robust, PCI-compliant payment flows including checkout, subscriptions, webhooks, and refunds.

When to Use This Skill

  • Implementing payment processing in web/mobile applications
  • Setting up subscription billing systems
  • Handling one-time payments and recurring charges
  • Processing refunds and disputes
  • Managing customer payment methods
  • Implementing SCA (Strong Customer Authentication) for European payments
  • Building marketplace payment flows with Stripe Connect

Core Concepts

1. Payment Flows

Checkout Sessions

  • Recommended for most integrations
  • Supports all UI paths:
    • Stripe-hosted checkout page
    • Embedded checkout form
    • Custom UI with Elements (Payment Element, Express Checkout Element) using ui_mode='custom'
  • Provides built-in checkout capabilities (line items, discounts, tax, shipping, address collection, saved payment methods, and checkout lifecycle events)
  • Lower integration and maintenance burden than Payment Intents

Payment Intents (Bespoke control)

  • You calculate the final amount with taxes, discounts, subscriptions, and currency conversion yourself.
  • More complex implementation and long-term maintenance burden
  • Requires Stripe.js for PCI compliance

Setup Intents (Save Payment Methods)

  • Collect payment method without charging
  • Used for subscriptions and future payments
  • Requires customer confirmation

2. Webhooks

Critical Events:

  • payment_intent.succeeded: Payment completed
  • payment_intent.payment_failed: Payment failed
  • customer.subscription.updated: Subscription changed
  • customer.subscription.deleted: Subscription canceled
  • charge.refunded: Refund processed
  • invoice.payment_succeeded: Subscription payment successful

3. Subscriptions

Components:

  • Product: What you're selling
  • Price: How much and how often
  • Subscription: Customer's recurring payment
  • Invoice: Generated for each billing cycle

4. Customer Management

  • Create and manage customer records
  • Store multiple payment methods
  • Track customer metadata
  • Manage billing details

Quick Start

import stripe

stripe.api_key = "sk_test_..."

# Create a checkout session
session = stripe.checkout.Session.create(
    line_items=[{
        'price_data': {
            'currency': 'usd',
            'product_data': {
                'name': 'Premium Subscription',
            },
            'unit_amount': 2000,  # $20.00
            'recurring': {
                'interval': 'month',
            },
        },
        'quantity': 1,
    }],
    mode='subscription',
    success_url='https://yourdomain.com/success?session_id={CHECKOUT_SESSION_ID}',
    cancel_url='https://yourdomain.com/cancel'
)

# Redirect user to session.url
print(session.url)

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Testing

# Use test mode keys
stripe.api_key = "sk_test_..."

# Test card numbers
TEST_CARDS = {
    'success': '4242424242424242',
    'declined': '4000000000000002',
    '3d_secure': '4000002500003155',
    'insufficient_funds': '4000000000009995'
}

def test_payment_flow():
    """Test complete payment flow."""
    # Create test customer
    customer = stripe.Customer.create(
        email="test@example.com"
    )

    # Create payment intent
    intent = stripe.PaymentIntent.create(
        amount=1000,
        automatic_payment_methods={
            'enabled': True
        },
        currency='usd',
        customer=customer.id
    )

    # Confirm with test card
    confirmed = stripe.PaymentIntent.confirm(
        intent.id,
        payment_method='pm_card_visa'  # Test payment method
    )

    assert confirmed.status == 'succeeded'