Stripe Integration
When to Use
Trigger phrases:
"stripe integration"
"Integrate Stripe for payments, subscriptions, invoicing, and billing"
When adding payment processing to an application
When implementing subscription billing or recurring payments
When building checkout flows or payment forms
When handling Stripe webhooks for payment events
When NOT to Use
- For non-Stripe payment gateways (use their specific skills)
- For simple donation pages (use simpler payment widgets)
Overview
Full Stripe integration covering payments, subscriptions, invoicing, and billing. Handles checkout sessions, customer portal, webhooks, and error handling.
Workflow
- Install SDK -
npm install stripe or pip install stripe
- Configure - Set API keys (test + live), webhook endpoints
- Build checkout - Create checkout sessions or payment elements
- Handle webhooks - Process payment events (succeeded, failed, refunded)
- Manage customers - Create, update, attach payment methods
- Handle errors - Declined cards, expired tokens, rate limits
Anti-Rationalization Table
| Rationalization |
Reality |
| "I will handle payments myself" |
PCI compliance is complex - Stripe handles it for you |
| "Webhooks are optional" |
Without webhooks, you miss failed payments, refunds, and disputes |
| "Test mode is enough" |
Always test with real card numbers in live mode before launch |
Code Example (Node.js)
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
const session = await stripe.checkout.sessions.create({
mode: 'subscription',
payment_method_types: ['card'],
line_items: [{ price: 'price_xxx', quantity: 1 }],
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
});
app.post('/webhook', express.raw({type: 'application/json'}), (req, res) => {
const sig = req.headers['stripe-signature'];
const event = stripe.webhooks.constructEvent(req.body, sig, endpointSecret);
switch (event.type) {
case 'invoice.payment_succeeded': break;
case 'invoice.payment_failed': break;
}
res.json({received: true});
});
Process
- Prepare — Gather requirements, verify prerequisites, set up environment
- Execute — Run stripe integration workflow with configured parameters
- Verify — Validate output meets requirements, document results
Verification
1---2name: stripe-integration3description: Use when integrate Stripe for payments, subscriptions, invoicing, and4 billing. Handle checkout sessions, webhooks, customer management, and payment method5 handling. Use when integrateing stripe for payments, subscriptions, invoicing, and6 billing. handle checkout.7domain: integrations8author: oyi779license: Apache-2.010subdomain: integrations11tags:12- payments13- stripe14- billing15- subscriptions16- checkout17- webhooks18version: 1.0.019category: integrations20metadata:21 source: https://skillmd.com/skills/oyi77/stripe-integration22---232425# Stripe Integration2627## When to Use28**Trigger phrases:**29- "stripe integration"30- "Integrate Stripe for payments, subscriptions, invoicing, and billing"313233- When adding payment processing to an application34- When implementing subscription billing or recurring payments35- When building checkout flows or payment forms36- When handling Stripe webhooks for payment events3738## When NOT to Use3940- For non-Stripe payment gateways (use their specific skills)41- For simple donation pages (use simpler payment widgets)4243## Overview4445Full Stripe integration covering payments, subscriptions, invoicing, and billing. Handles checkout sessions, customer portal, webhooks, and error handling.4647## Workflow48491. **Install SDK** - `npm install stripe` or `pip install stripe`502. **Configure** - Set API keys (test + live), webhook endpoints513. **Build checkout** - Create checkout sessions or payment elements524. **Handle webhooks** - Process payment events (succeeded, failed, refunded)535. **Manage customers** - Create, update, attach payment methods546. **Handle errors** - Declined cards, expired tokens, rate limits5556## Anti-Rationalization Table5758| Rationalization | Reality |59|---|---|60| "I will handle payments myself" | PCI compliance is complex - Stripe handles it for you |61| "Webhooks are optional" | Without webhooks, you miss failed payments, refunds, and disputes |62| "Test mode is enough" | Always test with real card numbers in live mode before launch |6364## Code Example (Node.js)6566```javascript67const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);6869const session = await stripe.checkout.sessions.create({70 mode: 'subscription',71 payment_method_types: ['card'],72 line_items: [{ price: 'price_xxx', quantity: 1 }],73 success_url: 'https://example.com/success',74 cancel_url: 'https://example.com/cancel',75});7677app.post('/webhook', express.raw({type: 'application/json'}), (req, res) => {78 const sig = req.headers['stripe-signature'];79 const event = stripe.webhooks.constructEvent(req.body, sig, endpointSecret);80 switch (event.type) {81 case 'invoice.payment_succeeded': break;82 case 'invoice.payment_failed': break;83 }84 res.json({received: true});85});86```878889## Process90911. **Prepare** — Gather requirements, verify prerequisites, set up environment921. **Execute** — Run stripe integration workflow with configured parameters931. **Verify** — Validate output meets requirements, document results9495## Verification9697- [ ] Checkout session creates successfully98- [ ] Payment processes in test mode99- [ ] Webhooks verify signature correctly100- [ ] Failed payments handled gracefully101