Architecting Rx-Gated E-commerce with EMR Integration: Best Path for Authorize-Only Payments and Clinical Approval Workflow

Published: (January 8, 2026 at 03:09 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Overview

How would you architect an e‑commerce build for a longevity clinic given the following requirements?

  • Some SKUs require a prescription (including injectables), others are OTC, plus memberships and subscription packages.
  • The critical requirement is medical review prior to final payment capture for Rx‑required SKUs.

High‑level Flow

  1. Customer places an order.
  2. If the cart contains any Rx‑required SKU, the payment is authorized only (no capture).
  3. A medical‑risk assessment (rules‑based binary decision model) runs using clinic‑supplied thresholds and patient context.

Outcomes

ResultAction
ApprovedCapture payment and fulfill the order.
More action requiredHold the authorization, trigger a telehealth consult scheduling within 7 days, then a clinician manually approves or denies. After the decision, capture the payment or void/refund.

Architecture Pathways

1. Custom or Headless Commerce with Middleware Orchestration

  • Build a headless storefront (e.g., React, Next.js) that talks to a middleware orchestration service.
  • The middleware implements an order state machine, integrates a rules engine for medical‑risk assessment, and handles EMR synchronization.
  • Payment provider is called with an authorize‑only request; capture is performed only after clinical approval.

2. WooCommerce (Self‑Hosted) with Custom Plugins

  • Use WooCommerce as the base e‑commerce platform.
  • Develop custom plugins to:
    • Detect Rx‑required SKUs in the cart.
    • Perform an authorize‑only transaction.
    • Call out to a rules engine and the clinic’s EMR for medical review.
    • Manage the hold, capture, or void workflow based on the clinician’s decision.

3. Split Model: Non‑Rx Storefront + Rx Enrollment Portal

  • Separate the public storefront (OTC, memberships, subscriptions) from an Rx enrollment portal.
  • The portal handles eligibility checks, telehealth scheduling, and clinical approval before any payment is taken.
  • Reduces policy risk on the commerce platform because the payment for Rx items is only processed after clinical clearance.

4. Alternative Architecture (Not Yet Considered)

  • Serverless Event‑Driven Architecture:
    • Use a serverless function (e.g., AWS Lambda) triggered on order creation to start the authorization flow.
    • Store order state in a durable store (DynamoDB, Firestore).
    • Publish events to a message bus (SNS, Pub/Sub) that invoke the rules engine and EMR integration.
    • A separate workflow (Step Functions, Cloud Workflows) handles telehealth scheduling, clinician review, and final capture/void actions.

Recommendation Question

Which architecture is most robust for authorize‑only then capture after clinical approval, especially with telehealth escalation and manual overrides?

Back to Blog

Related posts

Read more »

Zig vs Go: init and run

Initialization In Go we initialize a module with: bash go mod init module-name In Zig the equivalent is simply: bash zig init Zig does not require explicit “mo...

Day 1 of Learning Linux & GitHub 🚀

markdown !Forem Logohttps://media2.dev.to/dynamic/image/width=65,height=,fit=scale-down,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2...