Hook up your own application with The Machine's functionality.

invoice.edit

This method let you edit the invoice with the given id.

You call this method with the following URL:

Parameters

Parameters are the data you will pass with the call.

api_token

Your secret identifier. You find your API Token under Account Overview in the Account section.

Rules: Required

id

The ID of the invoice.

Rules: Required.

client (optional)

The ID of the client.

Rules: None.

date (optional)

The date of the invoice.

Rules: The date must be formatted as "YYYY-MM-DD".

invoice_id (optional)

The Invoice ID. Please note that the invoice_id is not the same as the id of an invoice.

Rules: None.

po (optional)

The P.O. number for the invoice.

Rules: None.

due (optional)

The number of days until the the invoice is due.

Rules: Must be a number from 1 or set to "immediately" if you want the invoice to be due immediately.

tax (optional)

If this parameter is set to "true", the invoice will use the tax rate specified in the tax_rate parameter.

Rules: If used, it must be set to "true", otherwise it will be ignored.

tax_rate (optional)

The tax rate in procent for the invoice.

Rules: Can only include numeric characters.

discount (optional)

If this parameter is set to "true", the invoice will use the discount rate specified in the discount_rate parameter.

Rules: If used, it must be set to "true", otherwise it will be ignored.

discount_rate (optional)

The discount rate in procent for the invoice.

Rules: Can only include numeric characters.

shipping (optional)

If this parameter is set to "true", the invoice will use the shipping amount specified in the shipping_amount parameter.

Rules: If used, it must be set to "true", otherwise it will be ignored.

shipping_amount (optional)

The shipping amount for the invoice.

Rules: Can only include numeric characters.

currency_symbol (optional)

The leading currency symbol.

Rules: If used, it must be set to a supported currency symbol. Otherwise it will be ignored. Please see the list of supported currency symbols.

currency_code (optional)

The trailing currency code.

Rules: If used, it must be set to a supported currency code. Otherwise it will be ignored. Please see the list of supported currency codes.

language (optional)

The language of the invoice.

Rules:If used, it must be set to a supported language. Otherwise it will be ignored. Please see the list of supported languages.

display_country (optional)

You can chose if you want the country to be visible in the address.

Rules: If used, it must be set to either "true" or "false" otherwise it will be ignored.

notes (optional)

Any invoice notes.

Rules: If you don't want to include a note at all, you can set this parameter to "none".

line[1][qty]

Qty for the line.

Rules: Can only include numeric characters. You add multiple lines by increasing the [1] number for each line.

line[1][kind]

Kind for the line.

Rules: Must be set to a supported kind. The supported kinds are "hour", "day", "service" and "product". You add multiple lines by increasing the [1] number for each line.

line[1][description]

Description for the line.

Rules: You add multiple lines by increasing the [1] number for each line.

line[1][price]

Price for the line.

Rules: Can only include numeric characters. You add multiple lines by increasing the [1] number for each line.

get (optional)

If this parameter is set the result sent back will be the edited invoice in XML data rather than the success message.

Rules: If parameter is used it must be set to "true". Otherwise it will be ignored.

Return Values

This is the result that will be passed back to you when you have sent a call.

Success

Success: Invoice edited.

The invoice was successfully edited.

If you have set the get parameter to "true" you will rather get the edited invoice in XML sent back to you. Like this:

<?xml version="1.0" encoding="utf-8"?>
<request method="invoice.get">
    <invoice>
        <id>205092</id>
        <status>Paid</status>
        <date>15 Jan 2009</date>
        <due_date>16 Feb 2009</due_date>
        <invoice_id>0000004</invoice_id>
        <po>6549-6567</po>
        <due>30</due>
        <tax_rate>0.00</tax_rate>
        <discount_rate>0.00</discount_rate>
        <shipping_amount>0.00</shipping_amount>
        <currency_symbol>$</currency_symbol>
        <currency_code></currency_code>
        <notes>Thank you!</notes>
        <permalink>http://machine_id.invoicemachine.com/invoice/view/24192915345543</permalink>
        <download_link>http://machine_id.invoicemachine.com/invoice/download/24192915345543</download_link >
        <payment_link>http://machine_id.invoicemachine.com/invoice/payment/24192915345543</payment_link >
        <client_id>204607</client_id>
        <client_name>Sample Contact</client_name>
        <client_email>sample@invoicemachine.com</client_email>
        <client_company>Sample Company, Inc.</client_company>
        <client_address_line_01>35181 Invoice Street</client_address_line_01>
        <client_address_line_02></client_address_line_02>
        <client_city>Invoice City</client_city>
        <client_zip_code>92329</client_zip_code>
        <client_state>CA</client_state>
        <client_country>United States</client_country>
        <client_tax_id></client_tax_id>
        <your_name>Your Name</your_name>
        <your_email>your@email.com</your_email>
        <your_company>Your Company</your_company>
        <your_address_line_01>Your Address</your_address_line_01>
        <your_address_line_02></your_address_line_02>
        <your_city>Your City</your_city>
        <your_zip_code>33018</your_zip_code>
        <your_state></your_state>
        <your_country>United States</your_country>
        <your_tax_id></your_tax_id>
        <lines>
            <line>
                <qty>2</qty>
                <kind>hours</kind>
                <description>Web design</description>
                <price>120.00</price>
                <total>240.00</total>
            </line>
            <line>
                <qty>8</qty>
                <kind>hours</kind>
                <description>Web development</description>
                <price>120.00</price>
                <total>960.00</total>
            </line>
        </lines>
        <subtotal>1200.00</subtotal>
        <tax>0.00</tax>
        <discount>0.00</discount>
           <shipping>0.00</shipping>
        <total>1200.00</total>
        <paid>1200.00</paid>
        <balance_due>0.00</balance_due>	
    </invoice>
</request>
Error

Error: No data passed.

No data was passed to the method.

Error: API Token is invalid.

The API Token parameter is missing or incorrectly entered.

Error: ID is invalid.

The ID parameter is missing or incorrectly entered.

Error: Client is invalid.

The client is incorrectly entered.

Error: Date is invalid.

The Date is incorrectly entered.

Error: Due is invalid.

The Due is incorrectly entered.

Error: Tax Rate is invalid.

The Tax Rate is incorrectly entered.

Error: Discount Rate is invalid.

The Discount Rate parameter is incorrectly entered.

Error: Shipping Amount is invalid.

The Shipping Amount parameter is incorrectly entered.

Error: Currency Symbol is invalid.

The currency symbol parameter is incorrectly entered.

Error: Currency Code is invalid.

The currency code parameter is incorrectly entered.

Error: Language is invalid.

The language parameter is incorrectly entered.

Example

The example below is strictly a demonstration of the method and it's parameters. Methods should never be posted from a HTML form. They should be posted directly from your server script.

<form action="http://machine_id.invoicemachine.com/api/invoice.edit" method="post">
    <input type="hidden" name="api_token" value="c86cea54c71sbb05a5f8297bed641944">
    <input type="hidden" name="id" value="205092">
    <input type="hidden" name="po" value="6549-6567">
</form>