Adjusting Invoices

From API Documentation

Jump to: navigation, search

Invoices can be adjustment in two ways:

  • Adjusting a line item (ie, charge or tax) on an invoice
  • Adjusting the total of an invoice


To adjust a single a line item, an InvoiceItemAdjustment is used (available as of version 23.0 of the API)

To adjust an invoice, an InvoiceAdjustment is used (available as of version 24.0 of the API).


Contents

Invoice Adjustment Use Cases

Adjusting an Invoice

  • Create an InvoiceAdjustment
  • Specify the type of adjustment (credit or charge)
  • Specify either the invoice number or invoice Id
  • Specify the amount of the adjustment
  • Specify the adjustment date
  • Specify any other optional fields (comments, reference Id, accounting code)
Sample SOAP
<ns1:create xmlns:ns1="http://api.zuora.com/">
  <ns1:zObjects xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:InvoiceAdjustment">
     <ns2:AccountingCode>accountCode_0001</ns2:AccountingCode>
     <ns2:AdjustmentDate>2010-08-06T10:50:49.875+08:00</ns2:AdjustmentDate>
     <ns2:Amount>88</ns2:Amount>
     <ns2:Comments>api test</ns2:Comments>
     <ns2:InvoiceNumber>INV-1281063049406</ns2:InvoiceNumber>
     <ns2:ReferenceId>re_001_225</ns2:ReferenceId>
     <ns2:Type>Credit</ns2:Type>
  </ns1:zObjects>
</ns1:create>

Canceling an Adjustment to an Invoice

  • Determine Id of Adjustment to be canceled (e.g., using query() call)
  • Update Adjustment, set Status=Canceled

Sample SOAP

<ns1:update xmlns:ns1="http://api.zuora.com/">
  <ns1:zObjects xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:InvoiceAdjustment">
     <ns2:Id>402881822a453a87012a4553f6cd01d8</ns2:Id>
     <ns2:Status>Canceled</ns2:Status>
  </ns1:zObjects>
</ns1:update>

Deleting an Adjustment to an Invoice

  • Determine Id of Adjustment to be deleted (e.g., using query() call)
  • Delete Adjustment, specify Id

Sample SOAP

<ns1:delete xmlns:ns1="http://api.zuora.com/">
  <ns1:type>InvoiceAdjustment</ns1:type>
  <ns1:ids>402881822a453a87012a4559898f025f</ns1:ids>
</ns1:delete>


Invoice Item Adjustment Use Cases

Adjusting an Invoice Item

  • Create an InvoiceAdjustmentItem
  • Specify the type of adjustment (credit or debit)
  • Specify either the invoice number or invoice Id that contains the line item being adjusted
  • Specify the amount of the adjustment
  • Specify the whether the line item is a charge or tax line item (specify SourceType)
  • Specify the Id of the line item (which is either an InvoiceItem.Id or a TaxationItem.Id)
  • Specify the adjustment date
  • Specify any other optional fields (comments, reference Id, accounting code)
Sample SOAP
 <ns1:create xmlns:ns1="http://api.zuora.com/">
  <ns1:zObjects xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:InvoiceItemAdjustment">
    <ns2:AccountingCode>test-1</ns2:AccountingCode>
    <ns2:AdjustmentDate>2010-02-02T12:00:00.343+08:00</ns2:AdjustmentDate>
    <ns2:Amount>2.00</ns2:Amount>
    <ns2:Comment>test</ns2:Comment>
    <ns2:InvoiceNumber>INV-1278576579796</ns2:InvoiceNumber>
    <ns2:SourceId>402892df29b119720129b11a55030007</ns2:SourceId>
    <ns2:SourceType>InvoiceDetail</ns2:SourceType>
    <ns2:Type>Credit</ns2:Type>
  </ns1:zObjects>
 </ns1:create>

Canceling an Adjustment to an Invoice Item

  • Determine Id of Invoice Item Adjustment to be canceled (e.g., using query() call)
  • Update InvoiceItemAdjustment, set Status=Canceled

Sample SOAP

<ns1:update xmlns:ns1="http://api.zuora.com/">
  <ns1:zObjects xmlns:ns2="http://object.api.zuora.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:InvoiceItemAdjustment">
    <ns2:Id>402892df29b11b9f0129b11c75150008</ns2:Id>
    <ns2:Status>Canceled</ns2:Status>
  </ns1:zObjects>
</ns1:update>

Deleting an Adjustment to an Invoice Item

  • Determine Id of InvoiceItemAdjustment to be deleted (e.g., using query() call)
  • Delete Adjustment, specify Id

Sample SOAP

<ns1:delete xmlns:ns1="http://api.zuora.com/">
  <ns1:type>InvoiceItemAdjustment</ns1:type>
  <ns1:ids>3028a2152a453a84048a45598aff025e</ns1:ids>
</ns1:delete>