stripe

git-tao's avatarfrom git-tao

Stripe payment processing platform. Use for payment integrations, checkout, subscriptions, billing, Connect platforms, webhooks, and financial APIs.

0stars🔀0forks📁View on GitHub🕐Updated Jan 9, 2026

When & Why to Use This Skill

This Claude skill provides comprehensive assistance for integrating and managing the Stripe payment processing platform. It streamlines the development of secure checkout flows, subscription billing systems, and complex financial architectures like Stripe Connect, while offering expert guidance on webhook handling, API best practices, and secure payment processing.

Use Cases

  • E-commerce Checkout: Rapidly implement secure one-time payment flows using Stripe Checkout or Payment Intents for web and mobile applications.
  • Subscription Management: Set up and automate recurring billing cycles, including trial periods, tiered pricing, and subscription lifecycle events.
  • Webhook Integration: Build and verify robust webhook endpoints to handle real-time events such as successful payments, failed invoices, or subscription changes.
  • Marketplace Payments: Configure Stripe Connect to manage complex multi-party payment distributions, platform fees, and automated payouts.
  • Customer Self-Service: Integrate the Stripe Billing Portal to allow users to manage their own payment methods, invoices, and subscription plans without manual intervention.
namestripe
descriptionStripe payment processing platform. Use for payment integrations, checkout, subscriptions, billing, Connect platforms, webhooks, and financial APIs.

Stripe Skill

Comprehensive assistance with Stripe development, generated from official documentation.

When to Use This Skill

This skill should be triggered when:

  • Working with Stripe payments
  • Implementing checkout sessions
  • Setting up subscriptions and billing
  • Processing webhooks
  • Working with Stripe Connect

Quick Reference

Initialize Stripe (Node.js)

const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);

Create Payment Intent

const paymentIntent = await stripe.paymentIntents.create({
  amount: 2000, // Amount in cents
  currency: 'usd',
  payment_method_types: ['card'],
  metadata: { order_id: '123' }
});

Create Checkout Session

const session = await stripe.checkout.sessions.create({
  payment_method_types: ['card'],
  line_items: [
    {
      price_data: {
        currency: 'usd',
        product_data: {
          name: 'Product Name',
        },
        unit_amount: 2000,
      },
      quantity: 1,
    },
  ],
  mode: 'payment',
  success_url: 'https://example.com/success?session_id={CHECKOUT_SESSION_ID}',
  cancel_url: 'https://example.com/cancel',
});

Create Subscription Checkout

const session = await stripe.checkout.sessions.create({
  mode: 'subscription',
  payment_method_types: ['card'],
  line_items: [
    {
      price: 'price_xxx', // Price ID from Stripe dashboard
      quantity: 1,
    },
  ],
  success_url: 'https://example.com/success',
  cancel_url: 'https://example.com/cancel',
});

Webhook Handling

const endpointSecret = process.env.STRIPE_WEBHOOK_SECRET;

app.post('/webhook', express.raw({type: 'application/json'}), (req, res) => {
  const sig = req.headers['stripe-signature'];
  let event;

  try {
    event = stripe.webhooks.constructEvent(req.body, sig, endpointSecret);
  } catch (err) {
    console.log(`Webhook signature verification failed.`);
    return res.status(400).send(`Webhook Error: ${err.message}`);
  }

  // Handle the event
  switch (event.type) {
    case 'checkout.session.completed':
      const session = event.data.object;
      // Fulfill the purchase...
      break;
    case 'invoice.paid':
      // Continue to provision the subscription
      break;
    case 'invoice.payment_failed':
      // Notify user, revoke access
      break;
    default:
      console.log(`Unhandled event type ${event.type}`);
  }

  res.json({received: true});
});

Retrieve Customer

const customer = await stripe.customers.retrieve('cus_xxx');

List Subscriptions

const subscriptions = await stripe.subscriptions.list({
  customer: 'cus_xxx',
  status: 'active',
});

Cancel Subscription

const deleted = await stripe.subscriptions.cancel('sub_xxx');

Create Customer Portal Session

const portalSession = await stripe.billingPortal.sessions.create({
  customer: 'cus_xxx',
  return_url: 'https://example.com/account',
});

Key Event Types

Event Description
checkout.session.completed Payment successful
customer.subscription.created New subscription
customer.subscription.updated Subscription changed
customer.subscription.deleted Subscription canceled
invoice.paid Invoice payment successful
invoice.payment_failed Invoice payment failed
payment_intent.succeeded Payment completed
payment_intent.payment_failed Payment failed

Environment Variables

STRIPE_SECRET_KEY=sk_live_xxx  # or sk_test_xxx for testing
STRIPE_PUBLISHABLE_KEY=pk_live_xxx  # or pk_test_xxx
STRIPE_WEBHOOK_SECRET=whsec_xxx

Testing

Use test card numbers:

  • 4242424242424242 - Successful payment
  • 4000000000000002 - Card declined
  • 4000000000009995 - Insufficient funds

Best Practices

  1. Always verify webhooks - Use signature verification
  2. Idempotency keys - For safe retries on payment creation
  3. Store Stripe IDs - Save customer_id, subscription_id in your database
  4. Handle errors gracefully - Catch and log Stripe errors
  5. Use metadata - Attach your internal IDs to Stripe objects

Resources

stripe – AI Agent Skills | Claude Skills