payment-microservice

Processes charges and manages the payment lifecycle.

Bounded Context: Billing
Team: payments-team · payments-team@example.com
On-call: pagerduty://payments


Responsibilities

  • Handles charge creation
  • Provides charge :id lookup
  • Publishes charge.completed
  • Publishes charge.failed
  • Reacts to order.created
  • Owns charges data
  • Depends on fraud-svc synchronously
  • Depends on Stripe synchronously
  • Subscribes to order-svc's order.created

Interfaces

REST API

MethodPathDescription
POST/v1/chargeCreate a new charge for an order.
GET/v1/charge/:idFetch a charge by id.

Published Events

NameSchemaBroker
charge.completed{ chargeId, orderId, amount, currency }kafka
charge.failed{ chargeId, orderId, reason }kafka

Consumed Events

NameSourceBroker
order.createdorder-svckafka

Data & Dependencies

Owned Data

StoreTypeDescription
chargespostgresCharge records and their current state.

Sync Dependencies

ServiceTypeCriticalityReasonEndpointsResilience
fraud-svcinternalhardPre-charge fraud scoring
StripecloudhardPayment processing

Async Dependencies

ServiceEventBroker
order-svcorder.created

Operations

SLO / SLA

  • Availability: 99.95%
  • Latency P99: 200ms

Security

  • Authentication: JWT (Auth0)
  • Handles PII: Yes

Deployment

  • Platform: kubernetes
  • Replicas: 3

Observability

Logs

structured JSON

Metrics

MetricDescription
charge_success_total
charge_latency_p99

Distributed Tracing

Distributed tracing is enabled.

Alerts

  • error_rate > 1%

Architecture Patterns

DDD Aggregates

Charge

  • Root entity: Charge
  • Invariants:
    • total must be >= 0

Sagas

Charge Saga

  • Type: Choreography
  • Trigger: order.created
  • Happy path: Reserve funds → Confirm charge → Publish charge.completed
  • Compensating: Release reserved funds

Generated by Microservice.MD™ on 2026-09-23 — MICROSERVICE.md™ is a lightweight, AI-ready documentation specification for microservice systems, created by Koesion.