Skip to main content

Agent Commission Summary API

Overview

Retrieve agent commission summary grouped by day, week, or month for a specific agent user within a given date range. This API provides aggregated commission data from UTC transactions (commission transactions) where the agent receives commissions, helping track commission earnings over time for analytics and reporting purposes.

API Details

Endpoint

POST https://api.gafapay.com:8443/gafapay/v3/analytics/agent_commission_summary

Request Body

{
"user_id": "fcad75ed28d345f896420d4015b58446",
"currency_id": "b57f40b4162e43f1a9512189b8325b42",
"group_by": "DAY",
"start_date": 1763404200,
"end_date": 1765996199
}

Request Parameters

ParameterTypeRequiredDescription
user_idStringYesAgent user ID for which commission summary is needed
currency_idStringYesCurrency ID to filter commission transactions
group_byStringYesGrouping period: "DAY", "WEEK", or "MONTH"
start_dateLongYesStart date in epoch seconds
end_dateLongYesEnd date in epoch seconds

Headers

companyid: 59388167894b4d10a04fe5da3b8a2104
requestid: b35d332f-131e-44c1-892f-8322e022da74
authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJlNDk0Njg3N2YxODk0NmIyOTlmZGRmMGYyMTMzZGNiYSIsInJvbGVzIjpbIlJPTEVfQURNSU4iXSwiZXhwIjoxNzU4MzU2MjM4fQ.u8gjlrl72lsif6oWqQV8mlGUaziy0TlvNPzmPZrEzcQ
Content-Type: application/json

Response

Success Response (DAY grouping)

{
"success": 1,
"error": [],
"data": {
"groupBy": "DAY",
"totalCommission": 11.0,
"data": [
{
"label": "14 Dec 2025",
"startDate": 1702406400,
"endDate": 1702492799,
"commissionAmount": 1.0
},
{
"label": "15 Dec 2025",
"startDate": 1702492800,
"endDate": 1702579199,
"commissionAmount": 10.0
}
]
}
}

Success Response (WEEK grouping)

{
"success": 1,
"error": [],
"data": {
"groupBy": "WEEK",
"totalCommission": 11.0,
"data": [
{
"label": "14 Dec 2025",
"startDate": 1702406400,
"endDate": 1703011199,
"commissionAmount": 11.0
}
]
}
}

Success Response (MONTH grouping)

{
"success": 1,
"error": [],
"data": {
"groupBy": "MONTH",
"totalCommission": 11.0,
"data": [
{
"label": "Dec 2025",
"startDate": 1701388800,
"endDate": 1704067199,
"commissionAmount": 11.0
}
]
}
}

Error Response

{
"success": 0,
"error": ["NO_AGENT_COMMISSION_SUMMARY_FOUND"],
"data": null
}

Response Fields

  • success (integer): Response status indicator
    • 1 = Success
    • 0 = Failure
  • error (array): Array of error messages (empty on success)
    • NO_AGENT_COMMISSION_SUMMARY_FOUND = No commission transactions found for the given criteria
    • BAD_REQUEST = Invalid request parameters
    • ERROR_FETCHING_AGENT_COMMISSION_SUMMARY = Server error occurred
  • data (object): Response data object (null on error)
    • groupBy (string): The grouping period used ("DAY", "WEEK", or "MONTH")
    • totalCommission (double): Total commission amount across all periods
    • data (array): Array of commission data items

Commission Data Item Fields

Each object in the data array contains:

FieldTypeDescription
labelStringFormatted date label for display (e.g., "14 Dec 2025", "Dec 2025")
startDateLongStart date of the period in epoch seconds
endDateLongEnd date of the period in epoch seconds
commissionAmountDoubleTotal commission amount for this period

Grouping Behavior

DAY Grouping

  • Groups commissions by individual days
  • Label format: "d MMM yyyy" (e.g., "14 Dec 2025")
  • Period: Start of day (00:00:00) to end of day (23:59:59)

WEEK Grouping

  • Groups commissions by weeks (7-day periods starting from Monday)
  • Label format: "d MMM yyyy" (e.g., "14 Dec 2025" - represents the start of the week)
  • Period: Monday 00:00:00 to Sunday 23:59:59

MONTH Grouping

  • Groups commissions by calendar months
  • Label format: "MMM yyyy" (e.g., "Dec 2025")
  • Period: First day of month 00:00:00 to last day of month 23:59:59

Example Usage

Basic Request (DAY grouping)

curl --location 'https://api.gafapay.com:8443/gafapay/v3/analytics/agent_commission_summary' \
--header 'authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJlNDk0Njg3N2YxODk0NmIyOTlmZGRmMGYyMTMzZGNiYSIsInJvbGVzIjpbIlJPTEVfQURNSU4iXSwiZXhwIjoxNzU4MzU2MjM4fQ.u8gjlrl72lsif6oWqQV8mlGUaziy0TlvNPzmPZrEzcQ' \
--header 'companyid: 59388167894b4d10a04fe5da3b8a2104' \
--header 'requestid: b35d332f-131e-44c1-892f-8322e022da74' \
--header 'Content-Type: application/json' \
--data '{
"user_id": "fcad75ed28d345f896420d4015b58446",
"currency_id": "b57f40b4162e43f1a9512189b8325b42",
"group_by": "DAY",
"start_date": 1763404200,
"end_date": 1765996199
}'

Request with WEEK grouping

curl --location 'https://api.gafapay.com:8443/gafapay/v3/analytics/agent_commission_summary' \
--header 'authorization: Token YOUR_TOKEN_HERE' \
--header 'companyid: 59388167894b4d10a04fe5da3b8a2104' \
--header 'requestid: YOUR_REQUEST_ID' \
--header 'Content-Type: application/json' \
--data '{
"user_id": "fcad75ed28d345f896420d4015b58446",
"currency_id": "b57f40b4162e43f1a9512189b8325b42",
"group_by": "WEEK",
"start_date": 1763404200,
"end_date": 1765996199
}'

Request with MONTH grouping

curl --location 'https://api.gafapay.com:8443/gafapay/v3/analytics/agent_commission_summary' \
--header 'authorization: Token YOUR_TOKEN_HERE' \
--header 'companyid: 59388167894b4d10a04fe5da3b8a2104' \
--header 'requestid: YOUR_REQUEST_ID' \
--header 'Content-Type: application/json' \
--data '{
"user_id": "fcad75ed28d345f896420d4015b58446",
"currency_id": "b57f40b4162e43f1a9512189b8325b42",
"group_by": "MONTH",
"start_date": 1763404200,
"end_date": 1765996199
}'

Notes

  • This API retrieves commission data from UTC transactions where the agent (specified by user_id) is the credit account (receiving the commission)
  • UTC transactions represent commission payments, where credit_amount is the commission amount and credit_account_type_id is the agent receiving the commission
  • The API filters transactions with txn_code = "UTC" and user_type = 5 (agent)
  • Date parameters use Unix timestamps (epoch seconds)
  • The currency_id parameter filters commissions by currency
  • The group_by parameter must be exactly "DAY", "WEEK", or "MONTH" (case-insensitive)
  • Results are sorted chronologically by period start date
  • Only periods with commission transactions are included in the response
  • The totalCommission field represents the sum of all commission amounts across all periods in the response
  • Labels are formatted in UTC timezone