meta { name: 02 Start checkout type: http seq: 2 } post { url: {{baseUrl}}/api/v1/billing/checkout body: json auth: bearer } auth:bearer { token: {{token}} } body:json { { "plan": "pro", "cycle": "monthly" } } tests { test("200 OK", function () { expect(res.getStatus()).to.equal(200); }); test("URL Stripe Checkout retournée", function () { expect(res.getBody().data.url).to.match(/^https:\/\/checkout\.stripe\.com\//); }); } docs { POST /api/v1/billing/checkout — auth requise Crée une Stripe Checkout Session pour upgrader vers Pro ou Business. Body : ```json { "plan": "pro" | "business", "cycle": "monthly" | "yearly" } ``` Effets : - Crée le Stripe Customer si l'org n'en a pas (idempotent via `stripeCustomerId`) - Crée une Checkout Session en mode `subscription` avec le bon Price (lookup_key) - `subscription_data.metadata.organization_id` posé pour le webhook - `allow_promotion_codes: true`, `locale: "fr"`, billing address auto Réponse : ```json { "data": { "url": "https://checkout.stripe.com/c/pay/cs_test_..." } } ``` Le SPA fait `window.location.href = url`. L'user paye sur Stripe (UI hostée), puis Stripe le redirect vers `${WEB_URL}/parametres/abonnement?checkout=success`. ## Pour tester 1. Récupère un `token` via Auth → 01 Signup 2. Lance cette requête → tu reçois une URL Checkout 3. Ouvre l'URL dans un navigateur, paye avec CB test : `4242 4242 4242 4242` 4. Vérifie via **01 Get subscription** que `plan: "pro"` est posé 5. Mailpit (http://localhost:8025) : tu reçois un email "thank you for subscribing" }