Getting Started with Payment Service
The Payment Service is a high-performance payment microservice built with Rust and Actix Web.
Overview
The Payment Service provides:
- Payment processing with multiple providers
- Subscription management
- Invoice generation
- Payment provider abstraction
Features
- ✅ REST API and GraphQL
- ✅ Provider abstraction (PayFast, Yoco, Stripe-ready)
- ✅ OpenTelemetry tracing
- ✅ Prometheus metrics
- ✅ PostgreSQL storage
- ✅ Health and metrics endpoints
Prerequisites
- Rust 1.70+
- PostgreSQL 14+
- Docker (optional)
Quick Start
- Local Setup
- Docker
# Navigate to payment service
cd shared/payment
# Build and run
cargo run
# Or in release mode
cargo build --release
cargo run --release
# Build and run with Docker Compose
cd infra
docker compose up payment
Environment Variables
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/payment_rs
# Server
HOST=0.0.0.0
PORT=8001
# OpenTelemetry
OTLP_ENDPOINT=http://otel-collector:4317
# Logging
RUST_LOG=info,payment_rs=debug
# Payment Providers
PAYFAST_MERCHANT_ID=your-merchant-id
PAYFAST_MERCHANT_KEY=your-merchant-key
PAYFAST_PASSPHRASE=your-passphrase
PAYFAST_SANDBOX=true
YOCO_SECRET_KEY=your-yoco-secret-key
YOCO_SANDBOX=true
Service Endpoints
The Payment Service runs on port 8001 by default.
- Health Check:
GET http://localhost:8001/health - GraphQL Endpoint:
POST http://localhost:8001/api/graphql - REST API:
http://localhost:8001/api/v1/ - Metrics:
GET http://localhost:8001/metrics
Next Steps
- Read the API Reference for endpoint details
- Check Configuration for all available options
- See Architecture for system design
- Review Deployment guides for production setup