Small payments service. Exposes POST /charges (idempotent), GET /charges/{id}, and GET /customers/search?email=.
Secrets are read from a local .env file (gitignored), never hardcoded. Before
running, copy the template and fill in real values:
cp .env.example .env
# then edit .env and set STRIPE_API_KEY=...Spring Boot loads .env at startup via spring.config.import (see
src/main/resources/application.properties). In CI/production, supply
STRIPE_API_KEY as a real environment variable instead of a file.
mvn spring-boot:runThe API listens on http://localhost:8080.
curl -X POST http://localhost:8080/charges \
-H "Content-Type: application/json" \
-d '{"idempotencyKey":"k1","amount":12.50,"currency":"USD","customerEmail":"a@b.com","cardToken":"tok_visa"}'- docs/idempotency.md — how
POST /chargesstays idempotent, why the in-memory approach is single-instance only, and what a multi-instance deployment needs. - docs/session-log.md — the prompts that drove the hardening work and the change made in response to each.
Customers are reporting two issues:
- Some are seeing duplicate charges for the same purchase.
- Our security team flagged something on this endpoint in their last review.
There may be more. Find what you can.