Invoice Integration - Discount at Header Level

  • Updated

A discount can be applied at the header level of an invoice using the <InvoiceDetailDiscount> element within the <InvoiceDetailSummary>. This requires specific calculations for the Net Amount and Due Amount.

 

Discount Element Structure

The <InvoiceDetailDiscount> element specifies the percentage and monetary value of the discount.

Element/AttributePurpose
percentageRateThe rate of the discount applied to the gross pre-tax total (e.g., "10.00").
<Money>The calculated discount amount (monetary value).

Sample Discount Format:

<InvoiceDetailDiscount percentageRate="10.00">
    <Money currency="USD">22.50</Money>
</InvoiceDetailDiscount>

 

Net Amount and Due Amount Calculation

The <NetAmount> and <DueAmount> elements represent the final total owed by the customer after the discount is applied.

The calculation must be:

Subtotal + ShippingAmount + Tax GrossAmount - Discount = Net Amount/Amount Due

 

Example Calculation:

  1. $200.00 + $10.00 + $15.00 = $225.00 - $22.50 = $202.50
 
<NetAmount>
    <Money currency="USD">202.5</Money>
</NetAmount>
<DueAmount>
    <Money currency="USD">202.5</Money>
</DueAmount>

 

Example InvoiceDetailSummary (Including Discount)

The discount elements are placed within the <InvoiceDetailSummary>, appearing after the <GrossAmount> element.

<InvoiceDetailSummary>
      <SubtotalAmount>
          <Money currency="USD">200.00</Money>
      </SubtotalAmount>
      <Tax>
          <Money currency="USD">15.00</Money>
          <Description xml:lang="en-US">Cost of tax, including shipping tax</Description>
          <TaxDetail category="sales" percentageRate="7.5" purpose="tax">
              <TaxableAmount>
                   <Money currency="USD">200.00</Money>
              </TaxableAmount>
              <TaxAmount>
                   <Money currency="USD">15.00</Money>
              </TaxAmount>
           </TaxDetail>
       </Tax>
       <SpecialHandlingAmount>
           <Money currency="USD">0.00</Money>
           <Description xml:lang="en-US">Other Charges</Description>
       </SpecialHandlingAmount>
       <ShippingAmount>
           <Money currency="USD">10.00</Money>
       </ShippingAmount>
       <GrossAmount>
           <Money currency="USD">225.00</Money>
       </GrossAmount>
       <InvoiceDetailDiscount percentageRate="10.00">
           <Money currency="USD">22.50</Money>
       </InvoiceDetailDiscount>
       <NetAmount>
           <Money currency="USD">202.5</Money>
       </NetAmount>
       <DueAmount>
           <Money currency="USD">202.5</Money>
       </DueAmount>
  </InvoiceDetailSummary>