Subscription API Documentation
Overview
The Subscription API provides endpoints for managing recurring payments and subscriptions between accounts in the wallet service.Base URL
/api/v1/subscriptions
Authentication
All endpoints require authentication using an API key in the request headers:X-API-KEY: Your API key
Endpoints
Create Subscription
Create a new subscription for recurring payments. Endpoint:POST /register
Headers:
X-API-KEY(optional): API key for authentication
Update Subscription
Update an existing subscription. Endpoint:POST /update/{reference}
Headers:
X-API-KEY(optional): API key for authentication
reference: Subscription reference ID
Get Subscriptions
Retrieve subscriptions with filtering and pagination. Endpoint:GET /
Headers:
X-API-KEY(optional): API key for authentication
debitAccountId: Filter by debit account IDcreditAccountId: Filter by credit account IDstatus: Filter by subscription statusfrequency: Filter by frequencytenantId: Filter by tenant IDstartDateFrom: Filter by start date fromstartDateTo: Filter by start date toendDateFrom: Filter by end date fromendDateTo: Filter by end date tocurrency: Filter by currencypage: Page number (default: 0)size: Page size (default: 20)sort: Sort field and direction (e.g., “createdAt,desc”)
Get Subscription Transactions
Retrieve transactions associated with a subscription. Endpoint:GET /transactions
Headers:
X-API-KEY(optional): API key for authentication
status: Filter by transaction statussubscriptionReference: Filter by subscription referencetenantId: Filter by tenant IDtype: Filter by transaction typestartDateFrom: Filter by start date fromstartDateTo: Filter by start date toendDateFrom: Filter by end date fromendDateTo: Filter by end date tocurrency: Filter by currencypage: Page number (default: 0)size: Page size (default: 20)sort: Sort field and direction (e.g., “createdAt,desc”)
Error Responses
All endpoints may return the following error responses: 401 UnauthorizedNotes
- All timestamps are in ISO-8601 format
- Minimum subscription amount is 100 units of the specified currency
- Subscription frequencies:
- DAILY: Daily recurring payment
- WEEKLY: Weekly recurring payment
- BI_WEEKLY: Bi-weekly recurring payment
- MONTHLY: Monthly recurring payment
- YEARLY: Yearly recurring payment
- Subscription statuses:
- ACTIVE: Currently running
- PAUSED: Temporarily halted
- COMPLETED: Finished after reaching end time
- CANCELLED: Manually cancelled
- FAILED: Last execution failed
- EXPIRED: Reached end time
- Platform admins can create subscriptions for any tenant
- Tenant admins can create subscriptions for their tenant
- Regular users can only create subscriptions for themselves
- Subscriptions are processed automatically based on their frequency
- Failed subscriptions can be retried manually
- Webhook notifications are sent for subscription events
- Subscription history is maintained for audit purposes
- Account currency must match the subscription currency
- Subscriptions are unique per debit account, credit account, amount, currency, and frequency