-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Why
As a developer
I want to store payment details
So that I can track payments
Acceptance Criteria
SCENARIO
Given I have hit the endpoint
When I provide transaction details
Then a db record should be created or updated
Proposed Implementation
Payments { id UUID / AutoID (primary key) orderId UUID / String (FK to Orders table) userId UUID / String (FK to Users table) stripePaymentId String (pi_123... from Stripe) amount Integer (stored in cents) currency String (e.g. "usd") status String (pending | succeeded | failed | refunded) paymentMethod String (card | apple_pay | google_pay) createdAt DateTime updatedAt DateTime rawEvent JSON (optional, full Stripe webhook payload) }
- A new payments table/collection exists with schema as above.
- On payment_intent.succeeded webhook, backend saves record.
- On payment_intent.payment_failed, backend saves failed attempt.
- Payments can be queried by orderId and userId.