# Design a Ledger

Source: https://fragment.dev/guides/design-a-ledger

[Documentation index](https://fragment.dev/llms.txt)

<a id="design-a-ledger"></a>

Complex funds flows are built from common building blocks. Learn how to model these core flows in Fragment.

<a id="basic-movements"></a>

## Basic movements

A platform facilitates a transaction between a customer and a restaurant. The customer pays the platform, which then pays out to the restaurant.

[Visual: instant-money-movement. View on the HTML page.](https://fragment.dev/guides/design-a-ledger)

[Visual: instant-money-movement. View on the HTML page.](https://fragment.dev/guides/design-a-ledger)

<a id="platform-fee"></a>

## Platform fee

The platform charges a fee for facilitating the transaction between customer and restaurant. The fee is recorded as income.

The platform pays the card network a fee for processing the payment, which the platform records as an expense.

A $25 order becomes $20 to the restaurant, $5 fee income, and $1 expense. The total held by the platform is $25 minus $1.

[Visual: platform-fee. View on the HTML page.](https://fragment.dev/guides/design-a-ledger)

<a id="card-and-ach"></a>

## Card and ACH

In reality, [money movements](https://fragment.dev/markdown/guides/accounting-101.md#funds-in-transit) are not instant. Pay ins and pay outs take a few days to settle.

[Visual: card-and-ach. View on the HTML page.](https://fragment.dev/guides/design-a-ledger)

When the process starts, an Initiate entry records a new receivable or payable. When the funds arrive, a Settle Entry moves the funds out of the receivable or payable account.

[Clearing Accounts](https://fragment.dev/markdown/guides/accounting-101.md#account-settings) handle these transitory balances.

[Visual: card-and-ach. View on the HTML page.](https://fragment.dev/guides/design-a-ledger)

<a id="bulk-payouts"></a>

## Bulk payouts

To reduce fees on payouts, the platform consolidates multiple orders to the same restaurant into a single payout.

[Visual: bulk-payouts. View on the HTML page.](https://fragment.dev/guides/design-a-ledger)

In this example, a restaurant receives two different orders.

[Visual: bulk-payouts. View on the HTML page.](https://fragment.dev/guides/design-a-ledger)

<a id="bulk-payins"></a>

## Bulk payins

Orders placed through the same card network arrive as a bulk payin.

[Visual: linked-bank-account. View on the HTML page.](https://fragment.dev/guides/design-a-ledger)

The platform must [reconcile](https://fragment.dev/markdown/guides/reconcile-payments.md) the bulk payment, their bank balance, and the balance in Fragment.

A bulk payment arrives into the [Linked Account](https://fragment.dev/markdown/guides/reconcile-payments.md#linked-ledger-accounts).

[Visual: linked-bank-account. View on the HTML page.](https://fragment.dev/guides/design-a-ledger)

<a id="currency-conversion"></a>

## Currency conversion

The restaurant charges €18. The platform charges the customer $20 priced against a projected exchange rate.

[Visual: currency-conversion. View on the HTML page.](https://fragment.dev/guides/design-a-ledger)

The USD payment and Euro payable are balanced through corresponding lines in the income account.

[Visual: currency-conversion. View on the HTML page.](https://fragment.dev/guides/design-a-ledger)

<a id="loan"></a>

## Loan

The platform offers a loan service to cover operating costs for restaurants.

Disbursing the loan moves money out of the cash account into the loan receivable.

[Visual: loan. View on the HTML page.](https://fragment.dev/guides/design-a-ledger)

<a id="p2p-transfer"></a>

## P2P transfer

This section is models a peer-to-peer payments app instead of the marketplace.

Each user’s wallet balance is held in a liability account.

A user funds their wallet using ACH.

[Visual: p2p-transfer. View on the HTML page.](https://fragment.dev/guides/design-a-ledger)

<a id="next-steps"></a>

## Next steps

Ready to build? Follow the [Quickstart](https://fragment.dev/markdown/guides/quickstart.md) to create your first ledger and post an entry.
