π° POST /deposit
Deposits funds into a userβs account. Requires a valid JWT token and a UUID identifying the account. Updates balances and persists changes securely.
π Summary
- Method:
POST
- URL:
/deposit
- Auth: Required
- Tag:
accounts
π Headers
Authorization: Bearer <your-token>
Content-Type: application/json
π€ Request Parameters
Name | Type | Required | Description |
---|---|---|---|
uuid |
string | β | UUID of the account to deposit into |
amount |
float | β | Amount to deposit |
channel |
string | β | Deposit channel (e.g., M-Pesa, Bank) |
transaction_number |
string | β | Optional reference number |
by |
string | β | Who performed the deposit (default = User) |
date |
string | β | Deposit timestamp (default = now) |
π₯ Example Request Body (JSON)
{
"uuid": "acc-2023-savings-abc123",
"amount": 1500,
"channel": "mpesa",
"transaction_number": "MPESA123456",
"by": "User"
}
π€ Success Response
{
"success": true,
"status": 200,
"account_uuid": "acc-2023-savings-abc123",
"amount": 1500,
"balance": 3300,
"start_time": "2025-07-10T08:50:15.123Z",
"end_time": "2025-07-10T08:50:15.200Z",
"execution_time": 0.077
}
β Failure Response Examples
Status | Reason |
---|---|
403 |
Unauthorized for this account |
404 |
Account not found |
500 |
Internal server error |
π§ Notes
- Uses a lock mechanism to ensure safe concurrent writes.
- Returns structured timing for performance tracking.
- Must be called after auth (JWT must be valid).
π Sponsors
Support my work through GitHub Sponsors!