Stripe Payments Api
Overview
Stripe is a suite of APIs powering online payment processing and commerce solutions.
When to Use This Skill
Use to implement e-commerce checkouts or software-as-a-service subscription pricing models.
Quick Start (with runnable code examples)
import stripe
stripe.api_key = "sk_test_..."
def create_checkout():
session = stripe.checkout.Session.create(
payment_method_types=['card'],
line_items=[{
'price_data': {
'currency': 'usd',
'product_data': {'name': 'Agent subscription'},
'unit_amount': 2000,
},
'quantity': 1,
}],
mode='payment',
success_url='https://example.com/success',
cancel_url='https://example.com/cancel',
)
return session.url
Advanced Usage
Handle Stripe webhook event signature verification (stripe.Webhook.construct_event) and customer portals.
Key References
Dependencies
- stripe>=8.0.0