Skip to main content

Driver Finance

1 API call in this section.

Driver finance management endpoints

manual wallet transactions (credit/debit), accounting summaries, and wallet transaction history.

Create Manual Driver Transaction​

Delivery & Last-Mile / Driver Finance
POST/delivery/drivers/:driverId/manual-transaction

Create a manual credit or debit transaction on a driver's wallet.

Permissions Required

manage:wallets OR manage:operations:tenant OR is_system_admin

FieldTypeRequiredDescription
amountnumberYesTransaction amount (must be > 0)
typestringYescredit or debit
reasonstringYesReason for the transaction (max 500 chars)
referencestringNoExternal reference (max 200 chars)
notesstringNoAdditional notes (max 500 chars)

Business Logic

  • Credit: Adds funds to driver wallet (e.g., bonuses, corrections)

  • Debit: Removes funds from driver wallet (e.g., penalties, adjustments)

  • For debit: fails if insufficient wallet balance

  • Transaction metadata records actor ID, the authenticated actor-name snapshot, reason, and reference for the audit trail. The driver wallet history exposes the saved name through recorded_by.name; older records without a name snapshot resolve the current name using their saved actor ID.

Path parameters

ParameterTypeDescription
driverIdRequiredstring

The driver's ID

Query parameters

ParameterTypeDescription
tenant_idOptionalstring

Tenant ID (optional if in auth token)

languagestring

Preferred language for response messages

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Content-Typestring

Example: application/json

Body parameters

ParameterTypeDescription
amountnumber—
typestring—
reasonstring—
referencestring—
notesstring—
Staging
Request
curl
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/delivery/drivers/${DRIVERID}/manual-transaction?tenant_id=&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3  --header "Content-Type: application/json" \4  --data-raw '{5  "amount": 50,6  "type": "credit",7  "reason": "Bonus for excellent performance",8  "reference": "BON-2024-001",9  "notes": "Q1 performance bonus"10}'

Response examples

201Created
Response body
json
1{2  "success": true,3  "message": "Credit was added to the driver wallet successfully",4  "transaction": {5    "id": "txn-uuid",6    "wallet_id": "wallet-uuid",7    "amount": 50,8    "type": "credit",9    "description": "Bonus for excellent performance",10    "reference_type": "manual_credit",11    "previous_balance": 200,12    "new_balance": 250,13    "created_at": "2024-01-15T10:00:00Z"14  }15}