api.invoices

/api/invoices/

GET /api/invoices/

Description:

Return a list of invoices
can_lock requires_lock has_etag requires_etag
False False False False

Filters:

Name Description
datetime_created The date and time the invoice was created.
datetime_modified The date and time the invoice was modified.

Request:

<!-- No XML Request. -->

Response:

<invoices>
    <invoice uri="/invoices/A/" id="A" full_render="false">
        <datetime_created>[datetime]</datetime_created>
        <flags>
            <posted>[bool]</posted>
        </flags>
        <invoice_id>[str]</invoice_id>
        <invoice_customer>
            <customer uri="/customers/B/" id="B"/> <!-- Empty if the customer is a walk in -->
            <mainname>[str]</mainname>
            <mainphone>[str]</mainphone>
            <contact_info>[str]</contact_info>
        </invoice_customer>
        <totals>
            <total>[decimal]</total>
        </totals>
    </invoice>
    [...]
</invoices>

POST /api/invoices/

Description:

Create a new invoice
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<invoice>
    <invoice_customer>
        <customer id="[int]"/><!-- May be absent to indicate a walk-in -->
        <mainname>[str]</mainname>
        <phone_email>[str]</phone_email>
        <phone>[str]</phone>
        <mainphone>[str]</mainphone>
        <zip>[str]</zip>
        <contact>[str]</contact>
        <discount>[decimal]</discount>
        <po>[str]</po>
        <pricing_level>[int]</pricing_level>
        <terms_tax>[str]</terms_tax>
    </invoice_customer>
    <datetime_created>[datetime]</datetime_created>
    <flags>
        <drop_shipment>[bool]</drop_shipment>
        <exported>[bool]</exported>
        <posted>[bool]</posted>
        <voided>[bool]</voided>
    </flags>
    <source>
        <!-- one of: -->
        <order id="[int]"/>
        <quote id="[int]"/>
        <sro id="[int]"/>
    </source>
    <print_options>
        <localizable_language id="[int]"/>
        <discounts>[bool]</discounts>
        <product_images size="[enum: large | small]" first_product_only="[bool]"/>
    </print_options>
    <primary_user>
        <user id="[int]"/>
    </primary_user>
    <secondary_user>
        <user id="[int]"/>
    </secondary_user>
    <currency id="[int]"/>
    <terms id="[int]"/>
    <printed_notes>[str]</printed_notes>
    <internal_notes>[str]</internal_notes>
    <shipping_method id="[int]"/>
    <cc_info>[str]</cc_info>
    <tax_code id="[int]"/>
    <station>[str]</station>
    <pricing_level index="[int]"/> <!-- index can be empty -->
    <c_discount_percentage>[decimal]</c_discount_percentage>
</invoice>

Response:

<invoice uri="/invoices/X/" id="X" full_render="true">
    <!-- See GET /invoices/X/ for details -->
</invoice>

/api/invoices/(d+)/

GET /api/invoices/(d+)/

can_lock requires_lock has_etag requires_etag
True False False False

Request:

<!-- No XML Request. -->

Response:

<invoice uri="/invoices/A/" id="A" full_render="true">
    <document_id>[int]</document_id>
    <date_created>[date]</date_created>
    <datetime_created>[datetime]</datetime_created>
    <date_modified>[date]</date_modified>
    <datetime_modified>[datetime]</datetime_modified>
    <flags>
        <drop_shipment>[bool]</drop_shipment>
        <exported>[bool]</exported>
        <pay_backorders>[bool]</pay_backorders>
        <posted>[bool]</posted>
        <voided>[bool]</voided>
    </flags>
    <invoice_id>[str]</invoice_id>
    <invoice_customer>
        <customer uri="/customers/B/" id="B" /><!-- Empty if the customer is a walk in -->
        <mainname>[str]</mainname>
        <mainphone>[str]</mainphone>
        <phone_email>[str]</phone_email>
        <contact>[str]</contact>
        <contact_info>[str]</contact_info>
        <merged_to>
            <customer uri="/customers/Y/" id="Y"/> <!-- Empty if not merged -->
        </merged_to>
        <discount>[decimal]</discount>
        <pricing_level>[int]</pricing_level>
        <terms_tax>[str]<terms_tax>
        <zip>[str]</zip>
        <po>[str]</po>
    </invoice_customer>
    <source>
        <id>[str]</id>
        <!-- one of: -->
        <quote uri="/quotes/C/" id="C"/>
        <order uri="/orders/C/" id="C"/>
        <sro uri="/sros/C/" id="C"/>
    </source>
    <margin>[decimal]</margin>
    <print_options>
        <localizable_language uri="/setup/localizable_languages/X/" id="X" full_rendered="true">
            <!-- See GET /setup/localizable_languages/X/ response for details. -->
        </localizable_language>
        <images>[str]</images>
        <discounts>[bool]</discounts>
    </print_options>
    <primary_user>
        <user uri="/users/D/" id="D"/><!-- Empty if no primary user -->
    </primary_user>
    <secondary_user>
        <user uri="/users/E/" id="E"/><!-- Empty if no secondary user -->
    </secondary_user>
    <printed_notes>[str]</printed_notes>
    <internal_notes>[str]<internal_notes>
    <shipping_method uri="/setup/shipping_methods/X/" id="X">
        <!-- See GET /setup/shipping_methods/X/ response for details. -->
    </shipping_method
    <currency uri="/setup/currencies/F/ id="F" full_render="true"> <!-- Empty if no currency assigned. Else fully rendered. -->
        <!-- See GET /setup/currencies/X/ response for details -->
    </currency>
    <terms uri="/terms/G/" id="G"/> <!-- Empty if no terms assigned -->
    <returned_invoice uri="/invoices/b/" id="b"/>
    <cc_info>[str]</cc_info>
    <due>[date]</due>
    <exported>[datetime]</exported>
    <posted>[datetime]</posted>
    <import_id>[str]</import_id>
    <status>[str]</status>
    <totals>
        <cost>[decimal]</cost>
        <subtotal>[decimal]</subtotal>
        <profit>[decimal]</profit>
        <tax>[decimal]</tax>
        <total>[decimal]</total>
        <owing>[decimal]</owing>
        <paid>[decimal]</paid>
        <total_backordered>[decimal]</total_backordered><!-- The total amount for any backordered items -->
        <remaining_balance>[decimal</remaining_balance><!-- The amount the custom has left to pay -->
    </totals>
    <tax_code uri="/tax_codes/H/" id="H" /><!-- Empty if no tax code assigned -->
    <taxes inclusive="[bool]">
        <tax_exempt>
            <tax rate="[decimal]" total="[decimal]" id="[int]">[bool]</tax><!-- Always 5 tax elements with ids 1-5 -->
            [...]
        </tax_exempt>
    </taxes>
    <station>[str]</station>
    <pricing_level index="[int]"><!-- Empty if no pricing level has been set -->
        <name>[str]</name>
    </pricing_level>
    <c_discount_percentage>[decimal]</c_discount_percentage>
    <payments>
        <payment uri="/invoices/A/payments/I/" id="I"/>
        [...]
    </payments>
    <lineitems>
        <lineitem uri="/invoices/A/lineitems/J/" id="J" full_render="false">
            <quantity>[decimal]</quantity>
            <sell_price>[decimal]</sell_price> <!-- the sell price (including or excluding taxes, depending on the tax-inclusion mode) -->
            <sells>
                <sell>[decimal]</sell> <!-- sell price of item, excluding taxes -->
                <base>[decimal]</base> <!-- base sell price of item, excluding taxes -->
                <total>[decimal]</total> <!-- total sell price of specified quantity of item, excluding taxes -->
                <sell_quantity_discount>[decimal]</sell_quantity_discount> <!-- sell price of item accounting for quantity discounts (excluding taxes) -->
                <sell_tax_inclusive_quantity_discount>[decimal]</sell_tax_inclusive_quantity_discount> <!-- sell quantity discount including taxes -->
                <sell_tax_inclusive>[decimal]</sell_tax_inclusive> <!-- sell price of item, including taxes -->
                <sell_tax_inclusive_total>[decimal]</sell_tax_inclusive_total> <!-- total sell price of specified quantity of item, including taxes -->
                <sell_tax_inclusive_discounted>[decimal]</sell_tax_inclusive_discounted> <!-- sell price of item including both taxes and discounts -->
            </sells>
            <price_calculations>[enum: AUTO | MANUAL | NONE | AUTO_NONE]</price_calculations>
            <lineitem_product>
                <product uri="/products/K/" id="K"/>
                <code>[str]</code>
                <description>[str]</description>
            </lineitem_product>
            <quantity_backordered>[decimal]</quantity_backordered>
        </lineitem>
        [...]
    </lineitems>
    <billing>
        <address>
            <address1>[str]</address1>
            <address2>[str]</address>
            <city>[str]</city>
            <state>[str]</state>
            <country>[str]</country>
            <zip>[str]</zip>
        </address>
    </billing>
    <shipping>
        <address>
            <address1>[str]</address1>
            <address2>[str]</address2>
            <city>[str]</city>
            <state>[str]</state>
            <country>[str]</country>
            <zip>[str]</zip>
        </address>
    </shipping>
</invoice>

PUT /api/invoices/(d+)/

Description:

Update a specific invoice
can_lock requires_lock has_etag requires_etag
True True False False

Request:

<invoice>
    <!-- See POST /invoices/ request for details -->
</invoice>

Response:

<invoice uri="/invoices/X/" id="X">
    <!-- See GET /invoices/X/ response for details -->
</invoice>
Expected Errors:

/api/invoices/(d+)/finish/

POST /api/invoices/(d+)/finish/

Description:

Marks all line items as finished. Sets the pricing calculations to NONE.
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Response. -->

Response:

<invoice uri="/invoices/X/" id="X">
    <!-- See GET /invoices/X/ response for details -->
</invoice>

/api/invoices/(d+)/lineitems/

GET /api/invoices/(d+)/lineitems/

Description:

Return the list of lineitems of an invoice.
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No xml request -->

Response:

<lineitems>
    <lineitem uri="/invoices/X/lineitems/Y/" id="Y"/>
    [...]
</lineitems>

POST /api/invoices/(d+)/lineitems/

Description:

Add a lineitem to an invoice.
can_lock requires_lock has_etag requires_etag
False True False False

Request:

<lineitem>
    <lineitem_product>
        <product id="z"/>
        <description>[str]</description> <!-- Optional -->
    </lineitem_product>
    <!-- Optional -->
    <profit_margin>[decimal]</product_margin>
    <sell_price>[decimal]</sell_price><!-- Optional. Mutually exclusive with sells. Should only be sent when the lineitem is manually edited by the user. -->
    <sells><!-- Optional. Mutually exclusive with sell_price. Should be sent when the line has predetermined base and tax inclusive prices already.
                For example, a lineitem with externally applied taxes or a line item with a None pricing calculation. -->
        <base>[decimal]</base> <!-- Optional -->
        <sell_tax_inclusive>[decimal]</sell_tax_inclusive> <!-- Optional -->
        <sell_quantity_discount>[decimal]</sell_quantity_discount> <!-- Optional -->
        <sell_tax_inclusive_quantity_discount>[decimal]</sell_tax_inclusive_quantity_discount> <!-- Optional -->
    </sells>
    <pricing_level index="[int]"> <!-- Optional, an empty 'pricing_level' element indicates no pricing level -->
        <name>[str]</name> <!-- Optional -->
    </pricing_level>
    <discount> <!-- Optional -->
        <percent>[decimal]</percent> <!-- Mutually exclusive with value, tax_exclusive_value, tax_inclusive_value -->
        <value>[decimal]</value> <!-- Mutually exclusive with percent, tax_exclusive_value, tax_inclusive_value. Treated as tax_exclusive or tax_inclusive based on the doc's setting -->
        <tax_exclusive_value>[decimal]</tax_exclusive_value> <!-- Mutually exclusive with percent, value -->
        <tax_inclusive_value>[decimal]</tax_inclusive_value> <!-- Mutually exclusive with percent, value -->
    </discount>
    <quantity>[decimal]</quantity>
    <quantity_discount>[bool]</quantity_discount><!-- Optional. Works with sells/..quantity_discount fields -->
    <quantity_backordered>[decimal]</quantity_backordered>
    <price_calculations>[enum: AUTO | MANUAL | NONE | AUTO_NONE]</price_calculations>
    <!-- Defaults to AUTO. AUTO indicates pricing is calculated using the latest values from the product card and any associated discounts or sales.
    MANUAL indicates that a user entered price has been set and no price calculations are to be performed.
    NONE indicates that no price calculations are to be performed.
    AUTO_NONE indicates that pricing should be calculated, but the resulting price calculation state is NONE (i.e. no more recalculations on future edits).  -->
    <serial_numbers>
        <serial_number id="[str]"/>
        [...]
    </serial_numbers>
    <taxes>
        <tax id="1"><!-- Always 5 tax elements with ids 1-5 -->
            <exempt>[bool]</exempt>
        </tax>
        [...]
    </taxes>
</lineitem>

Response:

<response>
    <lineitem uri="/invoices/X/lineitems/Y/" id="Y">
        <!-- See GET /invoices/X/lineitems/Y/ response for details -->
    </lineitem>
    <invoice uri="/invoices/X/" id="X" full_render="true">
        <!-- See GET /invoices/X/ response for details -->
    </invoice>
    <gift_cards> <!-- If any new gift cards are generated -->
        <gift_card uri="/gift_cards/Z/" id="Z" full_render="false"/>
        [...]
    </gift_cards>
</response>
Expected Errors:

/api/invoices/(d+)/lineitems/(d+)/

GET /api/invoices/(d+)/lineitems/(d+)/

Description:

Return a specific lineitems of an invoice.
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No xml request -->

Response:

<lineitem uri="/invoices/A/lineitems/B/" id="B">
    <cost edited="[bool]" total="[decimal]">[decimal]</cost>
    <discount>
        <percent>[decimal]</percent> <!-- This will naturally be Null if there're values in the other 3 fields. -->
        <value>[decimal]</value> <!-- Will be tax_exclusive or tax_inclusive based on the doc's setting -->
        <tax_exclusive_value>[decimal]</tax_exclusive_value>
        <tax_inclusive_value>[decimal]</tax_inclusive_value>
    </discount>
    <pricing_level index="[int]">
        <name>[str]</name>
    </pricing_level>
    <profit_margin minimum="[decimal]">[decimal]</profit_margin>
    <quantity>[decimal]</quantity>
    <quantity_discount>[bool]</quantity_discount>
    <sell_price>[decimal]</sell_price> <!-- the sell price (including or excluding taxes, depending on the tax-inclusion mode) -->
    <sells>
        <sell>[decimal]</sell> <!-- sell price of item, excluding taxes -->
        <base>[decimal]</base> <!-- base sell price of item, excluding taxes -->
        <total>[decimal]</total> <!-- total sell price of specified quantity of item, excluding taxes -->
        <sell_quantity_discount>[decimal]</sell_quantity_discount> <!-- sell price of item accounting for quantity discounts (excluding taxes) -->
        <sell_tax_inclusive>[decimal]</sell_tax_inclusive> <!-- sell price of item, including taxes -->
        <sell_tax_inclusive_quantity_discount>[decimal]</sell_tax_inclusive_quantity_discount> <!-- sell quantity discount including taxes -->
        <sell_tax_inclusive_total>[decimal]</sell_tax_inclusive_total> <!-- total sell price of specified quantity of item, including taxes -->
        <sell_tax_inclusive_discounted>[decimal]</sell_tax_inclusive_discounted> <!-- sell price of item including both taxes and discounts -->
    </sells>
    <editable>[bool]</editable>
    <manual>[boolean]</manual> <!-- DEPRECATED, use price_calculations. User manually made a change to prevent sale offer pricing-->
    <price_calculations>[enum: AUTO | MANUAL | NONE | AUTO_NONE]</price_calculations>
    <!-- Defaults to AUTO. AUTO indicates pricing is calculated using the latest values from the product card and any associated discounts or sales.
    MANUAL indicates that a user entered price has been set and no price calculations are to be performed.
    NONE indicates that no price calculations are to be performed.
    AUTO_NONE indicates that pricing should be calculated, but the resulting price calculation state is NONE (i.e. no more recalculations on future edits).  -->
    <lineitem_product>
        <product uri="/products/C/" id="C" full_render="true">
            <!-- See GET /products/X/ for details -->
        </product>
        <code>[str]</code>
        <family[str]</family>
        <description>[str]</description>
        <class_name>[str]</class_name>
        <current>[bool]</current>
        <editable>[bool]</editable>
        <editable_sell>[bool]</editable_sell>
        <gift_card>[bool]</gift_card>
        <inventoried>[bool]</inventoried>
        <no_profit>[bool]</no_profit>
        <serialized>[bool]</serialized>
        <manufacturer_part_number>[str]</manufacturer_part_number>
        <manufacturer_pricing_option_code>[str]</manufacturer_pricing_option_code>
    </lineitem_product>
    <tax_exemption uri="/setup/tax_exemptions/X/" id="X"/>
    <taxes>
        <tax id="1"><!-- Always 5 tax elements with ids 1-5 -->
            <exempt>[bool]</exempt>
            <total>[decimal]</total>
        </tax>
        [...]
    </taxes>
    <quantity_backordered>[decimal]<quantity_backordered/>
    <ext_status>[string]</ext_status>
    <serial_numbers>
        <serial_number id='[int]'>[str]</serial_number>
        [...]
    <serial_numbers>
</lineitem>

/api/invoices/(d+)/payments/

GET /api/invoices/(d+)/payments/

Description:

Return a list of payments for an invoice.
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request -->

Response:

<payments>
    <payment uri="/invoices/X/payments/Y/" id="Y"/>
    [...]
</payments>

/api/invoices/(d+)/payments/(d+)/

GET /api/invoices/(d+)/payments/(d+)/

Description:

Returns the details of an invoice payment.
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request -->

Response:

<payment uri="/invoices/A/payments/B/" id="B">
    <type>[enum: Cash | Gift Card | Debit Card | Credit Card | Credit Card Manual |  Debit Card Manual | Store Card | Cheque | Loan | Lease | Web Payment | Manual | Credit | Rounding]</type>
    <payment_method>[str]</payment_method>
    <datetime_created>[datetime]</datetime_created>
    <datetime_modified>[datetime]</datetime_modified>
    <exported>[datetime]</exported>
    <posted>[datetime]<posted>
    <flags>
        <exported>[bool]</exported>
        <posted>[bool]</posted>
        <voided>[bool]</voided>
    </flags>
    <number>[str]</number><!-- The number associated to this transaction. Generally this is the ref id from the processor -->
    <source id="[str]"/>
    <amount>[decimal]</amount>
    <tendered>[decimal]</tendered>
    <authcode>[str]</authcode>
    <avs_result>[str]</avs_result>
    <till uri="/api/tills/C/" id="C"/>
    <signature_photo uri="/invoices/A/payments/B/signature_photo/"/>
</payment>