Agent SkillsAgent Skills
git-tao

stripe

@git-tao/stripe
git-tao
0
0 forks
Updated 3/31/2026
View on GitHub

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

Installation

$npx agent-skills-cli install @git-tao/stripe
Claude Code
Cursor
Copilot
Codex
Antigravity

Details

Path.claude/skills/stripe/SKILL.md
Branchmain
Scoped Name@git-tao/stripe

Usage

After installing, this skill will be available to your AI coding assistant.

Verify installation:

npx agent-skills-cli list

Skill Instructions


name: stripe description: Stripe 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

EventDescription
checkout.session.completedPayment successful
customer.subscription.createdNew subscription
customer.subscription.updatedSubscription changed
customer.subscription.deletedSubscription canceled
invoice.paidInvoice payment successful
invoice.payment_failedInvoice payment failed
payment_intent.succeededPayment completed
payment_intent.payment_failedPayment 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