stripe-integration
Integrate Stripe Payments
Également disponible depuis: wshobson
This skill provides comprehensive Stripe payment integration guidance for implementing checkout, subscriptions, webhooks, and refund handling with PCI-compliant best practices.
Télécharger le ZIP du skill
Importer dans Claude
Allez dans Paramètres → Capacités → Skills → Importer un skill
Activez et commencez à utiliser
Tester
Utilisation de "stripe-integration". Create a checkout session for a $49 product
Résultat attendu:
I can help you create a Stripe checkout session. Here's the Python code:
```python
import stripe
stripe.api_key = 'sk_test_YOUR_KEY'
session = stripe.checkout.Session.create(
payment_method_types=['card'],
line_items=[{
'price_data': {
'currency': 'usd',
'product_data': {'name': 'Premium Widget'},
'unit_amount': 4900, # $49.00 in cents
},
'quantity': 1,
}],
mode='payment',
success_url='https://yoursite.com/success?session_id={CHECKOUT_SESSION_ID}',
cancel_url='https://yoursite.com/cancel',
)
# Redirect user to session.url
```
This creates a hosted checkout page. The user will be redirected to Stripe's secure payment form.
Utilisation de "stripe-integration". Handle a payment succeeded webhook securely
Résultat attendu:
Here's a secure webhook handler using Flask with signature verification:
```python
from flask import Flask, request
import stripe
app = Flask(__name__)
endpoint_secret = 'whsec_YOUR_SECRET'
@app.route('/webhook', methods=['POST'])
def webhook():
payload = request.data
sig_header = request.headers.get('Stripe-Signature')
try:
event = stripe.Webhook.construct_event(
payload, sig_header, endpoint_secret
)
except ValueError:
return 'Invalid payload', 400
except stripe.error.SignatureVerificationError:
return 'Invalid signature', 400
if event['type'] == 'payment_intent.succeeded':
payment_intent = event['data']['object']
# Process the payment - update database, send receipt, etc.
return 'Success', 200
```
Audit de sécurité
SûrAll 47 static findings are false positives. The skill contains legitimate Stripe payment integration documentation with Python code examples. Detected patterns (backtick execution, hardcoded URLs, API key access) are benign documentation artifacts: backticks are markdown code fences, URLs are placeholder examples, and API key patterns are documented placeholders showing where users should insert their own keys.
Problèmes à risque moyen (3)
Facteurs de risque
🌐 Accès réseau (6)
⚙️ Commandes externes (26)
Score de qualité
Ce que vous pouvez construire
E-commerce Checkout Implementation
Add Stripe checkout to web applications for accepting one-time payments with hosted checkout pages.
SaaS Subscription Management
Set up recurring billing for SaaS products with customer portal access and subscription lifecycle management.
Webhook Event Processing
Process payment events securely with signature verification and idempotent handling for production systems.
Essayez ces prompts
Help me set up a basic Stripe checkout flow for a one-time payment of $29. Show me how to create a checkout session and redirect the user.
Create a subscription checkout flow for a monthly service at $19/month. Include customer creation and subscription activation.
Write a secure webhook handler in Python that verifies the Stripe signature and processes payment_intent.succeeded events.
Show me how to implement partial refunds and handle the refund workflow including the reason codes.
Bonnes pratiques
- Always verify webhook signatures using stripe.Webhook.construct_event to prevent spoofed events
- Use Stripe's hosted checkout pages to minimize PCI compliance burden
- Handle webhook events idempotently by checking for duplicate event IDs before processing
- Store only payment method IDs, never raw card data, to maintain PCI compliance
- Use test mode keys during development and verify all payment flows with test card numbers
Éviter
- Do not rely on client-side payment confirmation alone - always verify via webhooks
- Do not hardcode API keys in source code - use environment variables or secrets management
- Do not process the same webhook event twice - implement idempotency checks
- Do not use production API keys in test mode or test cards in production