Welcome to Zuora Product Documentation

Explore our rich library of product information

Configure HTML invoice templates for prepaid commitments

Learn how to configure an HTML invoice template to display prepaid commitment, balances, and application line items on customer-facing invoice PDFs.

  • Make sure the customer account uses an HTML invoice template.

  • Have a prepaid funding invoice and a subsequent service invoice available for preview.

  • Identify the prepayment processing types used by your billing system.

  1. Open the invoice template configuration.
    1. Go to Billing > Manage Billing Document Configuration.
    2. Open the Manage Invoice Rules and Templates tab.
    3. Create an HTML invoice template or open an existing HTML invoice template.
  2. Add prepaid commitment balance summary.

    Include the prepayment billing item and balance tracking fields in the template. Map the balance components as follows:

    Balance valueSource or calculationSuggested label
    Total prepaymentCommitment period amountTotal Prepayment
    Beginning balanceEnding balance less consumed amount on the current invoiceBeginning Balance
    Amount consumed on the invoiceSum of prepayment application amountsConsumed Amount
    Balance after the current applicationRemaining commitment-period balanceEnding Balance

    The beginning balance is calculated by subtracting the consumed amount on the current invoice from the ending balance:

    Beginning Balance = Ending Balance - Consumed Amount

    The consumed amount is stored as a negative value. The ProcessingType filter identifies prepayment application invoice items: EQ means equals, and 9 is the processing type for PrepaymentApplication. Summing the ChargeAmount values of these items gives the total amount consumed during the invoice period.

    Therefore, use a minus sign in the calculation.

    For example, if the beginning balance is 1,200, the consumed amount is -300, and the ending balance is 900, the calculation is 1,200 = 900 - (-300).

    In the HTML invoice template editor, configure the merge field or formula to calculate the beginning balance from the ending balance and the consumed amount on the current invoice.

    The following example uses the ending balance in {{Balance}} and subtracts the current invoice's consumed amount:

    {{#Wp_Eval}}
    {{Balance}} - {{Invoice.InvoiceItems|FilterByValue(ProcessingType,EQ,9)|Sum(ChargeAmount)}}
    {{/Wp_Eval}}
  3. In the invoice-item table, include the prepayment invoice item separately from service charge items.
    Note: Use the invoice-item processing type and commitment source to distinguish the prepayment item from standard service charges.
  4. Add prepayment application as a negative line item.

    Prepayment applications are generated as separate invoice items with ProcessingType = PrepaymentApplication and InvoiceDetailSource = Commitment. They offset eligible service charges and are displayed as negative invoice lines.

    1. Add the invoice-item table or invoice-item section to the HTML template.
    2. Filter the section to include invoice items with the prepayment-application processing type.
    3. Display the invoice-item description and amount.
    4. Label the line Prepayment Application or use the commitment name followed by – Credit Application.
    5. Do not prepend another minus sign to the amount. Render the invoice-item amount as stored so that the negative amount is not double-negated.
  5. Save and assign the template.
    1. Save the template.
    2. Assign the template to the relevant customer account, if needed.
  6. Preview and validate the PDF output.
    1. Preview the template with a prepayment invoice.
    2. Preview the template with a later service charge invoice.
    3. Confirm that the prepayment amount, beginning balance, consumed amount, ending balance, and prepayment application line are understandable to the invoice recipient.
    4. Confirm that the prepayment application reduces the service charge invoice balance as expected.
    5. Regenerate the PDF after changing the template or invoice data, and confirm that the updated content appears.