API Reference
API Billing & Stripe
Endpoints pour la gestion des plans, abonnements Stripe, checkout, portail client et facturation.
Base URL
https://api.productsmanager.app/api/v1/billing
Plans
| Methode | Endpoint | Description |
|---|---|---|
| GET | /plans | Liste des plans disponibles avec tarifs |
Exemple de reponse
{
"plans": [
{
"id": "starter",
"name": "Starter",
"monthly_price_eur": 29,
"yearly_price_eur": 290,
"features": {
"max_products": 5000,
"max_suppliers": 10,
"max_users": 3,
"ai_enrichment": false,
"connectors": 2
},
"stripe_price_id_monthly": "price_xxx",
"stripe_price_id_yearly": "price_yyy"
}
]
}
Checkout
| Methode | Endpoint | Description |
|---|---|---|
| POST | /checkout | Creer une session Stripe Checkout |
Creer une session checkout
curl -X POST "https://api.productsmanager.app/api/v1/billing/checkout" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"plan_id": "professional",
"billing_cycle": "yearly",
"success_url": "https://app.productsmanager.app/settings/billing?success=true",
"cancel_url": "https://app.productsmanager.app/pricing"
}'
Reponse
{
"checkout_url": "https://checkout.stripe.com/c/pay/cs_xxx",
"session_id": "cs_xxx"
}
Le client est redirige vers Stripe Checkout pour saisir ses informations de paiement.
Portail Client
| Methode | Endpoint | Description |
|---|---|---|
| POST | /portal | Creer une session Stripe Customer Portal |
Le portail Stripe permet au client de gerer son abonnement, mettre a jour sa carte et telecharger ses factures.
{
"portal_url": "https://billing.stripe.com/p/session/xxx"
}
Abonnement
| Methode | Endpoint | Description |
|---|---|---|
| GET | /subscription | Abonnement actuel du tenant |
Exemple de reponse
{
"plan_id": "professional",
"status": "active",
"billing_cycle": "yearly",
"current_period_start": "2026-01-15T00:00:00Z",
"current_period_end": "2027-01-15T00:00:00Z",
"cancel_at_period_end": false,
"usage": {
"products": {"current": 12500, "limit": 50000},
"suppliers": {"current": 45, "limit": 100},
"users": {"current": 8, "limit": 25}
}
}
Factures
| Methode | Endpoint | Description |
|---|---|---|
| GET | /invoices | Liste des factures du tenant |
{
"invoices": [
{
"id": "in_xxx",
"date": "2026-03-01",
"amount_eur": 290.00,
"status": "paid",
"pdf_url": "https://pay.stripe.com/invoice/xxx/pdf"
}
]
}
Configuration Stripe
| Methode | Endpoint | Description |
|---|---|---|
| GET | /payment-config | Configuration actuelle |
| PUT | /payment-config | Sauvegarder la configuration |
| POST | /payment/stripe/test | Tester la connexion Stripe |
Sauvegarder la configuration
PUT /api/v1/billing/payment-config
{
"provider": "stripe",
"publishable_key": "pk_live_xxx",
"secret_key": "sk_live_xxx",
"webhook_secret": "whsec_xxx",
"client_id": "ca_xxx",
"client_secret": "rk_live_xxx"
}
Les cles secretes (secret_key, webhook_secret, client_secret) sont chiffrees avant stockage. Ne les transmettez jamais cote client.
Webhooks Stripe
https://api.productsmanager.app/api/v1/stripe/webhooks
Cet endpoint est public (pas de JWT) mais protege par verification de signature HMAC Stripe.
Evenements traites
| Evenement Stripe | Action |
|---|---|
checkout.session.completed | Activation de l'abonnement |
customer.subscription.updated | Mise a jour du plan |
customer.subscription.deleted | Desactivation |
invoice.payment_succeeded | Enregistrement facture |
invoice.payment_failed | Notification echec paiement |
Idempotence
Chaque evenement est enregistre dans stripe_webhook_events avec son event_id. Les doublons sont ignores (reponse 200 OK sans traitement).
Configurez l'URL webhook dans votre dashboard Stripe : https://api.productsmanager.app/api/v1/stripe/webhooks. Selectionnez les evenements listes ci-dessus.