Purpose
Describe how PayPress keeps cached fundraising pages fresh.
Overview
REST hydration lets donation and fundraising pages remain cacheable while dynamic campaign metrics and controls load from an uncached public endpoint.
How It Works
The page renders stable markup and hydration hooks. PayPress JavaScript requests the campaign snapshot, then updates amount raised, donation count, goal percentage, progress bar, open/closed state, suggested amounts, custom amount availability, and limits.
Important Components
- Cached page markup.
- Hydration JavaScript.
- Public campaign state endpoint.
- Campaign snapshot DTO.
- Donation launcher.
- No-JavaScript donation route.
Data Flow
Cached page loads -> JS requests snapshot -> DOM updates metrics and controls -> customer launches donation -> server validates current campaign state -> Stripe Checkout.
Security Considerations
Hydration is display logic only. Checkout validation remains server-authoritative, so stale or manipulated front-end state cannot force an invalid donation.
Known Limitations
If JavaScript or REST requests fail, the hydrated experience may be unavailable. The no-JavaScript donation route provides a server-rendered fallback for donation checkout.