Adding Refund $ line to payment details in Order Printer app

Looked EVERYWHERE trying to find the correct coding to add a “Refunded Amount” line to the Payment details in my Order Printer template…

Current Code

Payment Details

{% if shipping_address %} {% endif %} {% if line_item.tax_lines %} {% endif %} {% for discount in discounts %} {% endfor %} {% if total_paid != total_price %} {% endif %}
Subtotal price: {{ subtotal_price | money }}
Shipping: {{ shipping_price | money }}
{% for tax_line in line_item.tax_lines %} {{ tax_line.price | money }} {{ tax_line.title }}
{% endfor %}
Total tax: {{ total_tax | money }}
Total price: {{ total_price | money }}
Includes discount "{{ discount.code }}" {{ discount.savings | money }}
Total paid: {{ total_paid | money }}

Payment Details

{% if shipping_address %} {% endif %} {% if line_item.tax_lines %} {% endif %} {% for discount in discounts %} {% endfor %}

{% assign refunded_amount = 0 %}
{% for transaction in transactions %}
{% if transaction.kind == ‘refund’ %}
{% assign refunded_amount = refunded_amount | plus: transaction.amount %}
{% endif %}
{% endfor %}

{% if refunded_amount > 0 %}

{% endif %}

{% if total_paid != total_price %}

{% endif %}

{% assign outstanding_amount = total_price | minus: refunded_amount | minus: total_paid %}

{% if outstanding_amount > 0 %}

{% endif %}
Subtotal price: {{ subtotal_price | money }}
Shipping: {{ shipping_price | money }}
{% for tax_line in line_item.tax_lines %} {{ tax_line.price | money }} {{ tax_line.title }}
{% endfor %}
Total tax: {{ total_tax | money }}
Total price: {{ total_price | money }}
Includes discount "{{ discount.code }}" {{ discount.savings | money }}
Refunded Amount: {{ refunded_amount | money }}
Total paid: {{ total_paid | money }}
Outstanding Amount: {{ outstanding_amount | money }}