Domains

Payments and fraud

How payment authorization, Stripe integration, refunds and fraud screening are represented in the Payments domain.

Domain guide

PaymentsPaymentsDomainv1.0.0The Payments domain takes payment for orders and processes refunds. It orchestrates authorization and capture through an...Ownerpayments-platformMapView docs owns payment intent and payment outcomes. It integrates with external providers but keeps Acme’s internal payment state in Payment DatabasePayment DatabaseContainerv1.0.0PostgreSQL database that is the system of record for payments and refunds.Ownerpayments-platformMapView docs.

System context map

Payment Processing System

Payment Processing SystemPayment Processing SystemSystemv1.0.0Internal system that orchestrates payment for orders. It authorizes payments, requests charges from the external payment...Ownerpayments-platformMapView docs is composed of Payment APIPayment APIServicev1.0.0Receives payment authorization requests from the Ordering domain and records the payment intent, kicking off the charge ...Subscribesauthorize-paymentOwnerpayments-platformMapRepoView docs and Payment WorkerPayment WorkerServicev1.0.0Drives charges and refunds against the external payment processor and records the outcomes. It requests payments and ref...Publishespayment-requested, refund-requestedSubscribespayment-succeeded, payment-failedOwnerpayments-platformMapRepoView docs.

Payment APIPayment APIServicev1.0.0Receives payment authorization requests from the Ordering domain and records the payment intent, kicking off the charge ...Subscribesauthorize-paymentOwnerpayments-platformMapRepoView docs receives Authorize PaymentAuthorize PaymentCommandv1.0.0Command to authorize payment for the total of a checked-out cart. Ownerordering-platformSchemaMapView docs from checkout and records the intent. Payment WorkerPayment WorkerServicev1.0.0Drives charges and refunds against the external payment processor and records the outcomes. It requests payments and ref...Publishespayment-requested, refund-requestedSubscribespayment-succeeded, payment-failedOwnerpayments-platformMapRepoView docs drives the external charge/refund process and records outcomes.

Important events:

External providers

StripeStripeSystemv1.0.0External payment processor used by Acme Inc to charge cards and issue refunds. It receives payment and refund requests a...Ownerpayments-platformMapView docs is the external payment processor. It reports outcomes through Webhook EndpointWebhook EndpointServicev1.0.0Stripe's webhook delivery for payment and refund outcomes. It notifies Acme Inc whether a charge succeeded or failed, an...Publishespayment-succeeded, payment-failed +1Ownerpayments-platformMapRepoView docs events such as Payment SucceededPayment SucceededEventv1.0.0Published by Stripe when a charge succeeds. Ownerpayments-platformSchemaMapView docs, Payment FailedPayment FailedEventv1.0.0Published by Stripe when a charge fails. Ownerpayments-platformSchemaMapView docs and Refund ProcessedRefund ProcessedEventv1.0.0Published by Stripe when a refund has been processed. Ownerpayments-platformSchemaMapView docs.

Fraud DetectionFraud DetectionSystemv1.0.0External provider that screens payments for fraud. It consumes payment requests and returns a pass or fail verdict. Ownerpayments-platformMapView docs screens payment attempts and reports Fraud Check PassedFraud Check PassedEventv1.0.0Published when a payment passes fraud screening. Ownerpayments-platformSchemaMapView docs or Fraud Check FailedFraud Check FailedEventv1.0.0Published when a payment fails fraud screening. Ownerpayments-platformSchemaMapView docs.

Failure handling

Payments cross external boundaries, so every step should be durable and retryable. Do not assume webhook delivery order. Payment state transitions should be idempotent and traceable through the payment database.