#476 — Create facade partner API endpoint to consume the merchant_kpi data for the “commission dashboard”

Repo: Twill-AI/facade State: closed | Status: done Assignee: meliascosta, nadddder

Created: 2025-08-11 · Updated: 2025-11-26

Description

We need to feed commission data to the frontend to be able to generate a commissions report. As a draft for such type of report see:

Image

This provides an aggregate over all merchants that the user has access to. Notice there is a select button at the top right:

Image

which allows to set the period over which the aggregates are calculated. Note that the trend line and the active merchants card should probably not be affected by this.

We also need to support a per-merchant view of commissions inside the (yet to be created) merchants page: Image

Implementation details:

/api/v1/partner/commissions-report should return something like:

{"total_commission": 123.132,
"average_rate": 1.54,
"monthly_commission_trend": [
    {
      "month": "2025-07-01",
      "value": 10
    },
    {
      "month": "2025-08-01",
      "value": 23
    }, 
   ...
  ],
"commission_by_business_type": [{"business_type": "X", "value": 12.0}, ... ]
"top_earning_merchants": [
   {"name": "xyz", "business_type":  "K", "volume": 12425.0, "commission": 1232.50, "rate": 2.22}, 
   ...
  ]
}

`/api/v1/partner/merchan

Notes

Add implementation notes, blockers, and context here

Add wikilinks to related people, meetings, or other tickets