Saltar al contenido principal
This page guides you through the creation of a transaction receipt template using Reporter in .txt format.

Template code


##########################################
#            PROOF OF PAYMENT            #
##########################################

Generation Date: {% date_time "dd/MM/YYYY HH:mm" %}
Ledger Name: {{ midaz_onboarding.ledger.0.name }}

{%- for transaction in midaz_transaction.transaction %}
-----------------------------------------
Transaction ID: {{ transaction.id }}
Transaction Date: {{ transaction.created_at }}
Total Amount: {{ transaction.amount }}
Transaction Status: {{transaction.status}}
------------------------------------------

Source Accounts:
{%- for operation in filter(midaz_transaction.operation, "transaction_id", transaction.id) %} 
{%- if operation.type == "DEBIT" %} 
- Alias: {{operation.account_alias }} 
- Debit Amount: {{ operation.amount }} 
{%- endif %}
{%- endfor %}

Target Accounts:
{%- for operation in filter(midaz_transaction.operation, "transaction_id", transaction.id) %} 
{%- if operation.type == "CREDIT" %} 
- Alias: {{operation.account_alias }} 
- Credit Value: {{operation.amount }} 
{%- endif %}
{%- endfor %}

{%- endfor %}
------------------------------------------
Automatically generated document.

Code breakdown


** Generation Date: {% date_time "dd/MM/YYYY HH:mm" %}** Renders the current date and time when the template is processed.
  • Uses the format dd/MM/YYYY HH:mm (e.g., 26/05/2025 11:45).
** Ledger Name: {{ midaz_onboarding.ledger.0.name }}** Displays the name of the ledger associated with this report.
  • midaz_onboarding.ledger is a list, and [0] selects the first ledger.
  • .name fetches the name property, like "Corporate Ledger".
** {% for transaction in midaz_transaction.transaction %}** This loop iterates over each transaction in the midaz_transaction.transaction list. For every transaction, the code below will run once to display its information.

Transaction header block

Each transaction prints the following details:
-----------------------------------------
Transaction ID: {{ transaction.id }}
Transaction Date: {{ transaction.created_at }}
Total Amount: {{ transaction.amount }}
Transaction Status: {{ transaction.status }}
------------------------------------------
  • transaction.id: Unique ID of the transaction.
  • transaction.created_at: Timestamp when the transaction was created.
  • transaction.amount: The raw amount of the transaction.
  • transaction.status: Current status such as COMPLETED, PENDING, or FAILED.

Source accounts section

Source Accounts:
{% for operation in filter(midaz_transaction.operation, "transaction_id", transaction.id) %}
  {% if operation.type == "DEBIT" %}
    - Alias: {{ operation.account_alias }}
    - Debit Amount: {{ operation.amount }}
  {% endif %}
{% endfor %}
  • Filters the operations list to include only operations linked to the current transaction.
  • Further filters it to only show operations with type == "DEBIT" (funds leaving an account).
  • For each matching debit:
    • Displays the account alias.
    • Displays the debit amount.

Target accounts section

Target Accounts:
{% for operation in filter(midaz_transaction.operation, "transaction_id", transaction.id) %}
  {% if operation.type == "CREDIT" %}
    - Alias: {{ operation.account_alias }}
    - Credit Value: {{ operation.amount }}
  {% endif %}
{% endfor %}
  • Same logic as the debit block, but filters for type == "CREDIT" (funds received).
  • For each matching credit:
    • Displays the account alias.
    • Displays the credit amount.
------------------------------------------
Automatically generated document.
  • Simple text footer that marks the end of the report.
  • Indicates that the file was generated automatically, typically for traceability.

Template output


##########################################
#            PROOF OF PAYMENT            #
##########################################

Generation Date: 23/05/2025 14:08
Ledger Name: Rice, Rowe and O'Hara

-----------------------------------------
Transaction ID: 75906707-8c31-479c-b354-aa805c4cefbc
Transaction Date: 2025-05-22T14:15:22.123Z
Total Amount: 5000.00
Transaction Status: ACTIVE
------------------------------------------

Source Accounts:
- Alias: @external|USD 
- Debit Amount: 1500.00

Target Accounts:
- Alias: @wallet_12345 
- Credit Value: 1500.00

------------------------------------------
Automatically generated document.
I