integrate Brevo transactional emails and Stripe order/payment persistence
- Add Brevo email utility (src/lib/email/brevo.ts) with graceful no-op when API key missing
- Newsletter API: sends welcome email to subscriber
- Contact form API: sends confirmation to customer + alert to internal team
- Consultation API: sends booking confirmation + internal notification
- Engagement design API: sends brief confirmation + internal alert
- Wholesale apply API: migrated from SendGrid to Brevo, removed duplicate apply.ts
- Checkout API: creates Order + OrderItems before Stripe redirect, adds orderId to metadata
- Creates Payment record (PENDING) tied to Stripe checkout session
- Marks order CANCELLED if Stripe session creation fails
- checkout.session.completed: updates order totals, status (PAID/PENDING), captures addresses
- payment_intent.succeeded: enforces PAID status
- payment_intent.payment_failed: marks payment FAILED and order CANCELLED
- Added EMAIL_AND_PAYMENTS_INTEGRATION.md with env vars and setup instructions
e95288dView on GitHub →