PayFanout API reference
    Preparing search index...

    Function allocate

    • Splits an integer minor-unit amount across weights with no lost or invented cents: results sum exactly to amount, remainders distribute by the largest-remainder method (ties to the earliest position). The safe way to compute fee shares and tax splits — never float math on money.

      allocate(1000, [1, 1, 1]) -> [334, 333, 333]

      Parameters

      • amount: number
      • weights: number[]

      Returns number[]