Skip to main content

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

  1. User selects credit pack (e.g., 500, 1k, 5k)
  2. Frontend creates Payment Intent via /api/payments/create-intent
  3. User completes card authentication
  4. Webhook listens for payment_intent.succeeded
  5. Credits added to user balance transactionally

Webhook Handling (Conceptual)

Idempotency & Safety

Credit Packs Example

Balance Endpoint

Response:
Future reserved credits: jobs queued but not yet debited.

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.
  • [/percify/credits]
  • [/percify/faq]

Next: Platform safety at [/percify/security].