Accounting scripts examples

This guide currently provides one detailed example how the Pismo platform handles accounting in the case of refinancing. The guide will be enhanced to include other use case examples.

Refinancing example

Refinancing is the process of creating a new credit contract agreement for an existing credit card debt. The new agreement has new terms, such as the interest rate and applicable taxes. Refinancing on the Pismo platform utilizes the installment agreement functionality.

In this example, assume the card holder has R$3526.64 in debt and receives a credit from the issuer to settle the debt under a refinancing agreement. The card holder has agreed to repay the debt in three installments on specified dates in July, August, and September.

The total amount of the refinancing contract (principal + interest + tax) is R$4591.68 and is to be paid over three installments. The total IOF (financial tax in Brazil) is R$32.31, also split over three installments.

Amount (R$)Principal (R$)Interest (R$)IOF (R$)
Installment 11530.561025.87497.557.14
Installment 21530.561166.93353.1310.50
Installment 31530.561333.84182.0514.67
Contract totals4591.683526.641032.7332.31

Transactions and accounting events

In this refinancing example, the platform generates transactions and the corresponding transaction events and accounting events on the following dates.

DatePlatform action
1 JulyPlatform creates refinancing contract
20 JulyCycle close for the 1st refinancing installment
30 JulyDue date of the 1st refinancing installment
20 AugustCycle close of the 2nd refinancing installment
30 AugustDue date of the 2nd refinancing installment
20 SeptemberCycle close for the 3rd refinancing installment
30 SeptemberDue date of the 3rd refinancing installment

The Pismo platform creates transactions and accounting events as follows (details provided in the sections below).

Refinancing credit and refinancing contract

At the time of the new refinancing contract, the Pismo platform creates two transactions: refinancing credit transaction (701) and refinancing contract transaction (703).

Transaction typeTransaction type descriptionTransaction description
701Refinancing creditRefinancing credit transaction represents the credit that the cardholder receives to cover their past debt and to pay it to the issuer bank in installments. This transaction amount includes the principal amount only, as specified in the Create payment agreement endpoint.
703Refinancing contractRefinancing contract transaction is not available on the cardholder's statement as it is created for accounting purposes only. This transaction amount includes the principal amount (the same amount as in the refinancing credit 701 transaction) + interest + any taxes (in Brazil, this is usually the total IOF). The platform places total interest in the Interest amount field on the transaction.

At the same time, if the accounting scripts are configured, the Pismo platform creates corresponding accounting events for the refinancing credit and for the refinancing contract.

Accounting event typeEntry typeAccounting event type description
701701Refinancing credit
7032121Refinancing contract
7032122Refinancing contract interest
7032123Refinancing contract IOF (if the IOF is not 0)

First installment

When the platform creates transactions and accounting events for the refinancing credit and the refinancing contract, it also creates the following transactions for the first installment.

Transaction type

Transaction type description

Transaction description

702

Refinancing installment

This transaction amount is [(principal + interest + total IOF) / number of installments]. The platform places interest for this installment in the Interest amount field on the transaction.

417

Installment IOF

If split_iof is false (which is the default), this transaction amount is the total IOF.
If split_iof is true, this transaction amount is (total IOF / number of installments)

At the same time, the platform generates the following accounting events for the first installment.

Accounting event typeEntry typeAccounting event type description
702702Refinancing installment
7022125Refinancing installment interest

Subsequent installments

For each subsequent installment, the platform creates refinancing installment transactions (702 and 417), places them in the appropriate statements, and generates corresponding accounting events (702).

The platform creates as many refinancing installment transactions (702) as the number of installments specified in the Create payment agreement endpoint. It also generates separate transactions for each installment IOF transaction (417).

  • If split_iof is false, the platform creates one installment IOF transaction (417) with the full IOF tax amount.
  • If split_iof is true, the platform splits the IOF tax into installments and creates as many installment IOF transactions (417) as the number of installments.

For the second and remaining installments, the platform generates installments accounting events (702 and 2125) at the closing of the previous cycle.

  • For the second installment, the platform generates events at the closing of the first installment's cycle.
  • For the third installment, the platform generates events at the closing of the second installment's cycle.

Due date of each installment

On the due date of each installment's statement, the platform creates the following accounting events (2126 and 2127).

Accounting event typeEntry typeAccounting event type description
7022126Refinancing installment due date
7022127Refinancing installment interest due date

Daily interest accounting events

The platform creates daily interest accounting events (2080) based on the platform amortization price model, starting on the following day of the refinancing contract creation and until the last installment's due date.

Accounting event typeEntry typeAccounting event type description
7022080Refinancing daily interest

The total amount of the refinancing interest in this example is $R1032.73. The platform calculates the daily refinancing interest and starts sending daily events the next day after creating the contract (in this case, on 2 July). The refinancing daily interest events end on the due date of the last installment (in this case, on 30 September).

Transactions and accounting events details

The following table provides an overview of the transactions and related accounting events that the platform creates over the term of this example refinancing agreement, with the corresponding dates.


The following table provides an overview of the transactions and related accounting events that the platform creates over the term of this example refinancing agreement, with the corresponding dates.

DateTransaction typeEvent typeEntry typeDescriptionCycle stageWhen it happensWhat is accounted
1 July701701701Refinancing creditContractRefinancing credit: transaction creationPrincipal amount
1 July7037032121Refinancing contractContractRefinancing contract: transaction creationPrincipal amount + fixed IOF
1 July7037032122Refinancing contract interestContractRefinancing contract: transaction creationTotal interest
1 July7037032123Total IOF refinancingContractRefinancing contract: transaction creationTotal IOF
1 July702702702Installment refinancing1st installment1st installment: transactions creationInstallment principal amount + total installment IOF
1 July7027022125Installment refinancing interest1st installment1st installment: transactions creationInstallment interest
30 July7027022126Installment refinancing due date1st installment1st installment: statement due dateInstallment principal amount + total installment IOF
30 July7027022127Installment refinancing interest due date1st installment1st installment: statement due dateInstallment interest
20 July702702702Installment refinancing2nd installment1st installment: cycle closeInstallment principal amount + total installment IOF
20 July7027022125Installment refinancing interest2nd installment1st installment: cycle closeInstallment interest
30 August7027022126Installment refinancing due date2nd installment2nd installment: statement due dateInstallment principal amount + total installment IOF
30 August7027022127Installment refinancing interest due date2nd installment2nd installment: statement due dateInstallment interest
20 August702702702Installment refinancing3rd installment2nd installment: cycle closeInstallment principal amount + total installment IOF
20 August7027022125Installment refinancing interest3rd installment2nd installment: cycle closeInstallment interest
30 September7027022126Installment refinancing due date3rd installment3rd installment: statement due dateInstallment principal amount + total installment IOF
30 September7027022127Installment refinancing interest due date3rd installment3rd installment: statement due dateInstallment interest

Transactions details

The following table details the transactions that the platform creates over the course of the three installments specified in this refinancing example.

Created AtTransaction IDAuthorization IDTransaction type IDDescriptionInstallmentAccount IDStatement IDAmount (R$)Interest amount (R$)Interest rateIOF amount (R$)
1 July794944443972701REFINANCING CREDIT110267333310913526.64000
1 July797144443972703REFINANCING CONTRACT10267333310914591.681032.730.0832.31
1 July796144443972417IOF REFINANCING110267333310917.1400
1 July796244443972702REFINANCING INSTALLMENT110267333310911530.56497.550.080
1 July796344443972417IOF REFINANCING2102673333109910.5000
1 July796444443972702REFINANCING INSTALLMENT210267333310991530.56363.630.080
1 July796544443972417IOF REFINANCING3102673333109214.6700
1 July796644443972702REFINANCING INSTALLMENT310267333310921530.56196.730.080

Accounting events details

The following table details the accounting events that the platform creates for the refinancing contract.

CreatedAtTransaction_IDEventType_IDEntryType_IDDescriptionAmount (R$)Amount breakdown
1 July7949701701REFINANCING CREDIT3526.64Principal refinancing amount
1 July79717032121REFINANCING CONTRACT3558.95Principal + total IOF
1 July79717032122REFINANCING CONTRACT INTEREST1032.73Refinancing interest amount
1 July79717032123REFINANCING CONTRACT IOF32.31Total IOF

For installment 1, the platform creates the following accounting events.

CreatedAtTransaction_IDEventType_IDEntryType_IDDescriptionAmount (R$)Amount breakdown
1 July7962702702INSTALLMENT REFINANCING1033.01Installment principal amount + installment IOF amount
1 July79627022125INSTALLMENT REFINANCING INTEREST124.06Installment interest
30 July79627022126INSTALLMENT REFINANCING - DUE DATE344.16Same amount as 702 entry type
30 July79627022127INSTALLMENT REFINANCING INTEREST - DUE DATE124.06Same amount as 2125 entry type

For installment 2, the platform creates the following accounting events.

CreatedAtTransaction_IDEventType_IDEntryType_IDDescriptionAmount (R$)Amount breakdown
20 July7962702702INSTALLMENT REFINANCING1177.43Installment principal amount + installment IOF amount
20 July79627022125INSTALLMENT REFINANCING INTEREST497.55Installment Interest
30 August79627022126INSTALLMENT REFINANCING - DUE DATE1177.43Same amount as 702 entry type
30 August79627022127INSTALLMENT REFINANCING INTEREST - DUE DATE497.55Same amount as 2125 entry type

For installment 3, the platform creates the following accounting events.

CreatedAtTransaction_IDEventType_IDEntryType_IDDescriptionAmount (R$)Amount breakdown
20 August7962702702INSTALLMENT REFINANCING1348.51Installment principal amount + installment IOF amount
20 August79627022125INSTALLMENT REFINANCING INTEREST353.13Installment Interest
30 September79627022126INSTALLMENT REFINANCING - DUE DATE1348.51Same amount as 702 entry type
30 September79627022127INSTALLMENT REFINANCING INTEREST - DUE DATE353.13Same amount as 2125 entry type

The following table is the sample of the accounting events that the platform creates for daily refinancing interest.

CreatedAtEvent_IDEventType_IDEntryType_IDDescriptionAmount (R$)
2 July69606547367022080REFINANCING DAILY INTEREST15.050
3 July69734981067022080REFINANCING DAILY INTEREST15.110
4 July69880413607022080REFINANCING DAILY INTEREST15.180
5 July70018261407022080REFINANCING DAILY INTEREST15.240
6 July70149124827022080REFINANCING DAILY INTEREST15.310
7 July70239126227022080REFINANCING DAILY INTEREST15.370
8 July70368995687022080REFINANCING DAILY INTEREST15.440
9 July70511948577022080REFINANCING DAILY INTEREST15.500
10 July70635752887022080REFINANCING DAILY INTEREST15.570
11 July70754468867022080REFINANCING DAILY INTEREST15.630
12 July70873704907022080REFINANCING DAILY INTEREST15.700
13 July71002436007022080REFINANCING DAILY INTEREST15.760
14 July71094760267022080REFINANCING DAILY INTEREST15.830
15 July71195214327022080REFINANCING DAILY INTEREST15.900
16 July71330444557022080REFINANCING DAILY INTEREST15.970
17 July71442626087022080REFINANCING DAILY INTEREST16.030
18 July71572619347022080REFINANCING DAILY INTEREST16.100
19 July71696702847022080REFINANCING DAILY INTEREST16.170
20 July71812586477022080REFINANCING DAILY INTEREST16.240
21 July71893372877022080REFINANCING DAILY INTEREST16.310
22 July71985403187022080REFINANCING DAILY INTEREST16.380
23 July72106356317022080REFINANCING DAILY INTEREST16.440
24 July72226253377022080REFINANCING DAILY INTEREST16.510
25 July72355309657022080REFINANCING DAILY INTEREST16.580
26 July72480637197022080REFINANCING DAILY INTEREST16.650
27 July72600886977022080REFINANCING DAILY INTEREST16.720
28 July72679875777022080REFINANCING DAILY INTEREST16.800
29 July72777316127022080REFINANCING DAILY INTEREST16.870
30 July72903739877022080REFINANCING DAILY INTEREST16.940
31 July73035228937022080REFINANCING DAILY INTEREST17.150
1 August73157822267022080REFINANCING DAILY INTEREST10.610
2 August73286934587022080REFINANCING DAILY INTEREST10.650
3 August73417011577022080REFINANCING DAILY INTEREST10.700
4 August73503245477022080REFINANCING DAILY INTEREST10.740
5 August73597300637022080REFINANCING DAILY INTEREST10.790
6 August73685341007022080REFINANCING DAILY INTEREST10.830
7 August73719234747022080REFINANCING DAILY INTEREST10.880
8 August73994450557022080REFINANCING DAILY INTEREST10.930
9 August74117716917022080REFINANCING DAILY INTEREST10.970
10 August74257796577022080REFINANCING DAILY INTEREST11.020
11 August74328808007022080REFINANCING DAILY INTEREST11.070
12 August74425602237022080REFINANCING DAILY INTEREST11.110
13 August74549603287022080REFINANCING DAILY INTEREST11.160
14 August74676690867022080REFINANCING DAILY INTEREST11.210
15 August74792353017022080REFINANCING DAILY INTEREST11.250
16 August74924568867022080REFINANCING DAILY INTEREST11.300
17 August75039941657022080REFINANCING DAILY INTEREST11.350
18 August75143311357022080REFINANCING DAILY INTEREST11.400
19 August75247419047022080REFINANCING DAILY INTEREST11.450
..................