Storefront has been decoupled into micro-frontends with a dedicated commerce app and shared shell.

Read the architecture guide →

ADR-004: Use Stripe-hosted Checkout with PCI DSS controls

Propose Stripe as the payment gateway using hosted Checkout to keep card data outside BookWorm, with explicit merchant PCI DSS responsibilities and verified payment outcomes.

November 5, 2026ProposedSecurity

1. Context & Problem

Currently, Order SystemSystemv1.0.0Order SystemInternal system that creates and manages accepted customer Orders, preserving purchase-time items and prices while ownin...Ownercommerce-fulfillment-teamDiagramOpen docs records accepted purchases and manages their business status, while Finance SystemSystemv1.0.0Finance SystemInternal BookWorm workflow system that coordinates post-checkout basket cleanup and order notifications through Durable ...Ownercommerce-fulfillment-teamDiagramOpen docs coordinates basket cleanup and customer notifications. Neither system authorizes, captures, or settles real payments—meaning an accepted order, cleared basket, or completed status does not prove money was collected.

To support real online payments safely, BookWorm needs a payment gateway solution that keeps sensitive card numbers and security codes completely out of BookWorm’s applications, databases, logs, and messages. At the same time, outsourcing card entry does not eliminate BookWorm’s legal and security obligations as the merchant to meet Payment Card Industry Data Security Standard (PCI DSS) requirements.

2. Business Value

  • Minimized security exposure: Customers enter card details directly on Stripe’s hosted page, keeping raw card data off BookWorm servers and drastically reducing breach impact.
  • Faster time to market with lower compliance scope: Targeting the simplest merchant self-assessment tier avoids heavy infrastructure audits required when handling card data directly.
  • Built-in authentication and fraud readiness: Customer verification steps (such as 3D Secure) and payment-method handling are managed by the payment provider.
  • Tamper-resistant pricing: Payment totals are derived strictly from BookWorm’s locked purchase snapshot rather than browser-supplied figures.

3. How It Works

Proposal status: This document proposes a target payment design and rollout checklist. It does not describe an implemented integration or certify BookWorm as PCI DSS compliant.

Payment Flow

  1. Server-verified checkout creation: An authenticated customer requests payment for an order they own. BookWorm creates a payment session with Stripe using the locked purchase snapshot and a validated currency—never trusting prices or totals sent from the customer’s browser.
  2. Duplicate protection: Each payment session and underlying payment record is tied to an opaque order identifier and a persisted payment-attempt identifier. Retries reuse the same protection key, concurrent payment attempts on the same order are blocked, and uncertain outcomes are resolved before starting a new attempt.
  3. Hosted card entry: BookWorm redirects the customer to Stripe’s hosted checkout page, where card entry and customer authentication happen entirely on Stripe’s infrastructure. BookWorm never collects, stores, forwards, or logs card numbers or security codes.
  4. Verified payment notifications: Stripe sends payment outcome notifications back to BookWorm over encrypted channels. BookWorm cryptographically verifies every notification before trusting it, rejects unverified messages, and never disables signature checks even if configuration is missing.
  5. Reliable, duplicate-safe recording: Verified payment events are saved durably before acknowledging receipt, deduplicated so repeated or out-of-order notifications never corrupt payment state, and reconciled directly with Stripe if state is unclear.
  6. Strict confirmation before marking paid: Simply landing back on a “payment success” web page is never treated as proof of payment. BookWorm confirms the expected order, payment attempt, amount, currency, live/test mode, and a settled paid status before recording payment success (handling delayed payment methods asynchronously if enabled).
  7. Separation of payment, order, and cleanup states: Payment state remains separate from the order’s business status and Finance’s cleanup workflow. A successful payment does not automatically mean the order is fulfilled, a failed basket cleanup must never erase a paid order, and a late payment arriving after cancellation requires reconciliation and an explicit refund or recovery decision.

Merchant Security & Compliance Responsibilities

Even with hosted checkout, BookWorm retains clear merchant obligations:

  • Compliance validation: Target the hosted-redirect self-assessment scope, confirming exact eligibility and validation steps with the acquiring bank and, where needed, a Qualified Security Assessor before going live.
  • Annual vendor & merchant reviews: Document the payment data flow and responsibility split, retain Stripe’s annual compliance attestation, and complete BookWorm’s own annual merchant assessment.
  • Storefront & secret protection: Protect the storefront and redirect path against tampering through secure change control, vulnerability scanning, access controls, monitoring, and incident response. Store secret keys securely, separate test and live credentials, enforce least-privilege access, rotate secrets, and require multi-factor authentication for administrative access.
  • Minimal data retention: Store only required provider references, amounts, currency, and payment status under strict access and retention rules, excluding raw payment payloads and sensitive customer data from logs, traces, events, and provider metadata.

Rollout Gates Before Go-Live

Before accepting this proposal or enabling live payments, the team must:

  • Assign the payment integration’s service owner and database boundary (without turning the existing Finance workflow into a payment processor).
  • Define payment outcome contracts, currency rules, authorization checks, refund/cancellation handling, reconciliation jobs, operational alerts, and race-condition fixes between payment and basket-cleanup soft deletion.
  • Test happy paths, declines, authentication challenges, abandoned sessions, duplicate requests/notifications, invalid signatures, delayed or out-of-order events, timeouts, amount mismatches, and cancellation races—verifying card data never enters BookWorm storage or telemetry.
  • Obtain formal sign-off on compliance scope and roll out behind a disabled-by-default feature toggle alongside a reconciliation and incident-response runbook.

4. Trade-offs & Lessons Learned

Alternatives Considered

  • Collect card data through BookWorm APIs: Rejected because it dramatically expands the regulated cardholder-data environment and compliance burden.
  • Embedded Checkout or Stripe Elements: Deferred unless future UI customization needs justify a deeper integration and a fresh compliance scope review.
  • Another hosted payment provider: Remains a viable fallback if Stripe’s commercial terms, regional availability, or payment-method support do not meet BookWorm’s needs.

Operational Trade-offs & Risks

  • Compliance is shared, not eliminated: Using Stripe does not automatically certify BookWorm; merchant storefront security and annual validation remain BookWorm’s responsibility.
  • Limited UI customization & vendor dependency: Redirecting to a hosted page constrains checkout branding and introduces reliance on Stripe’s availability, fees, and account eligibility.
  • Added operational complexity: Reliable payments require durable payment-attempt records, idempotent notification handling, refund workflows, and reconciliation processes beyond the current checkout saga. Existing Order and Finance behavior remains unchanged until implemented.

5. Technical Reference

  • Target gateway & compliance profile: Stripe-hosted Checkout targeting PCI DSS SAQ A eligibility over HTTPS with TLS 1.2 or newer.
  • Checkout & correlation rules:
    • Server-side integration creates a Stripe Checkout Session from the persisted purchase snapshot and an explicitly validated currency using Stripe currency units and rounding rules.
    • Correlate each Checkout Session and PaymentIntent with an opaque Order ID and persisted payment-attempt ID using idempotency keys on retries.
  • Webhook verification & idempotency:
    • Verify Stripe-Signature against the unmodified raw request body using the endpoint’s signing secret and official Stripe SDK timestamp tolerance. Reject invalid signatures; never bypass verification when config is absent.
    • Durably persist verified events prior to acknowledgment, deduplicate by Stripe event ID, and reconcile against the live Stripe object API when needed.
    • Require verified paid status (not just a redirect or checkout.session.completed alone when delayed payment methods are enabled), confirming expected Order, payment attempt, amount, currency, and live/test environment.
  • References: