- Add authentication with NextAuth v5 (credentials + email verification) - Implement dashboard with glycemia tracking and AI analysis - Add PDF report generation for Premium users - Implement Stripe integration for Premium subscriptions - Add responsive UI with Tailwind CSS and shadcn components - Database schema with Prisma ORM and PostgreSQL support - Real-time glycemia visualization with Recharts - Mobile-optimized entry form - User profile management with medical information - Subscription lifecycle management (create, cancel, webhook) - Email notifications with Resend - Feature gates for Free vs Premium plans Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
74 lines
2.0 KiB
Markdown
74 lines
2.0 KiB
Markdown
# Configuration Stripe
|
|
|
|
## 1. Créer un compte Stripe
|
|
|
|
1. Accédez à [https://stripe.com](https://stripe.com)
|
|
2. Créez un compte ou connectez-vous
|
|
3. Accédez au [Dashboard Stripe](https://dashboard.stripe.com)
|
|
|
|
## 2. Récupérer les clés API
|
|
|
|
1. Dans le sidebar, allez à **Developers** > **API Keys**
|
|
2. Copiez les clés :
|
|
- `pk_test_...` → `NEXT_PUBLIC_STRIPE_KEY`
|
|
- `sk_test_...` → `STRIPE_SECRET_KEY`
|
|
|
|
## 3. Créer un produit et un plan
|
|
|
|
1. Allez à **Products** dans le sidebar
|
|
2. Cliquez sur **Create Product**
|
|
3. Remplissez les détails :
|
|
- **Name** : `Diabetix Premium`
|
|
- **Description** : `Accès illimité, analyse IA et coaching`
|
|
4. Dans la section **Pricing**, créez un plan :
|
|
- **Amount** : `4.99` EUR
|
|
- **Billing period** : Monthly
|
|
5. Copiez l'ID du prix (commence par `price_...`) → `STRIPE_PRICE_ID`
|
|
|
|
## 4. Configurer le webhook
|
|
|
|
1. Allez à **Developers** > **Webhooks**
|
|
2. Cliquez sur **Create Endpoint**
|
|
3. Remplissez :
|
|
- **Endpoint URL** : `https://votre-domaine.com/api/stripe/webhook`
|
|
- **Events** : Sélectionnez :
|
|
- `customer.subscription.created`
|
|
- `customer.subscription.updated`
|
|
- `customer.subscription.deleted`
|
|
- `invoice.payment_failed`
|
|
4. Copiez le **Signing Secret** → `STRIPE_WEBHOOK_SECRET`
|
|
|
|
## 5. Mettre à jour .env.local
|
|
|
|
```bash
|
|
NEXT_PUBLIC_STRIPE_KEY=pk_test_...
|
|
STRIPE_SECRET_KEY=sk_test_...
|
|
STRIPE_PRICE_ID=price_...
|
|
STRIPE_WEBHOOK_SECRET=whsec_...
|
|
```
|
|
|
|
## 6. Tester localement avec Stripe CLI
|
|
|
|
```bash
|
|
# Installer Stripe CLI
|
|
npm install -g @stripe/cli
|
|
|
|
# Se connecter
|
|
stripe login
|
|
|
|
# Faire suivre les webhooks à votre serveur local
|
|
stripe listen --forward-to localhost:3000/api/stripe/webhook
|
|
|
|
# Simuler un paiement
|
|
stripe trigger customer.subscription.created
|
|
```
|
|
|
|
## Mode production
|
|
|
|
Avant de passer en production :
|
|
|
|
1. Utilisez les clés **Live** au lieu des clés **Test**
|
|
2. Mettez à jour l'URL du webhook vers votre domaine de production
|
|
3. Testez le processus complet de paiement
|
|
4. Configurez une page de confirmation après paiement
|