Payment Gateway Service
Manages integration with external payment processors (Stripe, PayPal, etc.)
Overview
The Payment Gateway Service acts as an abstraction layer between our payment system and external payment processors. It is part of the Payment Payment Domain v0.0.1 Domain that contains payment related services and messages for processing financial transactions. Owner dboyne Map View docs domain and works alongside the Payment Service Payment Service Service v0.0.1 Service that handles payments Publishes PaymentProcessed Subscribes PaymentInitiated Owner dboyne Map Repo View docs and Fraud Detection Service Fraud Detection Service Service v0.0.1 Analyzes payment transactions for fraudulent activity and risk assessment Publishes FraudCheckCompleted , FraudDetected +1 Subscribes PaymentInitiated Owner dboyne Map Repo View docs .
The service receives Process Payment Process Payment Command v0.0.1 Command to process a payment through the payment gateway Schema Map View docs and Fraud Check Completed Fraud Check Completed Event v0.0.1 Emitted when a fraud check has been completed for a transaction Schema Map View docs events, and publishes Payment Failed Payment Failed Event v0.0.1 Emitted when a payment attempt fails Schema Map View docs when transactions fail. It handles the complexity of integrating with multiple payment providers and provides a unified interface for payment operations.
Supported Payment Providers
- Stripe: Credit/debit cards, digital wallets
- PayPal: PayPal accounts, PayPal Credit
- Square: In-person and online payments
- Adyen: Global payment processing
- Braintree: Multiple payment methods
Key Features
- Multi-provider Support: Switch between providers seamlessly
- Retry Logic: Automatic retry for failed transactions
- Tokenization: Secure card data handling
- Webhook Management: Handles provider webhooks
- Currency Conversion: Support for 150+ currencies
API Endpoints
REST API
POST /api/gateway/authorize- Authorize a paymentPOST /api/gateway/capture- Capture an authorized paymentPOST /api/gateway/refund- Process a refundGET /api/gateway/status/{transactionId}- Get transaction status
Configuration
payment_gateway: providers: stripe: api_key: ${STRIPE_API_KEY} webhook_secret: ${STRIPE_WEBHOOK_SECRET} paypal: client_id: ${PAYPAL_CLIENT_ID} client_secret: ${PAYPAL_CLIENT_SECRET} retry: max_attempts: 3 backoff_ms: 1000