Generating an Invoice

From API Documentation

Jump to: navigation, search

This use case covers generating an invoice programmatically.

1) Generate a new Invoice.

  • Set the following fields:
    • Specify the AccountId to indicate which customer this invoice is for.
    • Set the filtering parameters: IncludesOneTime, IncludesRecurring and IncludesUsage to either True or False. Please note that these three fields are optional and default to True.
    • Set the InvoiceDate. This date will be shown on the invoice as the Invoice Date and, along with the Payment Term, will impact the Invoice Due Date.
    • Set the TargetDate. This date indicates what charges to include on the invoice. All charges will be included that mature on or before this date.
  • The Status of the invoice will be Draft by default.

The SOAP call envelope payload should look like this:

<ns1:generate>
  <ns1:zObjects xsi:type="ns2:Invoice">
    <ns2:AccountId>4028e485225d1d5f0122662fd6b249c8</ns2:AccountId>
    <ns2:IncludesOneTime>True</ns2:IncludesOneTime>
    <ns2:IncludesRecurring>True</ns2:IncludesRecurring>
    <ns2:IncludesUsage>True</ns2:IncludesUsage>
    <ns2:InvoiceDate>2009-11-11T08:07:55-08:00</ns2:InvoiceDate>
    <ns2:TargetDate>2009-11-11T08:07:55-08:00</ns2:TargetDate>
  </ns1:zObjects>
</ns1:generate>

2) Update the Status of the new Invoice.

  • Set the following fields:
    • Specify the invoice Id.
    • Set Status to Posted. Please note that the other allowable status value is Canceled.
  • Update the new Invoice, see the update() API call.

The SOAP call payload should look like this:

<ns1:update>
 <ns1:zObjects xsi:type="ns2:Invoice">
   <ns2:Id>8a8ae4b122f5e34d0122f6d269610760</ns2:Id>
   <ns2:Status>Posted</ns2:Status>
 </ns1:zObjects>
</ns1:update>