Overview
Users acquire credits via one-off purchases or (future) subscription packs. Stripe Payment Intents are used to ensure strong idempotency and accurate post-payment credit allocation.Purchase Flow
- User selects credit pack (e.g., 500, 1k, 5k)
- Frontend creates Payment Intent via
/api/payments/create-intent - User completes card authentication
- Webhook listens for
payment_intent.succeeded - Credits added to user balance transactionally
Webhook Handling (Conceptual)
Idempotency & Safety
Credit Packs Example
Balance Endpoint
UI Patterns
- Real-time balance badge near generation actions
- Pre-flight cost preview vs available balance
- Post-purchase toast with new balance & usage suggestions
Failure Scenarios
Audit Logging
Store credit allocation events:{ id, userId, delta, source, referenceId, createdAt } for reconciliation.
Related Pages
- [/percify/credits]
- [/percify/faq]
Next: Platform safety at [/percify/security].