Price Table strategy calculation

The PRICE_TABLE strategy is a fee calculation method that generates installment plans with compound interest, fees, and Imposto sobre Operações Financeiras (IOF - Brazilian tax) calculations. This strategy automatically generates default transaction postings that are used by the transactions domain to create financial transactions. In this way, the PRICE_TABLE strategy removes the need to manually generate the transaction flow to see the transactions generated by the configured fees.

📘

The transaction mappings documented here represent the default behavior when using the PRICE_TABLE strategy. Any transaction flow different from these defaults must be created manually.

There are a few things you must be aware of when considering the use of the PRICE_TABLE strategy.

  • IOF (Imposto sobre Operações Financeiras) is a Brazilian tax specific to financial operations.
  • Maximum daily IOF calculation period is 365 days.
  • All monetary values are rounded to 2 decimal places (HALF_EVEN).
  • The strategy handles edge cases like negative interest on last installment through redistribution.
  • Installment numbering starts at 1, not 0.

Client configuration

Clients (issuers/banks) configure the PRICE_TABLE strategy through DynamoDB fee models. This configuration determines how rates, taxes, and fees are calculated for transactions.

Configuration parameters

ParameterTypeDescriptionExample value
strategyStringMust be set to "PRICE_TABLE""PRICE_TABLE"
interestRateObjectInterest rate configuration (fixed or rule-based)Refer to the Interest rate configuration section
fixedIofRateNumberFixed IOF rate (%)—Brazilian tax applied once on first installment0.38
dailyIofRateNumberDaily IOF rate (%)—Brazilian tax applied per day (max 365 days)0.0082
fixedNumberFixed amount to be charged10.00
percentageNumberPercentage fee to be applied to the principal amount2.5
indexStringCalculation index (typically "INSTALLMENT""INSTALLMENT"
daysRangeNumberDays range for compound interest calculation (typically 30)30

Interest rate configuration

The interestRate object supports fixed interest rates and rule-based interest rates.

Fixed interest rate:

{
  "type": "FIXED",
  "value": 12.0,
  "precedence": 0,
  "rules": null
}

Rule-based interest rate:

{
  "type": "RULE_BASED",
  "precedence": 0,
  "rules": [
    {
      "installments": { "from": 1, "to": 6 },
      "value": 10.0
    },
    {
      "installments": { "from": 7, "to": 12 },
      "value": 15.0
    }
  ]
}

Processing codes

The applyWhen.processingCodes array determines which transaction types trigger the PRICE_TABLE calculation. Common codes include:

  • "01"—Domestic withdrawal
  • "013100"—International withdrawal
  • "00"—Purchase
  • "003100"—International purchase

Configuration notes

  • If interestRate.value is 0 or null, the strategy uses interest-free calculation.
  • IOF rates are specific to Brazilian operations (for other countries, set to 0).
  • precedence determines the order of fee application when multiple fees exist.
  • applyInto specifies whether the fee applies to PRINCIPAL_AMOUNT or CONTRACT_AMOUNT.

Configuration to postings mapping

This table shows how DynamoDB configuration parameters map to the output postings generated by the PRICE_TABLE strategy.

Configuration
parameter

Output
posting

Relationship

interestRate

interest_amount

The configured interest rate (fixed or rule-based) determines the interest charged per installment using a compound interest formula.

fixedIofRate

fixed_iof_amount

This is applied once to the first installment only.

For example: 0.38% = R3.80 on R1,000 principal

dailyIofRate

daily_iof_amount

This is applied daily per accumulated days, calculated per installment.

For example: 0.0082% × 30 days = R2.46 on R1,000

fixedIofRate + dailyIofRate

iof_amount

This is the sum of fixed_iof_amount + daily_iof_amount (first installment includes both, subsequent installments include only daily).

fixed + percentage

feeAmount
(calculated fees)

This is the GREATER of fixed amount vs percentage of principal.

For example: max(R10.00, 2.51, 000) = R$25.00

(calculated)

amortization

This is the principal portion of each payment (PMT - interest), adjusted for IOF inclusion.

Example mapping

Configuration:

{
  "interestRate": { "value": 12.0 },
  "fixedIofRate": 0.38,
  "dailyIofRate": 0.0082,
  "fixed": 10.0,
  "percentage": 2.5
}

Transaction: R$1,000.00 principal, 3 installments

Output postings (Installment 1):

{
  "amortization": 328.50,
  "interest_amount": 10.00,
  "iof_amount": 6.26,
  "daily_iof_amount": 2.46,
  "fixed_iof_amount": 3.80
}

Calculated fees (overall transaction):

{
  "feeAmount": 25.00,
  "interestAmount": 30.00,
  "iofAmount": 14.72
}

Key formulas

OutputFormula
feeAmountmax(fixed, principal × percentage / 100)
iof_amount (1st installment)fixed_iof_amount + daily_iof_amount
iof_amount (other installments)daily_iof_amount only
fixed_iof_amountnewPrincipal × fixedIofRate / 100
daily_iof_amountamortization × dailyIofRate / 100 × accumulatedDays
interest_amountremainingPrincipal × ((1 + interestRate/100)^(days/30) - 1)

Calculation process

The PRICE_TABLE strategy follows these steps to calculate installments.

1—Days interval calculation

  • Calculates the number of days between each installment due date.
  • Accumulates days for IOF calculation, capped at 365 days maximum.
  • Each installment tracks:
    • days—Days from previous installment
    • accumulatedDays—Cumulative days (max 365)

2—PMT (payment) calculation

  • Uses compound interest formula to calculate fixed payment amount.
  • Formula: PMT = principal × [r(1+r)^n] / [(1+r)^n - 1]
  • Where:
    • r = monthly interest rate
    • n = number of installments
    • Adjusted for effective interval based on month length

3—Interest and amortization calculation

  • For each installment:
    • Interest = remaining principal × ((1 + rate/100)^(days/30) - 1)
    • Amortization = PMT - interest
    • Remaining principal = previous remaining principal - amortization
  • First installment uses actual days to first due date.
  • Subsequent installments use effective month length (28-31 days).

4—IOF adjustment (principal recalculation)

  • Recalculates principal to include IOF in amortization.
  • Fixed IOF—Applied once (typically 0.38%).
  • Daily IOF—Applied per accumulated day (typically 0.0082% per day, max 365 days).
  • New principal accounts for both fixed and daily IOF.

5—IOF amount calculation

  • **Daily IOF per installment **= amortization × (dailyIof/100) × accumulatedDays
  • Fixed IOF = newPrincipal × (fixedIof/100) - added only to first installment

6—Negative interest redistribution

  • If last installment has negative interest (due to rounding), redistributes it to previous installments.
  • Redistribution ensures all interest amounts are non-negative.

7—Fee calculation

  • Fixed Fee—Applied as defined.
  • Percentage Fee—Applied as percentage of amount.
  • Uses GREATER strategy (max of fixed or percentage).

Output - postings generated

The PRICE_TABLE strategy generates a postings map for each installment with the following fields:

Posting keyDescriptionCalculation
amortizationPortion of payment reducing the principalPMT - interest (adjusted for IOF)
interest_amountInterest charged on this installmentRemaining principal × compound interest formula
iof_amountTotal IOF for this installmentdaily_iof_amount + fixed_iof_amount (first installment only)
daily_iof_amountDaily IOF componentamortization × (dailyIof/100) × accumulatedDays
fixed_iof_amountFixed IOF component (first installment only)newPrincipal × (fixedIof/100)

Example posting output

postings: [
    amortization: 95.45,
    interest_amount: 4.55,
    iof_amount: 0.87,        // 0.38 (fixed) + 0.49 (daily) for installment 1
    daily_iof_amount: 0.49,
    fixed_iof_amount: 0.38
]

Note: The transactions domain consumes these postings keys (in snake_case) and converts them to camelCase for transaction generation.

Default transaction mappings

The following table shows the default transaction types generated by the transactions domain when processing PRICE_TABLE postings. These mappings are automatically applied based on processing codes and posting keys.

📘

Any transaction flow different from this table must be created manually by the client.

ProcessAmount typeProcessing code
INTERNATIONAL IOFiofAmount003100
INTERNATIONAL IOF CANCiofAmount003101
WITHDRAWAL FEEfeeAmount01
WITHDRAWAL CHARGESinterestAmount01
WITHDRAWAL TAXESiofAmount01
WITHDRAWAL TAXES REVERSALiofAmount0101
WITHDRAWAL FEE REVERSALfeeAmount0101
WITHDRAWAL CHARGES REVERSALinterestAmount0101
WITHDRAWAL FEEfeeAmount013100
INTERNATIONAL IOFiofAmount013100
INTER WITHDRAWAL FEE REVfeeAmount013101
INTERNATIONAL IOF CANCiofAmount013101
WITHDRAWAL TAXESiofAmount013200
WITHDRAWAL CHARGESinterestAmount013200
WITHDRAWAL TAXES REVERSALiofAmount013201
WITHDRAWAL CHARGES REVERSALinterestAmount013201
WITHDRAWAL FEE REVERSALfeeAmount013201
INSTALLMENT WITHDRAWAL FEEfeeAmountPSM018
INSTALLMENT WITHDRAWAL CHARGESinterestAmountPSM018
INSTALLMENT WITHDRAWAL TAXESiofAmountPSM018
REV INSTALLMENT WDWL TAXESiofAmountPSM019
REV INSTALLMENT WDWL FEEfeeAmountPSM019
REV INSTALLMENT WDWL CHARGESinterestAmountPSM019

Interest-free scenario

When interestRate is 0 or null, the strategy uses the InterestFreeCalculator and the following conditions apply:

  • Divides the amount equally across all installments
  • No interest calculation
  • No IOF recalculation (fixed and daily IOF remain 0)
  • Only fees are applied (fixed/percentage)
  • Postings will have:
    • amortization: amount / installmentsNumber
    • interest_amount: 0
    • iof_amount: 0
    • daily_iof_amount: 0
    • fixed_iof_amount: 0


Did this page help you?