Charge API Documentation
Overview
The Charge API provides endpoints for managing transaction charges and fees in the wallet service. It supports configuring charges for different payment methods, transaction types, and currencies.Base URL
/api/v1/charges
Authentication
All endpoints require authentication using an API key in the request headers:X-API-KEY: Your API keyX-Tenant-ID: Tenant identifier (required for platform admins)
Endpoints
Create Charge
Create a new charge configuration. Endpoint:POST /create
Headers:
X-API-KEY: API key for authenticationX-Tenant-ID: Tenant identifier (required for platform admins)
Update Charge
Update an existing charge configuration. Endpoint:PUT /update/{Id}
Headers:
X-API-KEY: API key for authenticationX-Tenant-ID: Tenant identifier (required for platform admins)
Id: The ID of the charge configuration to update
View Charges
Retrieve charge configurations with filtering and pagination. Endpoint:GET /get
Headers:
X-API-KEY: API key for authenticationX-Tenant-ID: Tenant identifier (required for platform admins)
paymentMethod: Filter by payment methodtransactionType: Filter by transaction typetenantCharge: Filter by tenant charge formulaplatformCharge: Filter by platform charge formulatenantId: Filter by tenant IDpage: Page number (default: 0)size: Page size (default: 20)sort: Sort field and direction (e.g., “createdAt,desc”)
Error Responses
401 UnauthorizedNotes
- Charge Configuration:
- Supports multiple payment methods
- Supports different transaction types
- Supports various currencies
- Supports card type-specific charges
- Charge Formulas:
- Percentage-based charges (e.g., “1.5”)
- Flat charges (e.g., “FLAT=100”)
- Capped charges (e.g., “1.5|CAP=1000”)
- Minimum charges (e.g., “1.5|FLOOR=50”)
- Combined formulas (e.g., “1.5|CAP=1000|FLOOR=50”)
- Charge Processing:
- Tenant charges are processed first
- Platform charges are processed after tenant charges
- Charges are processed asynchronously
- Failed charges are retried
- Charge Validation:
- Duplicate charges are prevented
- Charge formulas are validated
- Currency compatibility is checked
- Payment method support is verified
- Charge Permissions:
- Tenant admins can manage their charges
- Platform admins can manage all charges
- Regular users cannot manage charges
- Charge Tracking:
- All charges are logged
- Charge history is maintained
- Charge status is tracked
- Failed charges are monitored
- Charge Notifications:
- Charge transactions are notified
- Failed charges are reported
- Charge updates are logged
- Charge Settlement:
- Charges are settled immediately
- Settlement status is tracked
- Failed settlements are handled
- Settlement notifications are sent