# AI Birthday Card Maker — Paid AI V2 Project Lock

Date: 2026-09-15

## Product rules

1. Standalone project; do not alter the user's existing production sites to build this product.
2. Visitor never needs to write an image prompt. The server builds it from structured selections.
3. AI generates artwork/background only. Final birthday wording is rendered separately on the browser canvas.
4. Personal photo mode remains local-browser compositing unless a future version explicitly changes this.
5. `OPENAI_API_KEY` and `PADDLE_WEBHOOK_SECRET` are server-side secrets only.
6. In production, `REQUIRE_PAYMENT=1`.
7. Browser checkout completion is never sufficient to provision an AI credit.
8. Only a valid signed Paddle `transaction.completed` webhook for the configured project and price may grant credits.
9. Webhook retries must never duplicate credits; event and transaction IDs are idempotent.
10. One successful AI background consumes one card credit by default (`CREDITS_PER_PURCHASE` is configurable).
11. If AI generation fails after a credit reservation, return the credit.
12. Keep rate limits and the global daily image cap even after adding payments.
13. Generated backgrounds are temporary assets.
14. Keep final OpenAI model, Paddle price and displayed price configurable through environment settings.
15. Before public launch, use final business privacy/terms/refund language suitable for the seller's jurisdiction and Paddle setup.

## Master card format

- Portrait: 1024 × 1536
- Export: PNG
- AI image quality default: medium
- AI model: environment-configurable

## Paid user journey

Build/edit card → Buy AI card credit → Paddle checkout → signed server webhook → credit appears → Generate AI Background → credit consumed on success → edit text → download PNG.

## Do not regress

- No greeting text baked into AI artwork.
- No secret credentials in frontend code.
- No payment unlock based only on browser JavaScript.
- No duplicate crediting on webhook retry.
- No charge/credit loss when OpenAI generation itself fails.
- No removal of photo permission, rate limits, daily cost cap, or server-side validation.
