Contract v1 · generated reference
RuntimeHandler.paymentsWebhook
OP-RUNTIME-PAYMENTS-WEBHOOK is a webhook operation owned by Traveler.
Back to the complete API catalogue
Authority and transport
- Actor
- verified provider
- Authentication
- provider signature
- Authorization
- signature and environment isolation
- Resource boundary
- server-derived from verified payload and stored state
- Transport
WEBHOOK- Deployed export
paymentsWebhook- App Check
- NOT_APPLICABLE
- Canonical source
functions/src/properties/traveler/payments/handler.ts
Request schema
| Field | Required | Schema |
|---|---|---|
rawBody | Yes | Stripe Event JSON bytes, maximum 1,000,000 bytes |
stripe-signature | Yes | timestamp plus one or more v1 HMAC digests |
Response schema
HTTP 200 { received: true | deduplicated: true } or governed JSON error
States, consistency and recovery
- State path
- RECEIVED → SIZE_AND_SIGNATURE_VALIDATION → ENVIRONMENT_MODE_CHECK → INBOX_CLAIM_OR_DEDUPLICATION → MONOTONIC_SAGA_PROCESSING → BOOKING_PROJECTION_OR_RECONCILIATION → ACKNOWLEDGED_OR_PROVIDER_RETRY
- Reads
- provider inbox, payment saga, hold, quote, inventory and booking authority
- Writes
- provider inbox plus monotonic saga, hold, booking and reconciliation projections
- Transaction
- inbox lease followed by bounded Firestore transactions and final acknowledgement
- Idempotency
- Stripe event id with a recoverable inbox lease
- Concurrency
- inbox lease plus monotonic saga and projection transactions
- Retry/replay
- duplicate and out-of-order safe; 503 includes Retry-After while a lease is busy
- Rate limits
- Provider delivery policy; busy processing returns HTTP 503 with Retry-After: 60.
- Audit
- provider event id and privacy-safe failure code; never raw body or signature
Error contract
Exact public webhook response families; internal processing details collapse to a privacy-safe failure code. Never treat an unknown error as success.
raw body unavailablepayments/payload-too-largepayments/missing-signaturepayments/invalid-signaturepayments/stale-timestamppayments/invalid-jsonpayments/invalid-eventpayments/invalid-app-environmentpayments/provider-mode-mismatchpayments/event-processing-in-progresspayments/processing-failed
Producer test references
Evidence tier: SEMANTIC_CORE_REFERENCE.
Reviewer-mapped semantic/core references
packages/backend-firebase/test/operation-contracts.test.mjsfunctions/test/payments-webhook.test.jsfunctions/test/payments-event-durability.test.js
Protocol or inventory references
packages/backend-firebase/test/operation-contract-detector.mjs
These references prove export, wrapper or protocol behavior only. They are not counted as complete operation semantics.
Example availability
NOT_PUBLIC_TRANSPORT: This handler is provider- or platform-invoked and has no public client invocation.
Common integration contract
Sandbox and Production are isolated
Run examples only in a governed sandbox or local emulator. Sandbox identities, App Check tokens, payment fixtures and data do not grant Production access. The typed ports do not ratify a public numeric quota; enforcement may be stricter. Honor RATE_LIMITED and the server's retry-after value.
Authentication and authorization
Firebase Auth proves identity. App Check proves the approved app where a callable requires it. Roles, organization membership, requester identity and resource ownership are derived and rechecked by the server.
Authentication guideErrors and recovery
Stable error codes distinguish validation, denial, conflict, expiry, authority pending, rate limiting and temporary unavailability. Never infer success from an HTTP redirect or a browser state.
Error catalogueIdempotency, concurrency and retry
Reuse an idempotency key only for an identical retry. A new intent needs a new key. Preserve version preconditions and reload after a conflict.
Retry guidanceChanges and escalation
Check compatibility before adopting a new contract version. Review the changelog, service status and support guidance before retrying a persistent failure.
| Family | Client decision |
|---|---|
| Authentication / authorization | Refresh or step up only when instructed; do not retry a denial unchanged. |
| Validation / conflict / expiry | Correct or reload state, then obtain confirmation for a new intent. |
| Rate limited / unavailable | Honor retry-after and use bounded backoff; inspect service status. |
| Unknown / server | Fail closed and escalate with a privacy-safe correlation id. |
Executable network examples are published only when the exact wire schema is producer-proven. Check the selected operation's example-availability status; an unresolved schema is a release blocker, not permission to guess.
Verified examples and local-only recovery snippets