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
| Method | Path | Description |
|---|
| POST | /v1/charge | Create a new charge for an order. |
| GET | /v1/charge/:id | Fetch a charge by id. |
Published Events
| Name | Schema | Broker |
|---|
| charge.completed | { chargeId, orderId, amount, currency } | kafka |
| charge.failed | { chargeId, orderId, reason } | kafka |
Consumed Events
| Name | Source | Broker |
|---|
| order.created | order-svc | kafka |
Data & Dependencies
Owned Data
| Store | Type | Description |
|---|
| charges | postgres | Charge records and their current state. |
Sync Dependencies
| Service | Type | Criticality | Reason | Endpoints | Resilience |
|---|
| fraud-svc | internal | hard | Pre-charge fraud scoring | | |
| Stripe | cloud | hard | Payment processing | | |
Async Dependencies
| Service | Event | Broker |
|---|
| order-svc | order.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
| Metric | Description |
|---|
charge_success_total | |
charge_latency_p99 | |
Distributed Tracing
Distributed tracing is enabled.
Alerts
Architecture Patterns
DDD Aggregates
Charge
- Root entity: Charge
- Invariants:
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.