Connects EMV credit-card terminals and check scanners at registration and cashiering desks to Epic for real-time point-of-service collection, posting authorized payments as DFT charges without pushing PAN or card data into Epic or MuleSoft.
Tags: healthcare, epic, revenue-cycle, hl7v2, connected-devices, api-led, event-driven, patient-access
Payment Device Integrations
Objective: Front-desk and cashiering staff need a card swipe/dip/tap or check scan to land against the guarantor account and visit in Epic immediately, with the receipt and balance correct before the patient leaves the window. The failure mode is a torn transaction: the terminal captured funds but Epic never recorded the payment, or Epic posted a payment the processor declined. Done looks like every authorized payment posting exactly once with a processor reference, every decline surfacing at the workstation in under two seconds, and end-of-day device totals reconciling to Epic posted amounts to the penny. This accelerator packages the Payment Device Integrations Epic Data Sharing Playbook as a MuleSoft-anchored solution plan.
What's Getting Built
- Device System API (System API) — fronts the EMV terminal and check-scanner fleet with a clean authorize, capture, and void contract ·
POST /authorize, POST /capture, POST /void, POST /scan/check
- Payment Process API (Process API) — orchestrates authorize-capture-settle, resolves the guarantor account, and builds the DFT with an idempotency key ·
POST /payments, GET /Account, POST /voids, POST /refunds
- Anypoint MQ Txn Queue (target) — durable transaction queue that holds a captured payment for retry until it reaches Bridges ·
PUBLISH txn, CONSUME txn
- Epic Bridges System API (System API) — posts the payment to Epic as an HL7v2 DFT and confirms the application acknowledgment ·
SEND DFT^P03, RECEIVE ACK
- Dead Letter Queue (target) — parks torn transactions and unpostable captures by correlation ID for reconciliation and replay ·
PUBLISH failed-txn, REPLAY /{correlationId}
Prerequisites
- Epic Bridges interface engine configured to accept inbound DFT^P03 payment/adjustment transactions against guarantor and hospital accounts
- P2PE or semi-integrated point-of-sale terminals (Verifone, Ingenico, or equivalent) that tokenize at the device and return only a payment token plus last-four and card brand
- A merchant payment gateway or processor (e.g. an Epic-certified partner) with authorize, capture, void, and settlement-report APIs
- Anypoint Platform runtime (CloudHub or RTF), Anypoint MQ for durable transaction queues, and a secrets manager or vault for gateway and mTLS credentials
- PCI DSS scope decision documented so terminals and gateway are in scope while MuleSoft and Epic remain out of scope for cardholder data
- Epic Prelude/ADT or scheduling feed to resolve workstation, department, and cashier drawer context for the point-of-service session
1. Epic interfaces and standards
This accelerator implements the Payment Device Integrations Epic Data Sharing Playbook. Register the connecting app on Epic on FHIR and confirm the customer has the relevant Epic modules licensed before building.
- Bridges HL7v2 DFT^P03 (post payments and adjustments to guarantor/hospital accounts)
- Hyperdrive/Hyperspace cashiering and point-of-service collection workflow
- ADT^A04/A08 for patient-registration and account context resolution
- Epic FHIR R4 Account and Coverage resources for balance and guarantor lookup
- Cogito reporting extract for daily posted-payment reconciliation
Architecture
2. Business requirements
- Post every authorized card payment and scanned check to the correct Epic guarantor or hospital account as a DFT^P03 in real time, with the patient still at the window.
- Treat authorization and Epic posting as one logical transaction: never post to Epic without a captured processor reference, never leave a capture unposted.
- Keep cardholder data out of Epic and MuleSoft entirely; carry only a device token, last-four, card brand, and processor transaction ID.
- Support void and refund at the point of service for same-day corrections, and adjustment postings for reversed transactions after settlement.
- Reconcile each terminal and drawer batch total against Epic posted amounts at end of day and flag any variance to a named queue.
3. Device ingestion and gateway orchestration
- Front the terminal fleet with a Device System API that speaks the semi-integrated POS protocol and exposes a clean authorize/capture/void contract to the Process API.
- Require terminals to tokenize on-device (P2PE) so the raw PAN is encrypted before it reaches the gateway and never enters the integration tier.
- Attach a client-generated correlation ID at the workstation and thread it through gateway, MQ, and the DFT message so a torn transaction is traceable end to end.
- For check scanning, capture the MICR line and Check 21 image reference from the scanner and map to a check-tender DFT rather than a card token.
- Enforce a hard timeout on the gateway authorize call and return a fast decline to the workstation rather than letting the cashier hang.
4. Mapping to Epic DFT and account resolution
- Resolve the guarantor and hospital account from the registration/cashiering context via FHIR R4 Account before building the financial transaction.
- Use DataWeave to build the DFT^P03 with FT1 segments carrying transaction type, amount, tender (card brand or check), and the processor reference in the transaction ID field.
- Map card brand and last-four into an FT1 note or user-defined field for receipt display without ever populating a PAN field.
- Send voids and same-day refunds as negative-amount or reversal FT1 segments tied to the original transaction ID for clean matching.
- Stamp the cashier, drawer, and department so Epic posts to the right point-of-service session and the batch reconciles by drawer.
5. Idempotency, error handling, and operations
- Persist the correlation ID and processor transaction ID as an idempotency key so a retried post never double-posts a payment to Epic.
- On a capture that succeeds at the gateway but fails to reach Bridges, hold the transaction in Anypoint MQ and retry with backoff before routing to the dead-letter queue.
- Alert on the absence of an expected posting: a gateway capture with no matching Epic ACK within the SLA window is the failure mode dashboards miss most often.
- Auto-void or flag for manual void any authorization that captured funds but could never be posted after retries exhaust.
- Provide a device-outage failover path that lets staff record a manual payment in Epic and reconciles it against the gateway batch later.
6. Security and compliance
- Encrypt PHI in transit and at rest.
- Audit-log every access to and modification of patient data, and carry a correlation ID end to end.
- Enforce minimum-necessary access for integration operators and support users.
- Keep PCI DSS scope on the terminals and gateway only; assert and test that no PAN, track, or CVV data ever transits or persists in MuleSoft or Epic.
- Use device-level P2PE tokenization and mutual TLS between the Device System API and the gateway so card data is encrypted end to end outside integration scope.
- Store gateway API keys and merchant credentials in a vault with rotation, never in DataWeave or property files, and scope them per merchant location.
- Mask last-four and card brand in logs and receipts, and exclude the processor transaction ID from any surface a patient-facing user cannot already see.
Sample payload — DFT P03 posting an authorized card payment to a guarantor account
MSH|^~\&|MULE_PAYMENTS|POS|EPIC|BRIDGES|20260820143512||DFT^P03^DFT_P03|CORR-8f3a2b1c|P|2.5.1
EVN|P03|20260820143512
PID|1||E1000345^^^EPI^MRN||DOE^JANE^M||19850214|F
PV1|1|O|REGISTRATION^^^MAIN||||||||||||||||V4459921
FT1|1|POS-778201|GW-TXN-4471902|20260820143510||PY|CC^Credit Card Payment|||45.00|||||CASHIER07^DRAWER3||^^^VISA4242
FT1|2|POS-778201|GW-TXN-4471902|20260820143510||||NTE|Auth approved token tok_9d2 last4 4242 brand VISA
Testing and validation
- Run the torn-transaction test: capture at the gateway, then kill the Bridges connection and confirm the payment holds in MQ and posts exactly once on recovery with no duplicate.
- Replay the same correlation ID and processor transaction ID and assert the idempotency key blocks a second DFT from posting.
- Send a declined authorization and confirm the workstation gets a fast decline and no DFT is generated.
- Post a payment then a same-day void and confirm Epic nets to zero on the account and the drawer batch matches.
- Validate DFT P03 structure and FT1 amounts against the Bridges spec in a test interface before enabling production routing.
- Reconcile a full simulated end-of-day gateway settlement batch against Epic posted totals and confirm zero variance.
Phased rollout
Phase 1 — Connect
- Stand up the Device System API against one terminal model and the gateway sandbox, and the Bridges System API against a non-production Epic interface.
- Establish mTLS to the gateway and confirm on-device tokenization returns only token, last-four, and brand.
Phase 2 — Map and test
- Build and validate DFT P03 mapping with test guarantor accounts, then run torn-transaction, idempotency, void, and reconciliation test suites.
- Pilot at a single registration desk with a supervised drawer and daily manual reconciliation against the gateway batch.
Phase 3 — Production
- Roll out desk by desk, enabling the DFT production route per department only after that desk reconciles clean for a defined window.
- Turn on absence-of-posting alerting and the device-outage manual-posting failover before scaling to the full fleet.
Success metrics
- Percentage of authorized captures posted to Epic within the real-time SLA target well above 99 percent.
- Count of torn transactions per day: captures with no matching Epic posting after retries.
- End-of-day reconciliation variance between gateway settlement and Epic posted totals, target zero.
- Median gateway authorize-to-workstation-response latency at the point of service.
- Duplicate-posting rate blocked by the idempotency key, should trend to zero attempts reaching Epic.
Troubleshooting
- Funds captured at the terminal but no payment appears on the Epic account. — Likely cause: The Bridges connection dropped after gateway capture and the transaction is parked awaiting retry or in the DLQ. Fix: Locate the transaction in MQ or the DLQ by correlation ID, confirm the processor reference, and replay it; the idempotency key prevents a duplicate if it already posted.
- The same payment posts twice to a guarantor account. — Likely cause: A retry generated a new DFT because the idempotency key was not derived from the processor transaction ID. Fix: Key idempotency on the processor transaction ID plus correlation ID, reverse the duplicate with an adjustment FT1, and add the dedupe assertion to the test suite.
- End-of-day drawer totals do not match Epic posted amounts. — Likely cause: Voids or refunds posted without linking to the original transaction ID, so Epic and the gateway net differently. Fix: Ensure void and refund FT1 segments carry the original processor transaction ID, then re-run reconciliation to confirm the drawer nets to zero variance.
- Cashier workstation hangs waiting on a card swipe. — Likely cause: The gateway authorize call has no enforced timeout and the terminal or network stalled. Fix: Enforce a hard timeout on the authorize call and return a fast decline or retry prompt so the cashier is never blocked at the window.
Deliverable: A deployable Anypoint application set — System APIs for the payment-terminal fleet and Epic Bridges/DFT posting, a Process API that orchestrates authorize-capture-settle with idempotency, and runbooks for reconciliation, chargebacks, and device-outage failover to manual posting.