#471 — Create approximation function for current month commissions

Repo: Twill-AI/facade State: open | Status: open Assignee: Ahmad1809

Created: 2025-08-08 · Updated: 2026-03-20

Description

See wiki for reference https://twillpayments.atlassian.net/wiki/spaces/TD/pages/407699457/Current+and+historical+commission+calculations

The estimate is calculated depending on the pricing model for each merchant.

Inputs to the function

  • current_month_volume (float): this month total sales volume
  • fee_config (dict): the fee config row for that merchant
  • credit_card_transaction_mix (dict): The mixture of card_present / card_not_present transactions (see screenshot)
  • partner_rep_split (float - min 0, max 1): The fraction of the commission that should be assigned to the rep

Credit card transaction mix (screenshot)

Image

AC:

  • There is a python function that takes in the required variables and can estimate commissions for:
    • Flat rate
    • Surcharge
    • Interchange +
    • Tiered
  • Tests have been written for that function for each of the above mentioned fee schedules
  • For the few merchants for which we have some months of data (in prod) the squared mean error between the estimate and the actual commissions has been calculated and this info is added to the Commissions wiki page

Notes

Add implementation notes, blockers, and context here

Add wikilinks to related people, meetings, or other tickets