What are ledger entries?
A ledger entry is an immutable accounting record that represents a single monetary movement. Each entry contains:- Amount: The monetary value (always positive, stored in cents)
- Operation: Either CREDIT (money received) or DEBIT (money owed/paid)
- Type: The economic subject (what the money represents)
- Owner: Who the entry belongs to (company, platform, or provider)
- Payment date: When the money is expected to move
Entity relationships
Core concepts
Posting sets
A posting set is a balanced group of ledger entries created by a single business event (like a transaction approval). Every posting set must net to zero:Pair tokens
Ledger entries are linked in pairs using apair_token. Each pair represents a complete accounting transaction with one CREDIT and one DEBIT entry. For example:
- Merchant receives R100 (DEBIT)
Owner types
Ledger entries can belong to three types of owners:- COMPANY: Organizations and merchants in your platform
- PLATFORM: Rinne platform itself
- PROVIDER: Payment providers (e.g., Celcoin)
Ledger entry types
Transaction processing
When a transaction is approved, Rinne creates four pairs of ledger entries:Transaction
Transaction
The main transaction amount owed to the merchant.Example: R$100 PIX transaction
- Merchant: R$100 CREDIT (receives money)
- Provider: R$100 DEBIT (pays merchant)
Organization fee
Organization fee
Commercial fee owed to the organization (parent company).Example: 2.5% fee on R$100 transaction
- Merchant: R$2.50 DEBIT (pays fee)
- Organization: R$2.50 CREDIT (receives fee)
Platform cost
Platform cost
Processing fee owed to Rinne platform.Example: 1.0% cost on R$100 transaction
- Organization: R$1.00 DEBIT (pays cost)
- Platform: R$1.00 CREDIT (receives cost)
Provider cost
Provider cost
Service fee owed to the payment provider.Example: R$0.12 fixed cost
- Platform: R$0.12 DEBIT (pays cost)
- Provider: R$0.12 CREDIT (receives cost)
Refund processing
When a refund is processed, Rinne creates similar pairs but with reversed operations:Transaction refund
Transaction refund
Main refund amount returned to customer.Example: R$50 refund
- Merchant: R$50 DEBIT (returns money)
- Provider: R$50 CREDIT (processes refund)
Organization fee refund
Organization fee refund
Fee returned to the merchant for the refund.Example: 2.5% fee refund on R$50
- Merchant: R$1.25 CREDIT (receives fee back)
- Organization: R$1.25 DEBIT (returns fee)
Platform refund cost
Platform refund cost
Platform cost for performing the refund operation.Example: 1.0% refund cost on R$50
- Organization: R$0.50 DEBIT (pays refund cost)
- Platform: R$0.50 CREDIT (receives refund cost)
Provider refund cost
Provider refund cost
Provider cost for performing the refund operation.Example: R$0.12 fixed refund cost
- Platform: R$0.12 DEBIT (pays refund cost)
- Provider: R$0.12 CREDIT (receives refund cost)
Complete transaction example
Here’s a complete R$100 PIX transaction with all ledger entries:- Credits: R2.50 + R0.12 = R$103.62
- Debits: R2.50 + R0.12 = R$103.62 ✓
Settlement tracking
Each ledger entry tracks its settlement status:- outstanding_amount: How much is still unsettled
- settled: Whether the entry is fully settled
- fully_settled_at: When it became fully settled
- last_clearing_at: Most recent settlement
outstanding_amount = amount and settled = false. As settlement items are created, the outstanding amount decreases until the entry is fully settled.
Payment dates and installments
Payment date calculation
Payment dates are calculated based on the transaction approval date and payment method:- PIX: Same day (D+0)
- Debit card: Next day (D+1)
- Credit card: 30 days later (D+30)
Installment support
For credit card transactions with installments, Rinne creates separate ledger entries for each installment:Precision and rounding
Rinne uses sophisticated rounding strategies to ensure financial accuracy:Floor + remainder distribution
When dividing amounts across installments, Rinne uses floor division with remainder distribution to prevent zero amounts:Balancing adjustments
After generating all ledger entries, Rinne applies balancing adjustments to the first installment to ensure exact totals:- Calculate expected totals (transaction amount, fees, costs)
- Calculate actual totals from generated entries
- Apply differences to first installment entries
Σ(installments) = expected_total exactly.
Immutability and corrections
Ledger entries are immutable once created. You cannot modify the core fields:- amount
- operation
- type
- owner information
- payment_date
- business linkages (transaction_id, refund_id, etc.)
Key principles
Double-entry
Every posting set must balance: credits = debits
Immutable
Core fields cannot be changed after creation
Precise
Sophisticated rounding ensures exact totals
Traceable
Full audit trail from creation to settlement

