Payments
Stripe · PayPal · Webhooks · Paiements récurrents
Avancé
v1.3
Production Ready
1. Présentation
La stratégie de paiement suit le principe "webhook as source of truth" : aucune modification de statut n'est actée localement sans confirmation cryptographique de la passerelle.
2. Installation
"apps.payments", # dans INSTALLED_APPS # Puis dans requirements.txt : # stripe>=7.0 # paypalrestsdk
3. Configuration
# config/settings/base.py
STRIPE_SECRET_KEY = os.environ.get("STRIPE_SECRET_KEY")
STRIPE_PUBLISHABLE_KEY = os.environ.get("STRIPE_PUBLISHABLE_KEY")
STRIPE_WEBHOOK_SECRET = os.environ.get("STRIPE_WEBHOOK_SECRET")
PAYPAL_CLIENT_ID = os.environ.get("PAYPAL_CLIENT_ID")
PAYPAL_CLIENT_SECRET = os.environ.get("PAYPAL_CLIENT_SECRET")
PAYPAL_MODE = os.environ.get("PAYPAL_MODE", "sandbox")
4. Modèles de données
Payment
PaymentMethod
Note opérateur : Exécuter toujours python manage.py sync_stripe_plans après création de nouveaux tarifs dans le Dashboard Stripe.
5. Endpoints API
Payments
2 endpoints| Méthode | Endpoint | Description |
|---|---|---|
| GET | /api/v1/payments/ | Paiements |
| POST | /api/v1/payments/ | Initier paiement |
Métadonnées
| Mainteneur | Core Team |
| Version | v1.3 |
| Statut | Production Ready |
| Endpoints | 2 |
| Compatibilité | Django 5.0+ / Python 3.12 |