Skip to content
Extraits de code Groupes Projets

BrainBoost - Service de Stripe

Description

Service gérant l'interaction avec les APIs Stripe

Objectif

  • Isoler la logique paiement
  • Exposer une API REST simple

Fonctionnalités principales

  • Création de clients Stripe
  • Orchestration de PaymentIntents et de sessions Checkout
  • Réaction aux webhooks

Architecture technique

  • Stack : Java 17, Spring Boot, Maven
  • Couches : Controller → Service → Repository
  • Tests : JUnit 5

Ports utilisés

  • dev : 8081
  • test : 8082
  • prod : 8080

Configuration

  • stripe.api.key
  • stripe.webhook.secret
  • spring.datasource.url
  • spring.datasource.username
  • spring.datasource.password
  • server.port

Stripe Webhook Setup

Development Environment

Local Development

  1. Install Stripe CLI: https://stripe.com/docs/stripe-cli
  2. Authenticate with Stripe:
    stripe login
  3. Start webhook forwarding:
    ./scripts/dev-webhook.sh
    Or manually:
    stripe listen --forward-to http://localhost:8080/api/stripe/webhook

Docker Environment

The Docker container automatically includes Stripe CLI and webhook forwarding:

docker build -t brainboost-stripe-service .
docker run -p 7072:7072 brainboost-stripe-service

The container will:

  • Start the Spring Boot application on port 7072
  • Automatically start Stripe webhook forwarding to http://localhost:7072/api/stripe/webhook
  • Handle authentication checks and graceful shutdown

Webhook Endpoint

  • URL: /api/stripe/webhook
  • Method: POST
  • Purpose: Receives Stripe webhook events for payment processing

Endpoints API

Méthode URI
POST /api/stripe/customers
POST /api/stripe/checkout/session
POST /api/payments/webhook
GET /api/stripe/payment-methods

Base de données utilisée

  • PostgreSQL