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_TABLEstrategy. 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
| Parameter | Type | Description | Example value |
|---|---|---|---|
strategy | String | Must be set to "PRICE_TABLE" | "PRICE_TABLE" |
interestRate | Object | Interest rate configuration (fixed or rule-based) | Refer to the Interest rate configuration section |
fixedIofRate | Number | Fixed IOF rate (%)—Brazilian tax applied once on first installment | 0.38 |
dailyIofRate | Number | Daily IOF rate (%)—Brazilian tax applied per day (max 365 days) | 0.0082 |
fixed | Number | Fixed amount to be charged | 10.00 |
percentage | Number | Percentage fee to be applied to the principal amount | 2.5 |
index | String | Calculation index (typically "INSTALLMENT" | "INSTALLMENT" |
daysRange | Number | Days 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.valueis0ornull, the strategy uses interest-free calculation. - IOF rates are specific to Brazilian operations (for other countries, set to
0). precedencedetermines the order of fee application when multiple fees exist.applyIntospecifies whether the fee applies toPRINCIPAL_AMOUNTorCONTRACT_AMOUNT.
Configuration to postings mapping
This table shows how DynamoDB configuration parameters map to the output postings generated by the PRICE_TABLE strategy.
Configuration | Output | Relationship |
|---|---|---|
|
| The configured interest rate (fixed or rule-based) determines the interest charged per installment using a compound interest formula. |
|
| This is applied once to the first installment only. For example: 0.38% = R3.80 on R1,000 principal |
|
| This is applied daily per accumulated days, calculated per installment. For example: 0.0082% × 30 days = R2.46 on R1,000 |
|
| This is the sum of |
|
| This is the GREATER of fixed amount vs percentage of principal. For example: max(R10.00, 2.51, 000) = R$25.00 |
(calculated) |
| 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
| Output | Formula |
|---|---|
feeAmount | max(fixed, principal × percentage / 100) |
iof_amount (1st installment) | fixed_iof_amount + daily_iof_amount |
iof_amount (other installments) | daily_iof_amount only |
| fixed_iof_amount | newPrincipal × fixedIofRate / 100 |
| daily_iof_amount | amortization × dailyIofRate / 100 × accumulatedDays |
| interest_amount | remainingPrincipal × ((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 installmentaccumulatedDays—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 raten= 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 key | Description | Calculation |
|---|---|---|
amortization | Portion of payment reducing the principal | PMT - interest (adjusted for IOF) |
interest_amount | Interest charged on this installment | Remaining principal × compound interest formula |
iof_amount | Total IOF for this installment | daily_iof_amount + fixed_iof_amount (first installment only) |
daily_iof_amount | Daily IOF component | amortization × (dailyIof/100) × accumulatedDays |
fixed_iof_amount | Fixed 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.
| Process | Amount type | Processing code |
|---|---|---|
| INTERNATIONAL IOF | iofAmount | 003100 |
| INTERNATIONAL IOF CANC | iofAmount | 003101 |
| WITHDRAWAL FEE | feeAmount | 01 |
| WITHDRAWAL CHARGES | interestAmount | 01 |
| WITHDRAWAL TAXES | iofAmount | 01 |
| WITHDRAWAL TAXES REVERSAL | iofAmount | 0101 |
| WITHDRAWAL FEE REVERSAL | feeAmount | 0101 |
| WITHDRAWAL CHARGES REVERSAL | interestAmount | 0101 |
| WITHDRAWAL FEE | feeAmount | 013100 |
| INTERNATIONAL IOF | iofAmount | 013100 |
| INTER WITHDRAWAL FEE REV | feeAmount | 013101 |
| INTERNATIONAL IOF CANC | iofAmount | 013101 |
| WITHDRAWAL TAXES | iofAmount | 013200 |
| WITHDRAWAL CHARGES | interestAmount | 013200 |
| WITHDRAWAL TAXES REVERSAL | iofAmount | 013201 |
| WITHDRAWAL CHARGES REVERSAL | interestAmount | 013201 |
| WITHDRAWAL FEE REVERSAL | feeAmount | 013201 |
| INSTALLMENT WITHDRAWAL FEE | feeAmount | PSM018 |
| INSTALLMENT WITHDRAWAL CHARGES | interestAmount | PSM018 |
| INSTALLMENT WITHDRAWAL TAXES | iofAmount | PSM018 |
| REV INSTALLMENT WDWL TAXES | iofAmount | PSM019 |
| REV INSTALLMENT WDWL FEE | feeAmount | PSM019 |
| REV INSTALLMENT WDWL CHARGES | interestAmount | PSM019 |
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/installmentsNumberinterest_amount:0iof_amount:0daily_iof_amount:0fixed_iof_amount:0
Updated about 4 hours ago