Documentation Index
Fetch the complete documentation index at: https://docs.prudra.dev/llms.txt
Use this file to discover all available pages before exploring further.
How sessions work
A payment session is created when a paying request arrives withacceptSessions: true configured and the MPP challenge intent was session. The session is atomic — the PaymentSession and its linked Vault are created together, with a UNIQUE constraint on sessionId in the Vault table guaranteeing exactly one vault per session.
Session creation flow
The response includes theX-PRUDRA-SESSION-ID header. The agent stores this value and includes it in all subsequent requests.
Session reuse flow
No payment verification on session requests — the session ID is the authorization.Session scoping
Sessions are scoped to the organisation. A session ID cannot be used across organisations. Two organisations can never accidentally share a session, even if they use the same session ID value (which is a UUID — collision is cryptographically unlikely).The PaymentSession model
Session ID in your handler
After the middleware processes a session request, your handler has access to:req.sessionId is set on both the first request (where it’s created) and subsequent requests (where it’s reused).
When a session expires
Session expiry is checked on every incoming session request. IfexpiresAt < now():
- The session lookup returns
null payMiddlewarefalls through to normal payment flow- A fresh 402 is returned with new challenges
- The agent must pay again to create a new session
Related
- Add session payments — configure
payMiddlewarefor sessions - Handle multi-step workflows — the two-request pattern
- Session expiry and renewal — default TTL and custom TTL
- Vault lifecycle — what happens to session vaults after expiry

