> For the complete documentation index, see [llms.txt](https://sapphiredao.gitbook.io/sapphire/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sapphiredao.gitbook.io/sapphire/technical-documentation/architecture.md).

# Architecture

Each components use during a transaction is illustrated in the diagram below

<figure><img src="https://blockhead.gitbook.io/~gitbook/image?url=https%3A%2F%2F3837242389-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F5UzCRCLb5VwxOn41UVsO%252Fuploads%252F9pkY6aUa46HLTlUuYw3f%252Fimage.png%3Falt%3Dmedia%26token%3D4ac1d403-5e2c-44cb-96f1-b0efe90ba8e7&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=252419e9&#x26;sv=2" alt=""><figcaption><p>Interaction Flow in SapphireDao Payment System</p></figcaption></figure>

1. Request for Invoice Creation: The creator submits a request to the contract to create an invoice. The contract generates a unique invoice ID and attaches the necessary data to it.
2. Smart Contract Requests Escrow Address: The invoice smart contract requests that the Escrow Factory generate a special escrow address for the invoice and it is sent back to the invoice smart contract.
3. Payment URL Generated: A payment URL is created by the invoice smart contract by emitting an event with the escrow address and sent to the creator.
4. Payer Accesses URL: The payment procedure is started by the Payer using the payment URL that the Creator supplied.
5. Payment Sent to Escrow: The Payer transfers the designated sum of money straight to the distinct escrow address that the Escrow smart contract controls.
6. Escrow Holds Funds: Until release conditions, including invoice approval, or refund triggers, are satisfied, the money is safely held by the Escrow smart contract.
