This is an improved version of the Rexpay payment service with optimizations for higher authorization rates.
-
Enhanced 3DS Handling
- Smart 3DS version detection
- Fallback from 3DS2 to 3DS1 when needed
- Enriched device information for better authentication
-
Robust Error Handling
- Exponential backoff retry mechanism
- Smart retry strategies based on error types
- Detailed error logging and monitoring
-
Data Validation
- Card data validation with Luhn algorithm
- Address validation
- Currency validation and fallback options
-
Intelligent Routing
- Smart subaccount selection based on success rates
- Load balancing with success rate weighting
- Currency and amount-based routing
-
Monitoring and Metrics
- Detailed transaction logging
- Performance metrics tracking
- Success rate monitoring
- Response time tracking
-
Security Enhancements
- Improved card data encryption
- Secure error handling
- PCI-compliant data handling
-
Smart Retry Logic
- Automatically retries failed transactions with different strategies
- Falls back to 3DS1 if 3DS2 fails
- Attempts currency conversion for unsupported currencies
-
Transaction Routing
- Routes transactions to subaccounts with highest success rates
- Considers transaction amount and currency
- Implements load balancing to prevent overloading
-
Data Enrichment
- Provides rich device information
- Includes detailed billing information
- Supports multiple 3DS UI types
-
Error Recovery
- Implements exponential backoff for retries
- Handles network errors gracefully
- Provides detailed error information for debugging
const rexpayService = new RexpayV3Service();
rexpayService.MID = 'your-merchant-id';
rexpayService.APIKEY = 'your-api-key';
// Initialize payment
const result = await rexpayService.initializePayment(payment, AUTHTYPE.THREE);The service includes comprehensive monitoring through the MetricsService:
- Transaction success rates
- Response times
- Error rates
- Authorization rates
- Processing times
The service implements sophisticated error handling:
- Retries for transient errors
- Fallback strategies for permanent errors
- Detailed error logging
- Metric tracking for errors
Configure the service through environment variables:
REXPAY_SECRET_KEY=your-secret-key
REXPAY_ENCRYPTION_KEY=your-encryption-key
REXPAY_ENCRYPTION_IV=your-encryption-iv- Keep retry attempts reasonable (default: 3)
- Monitor metrics for optimization opportunities
- Regularly review and update routing strategies
- Keep device information up to date
- Implement proper error handling in consuming code