User Tools

Site Tools


developers:api:invoice

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
developers:api:invoice [2014/10/16 13:06]
Jaco van Wyk created
developers:api:invoice [2016/05/26 14:34]
Jaco van Wyk
Line 1: Line 1:
 ====== Invoices ====== ====== Invoices ======
  
 +===== /​v1/​client/​id/​add_invoice =====
 +
 +Add an invoice for a client. The example adds an invoice with two items.
 +
 +<code php>
 +    $ curl -u user:pass -d "​date=2013-01-07"​ \
 +    >   -d "​description[0]=rolls&​unit_cost[0]=1.12&​quantity[0]=13"​ \
 +    >   -d "​description[1]=chips&​unit_cost[1]=20&​quantity[1]=1"​ \
 +    >   ​https://​api.snapbill.com/​v1/​client/​158958/​add_invoice.json
 +</​code>​
 +
 +<source examples/​invoice.txt-1.json>​
 +
 +==== Add Invoice Parameters ====
 +
 +^Name ^Availability ^Description^
 +|type |add |The type of invoice to generate. The default is invoice. You can specify either quote, invoice or credit.|
 +|state |add |The state of the invoice. The default is unpaid. You can specify either draft, unpaid, quote or credit.|
 +|date |add |The due date shown on the invoice. This field is required.|
 +|discount |add |A percentage discount to apply to the invoice. This field is not required.
 +|po_number |add |An optional purchase number to show for the invoice. This field is not required.|
 +|description[] |add |A description for an invoice item|
 +|unit_cost[] |add |The cost for a unit of an invoice item|
 +|quantity[] |add |The amount of units of an invoice item|
 +
 +The invoice items can be repeated (description,​ unit_cost, quantity). The first description matches up with the first unit_cost and quantity. Similarly for the 2nd description,​ etc.
 +
 +===== /​v1/​client/​id/​add_recurring_invoice =====
 +
 +Add a recurring invoice to the client.
 +
 +===== /​v1/​client/​id/​generate_invoice =====
 +
 +Generate a single invoice for a given client
 +
 +<code php>
 +    $ curl -u user:pass -d ""​ \
 +    >      https://​api.snapbill.com/​v1/​client/​158958/​generate_invoice.json
 +</​code>​
 +
 +<source examples/​invoice.txt-2.json>​
 +
 +===== /​v1/​invoice/​id/​get =====
 +
 +<code php>
 +    $ curl -u user:pass -d ""​ \
 +    >      https://​api.snapbill.com/​v1/​invoice/​1055387/​get.json
 +</​code>​
 +
 +<source examples/​invoice.txt-3.json>​
 +
 +===== /​v1/​invoice/​id/​pdf =====
 +
 +Retrieve the invoice rendered as a PDF.
 +
 +===== /​v1/​invoice/​id/​html =====
 +
 +Retrieve the invoice rendered in HTML.
 +
 +==== Parameter listing ====
 +
 +^Name ^Availability ^^Description^
 +|depth | |get |The depth parameter signals the amount of data for the invoice that was provided. depth=0 is the highest level that provides full detail.|
 +|id | |get |The id of the invoice in the system. This is guaranteed to be unique only over a single account.|
 +|xid | |get |The xid of the invoice in the system. This is guaranteed to be unique over all accounts.|
 +|created | |get |The date at which the invoice was created. In the format YYYY-MM-DD HH:MM:SS.|
 +|type |add |get |The type of invoice object. Either "​invoice",​ "​quote",​ "​credit"​ (Credit Note) or "​debit"​ (Debit Note).|
 +|state | |get |The current state of the invoice|
 +|date | |get |The date listed on the invoice. This is usually the same as the created date, however it is different when invoices are generated ahead of time. e.g. Created:​February 23rd, Date: March 1st, Due Date: March 15th.|
 +|due_date | |get |The date at which the invoice is due.|
 +|name | |get |A neatly formatted name for the invoice, including both its state and number.|
 +|number | |get |The unique (per account) number of the invoice. This is not strictly digits only, for example "​INV002/​15"​ is valid.|
 +|po_number |add |get |An optional purchase number to show for the invoice.|
 +|currency | |get |A currency object the invoice was charged in.|
 +|subtotal | |get |The subtotal listed on the invoice (pre-tax+discount) as a string.|
 +|subtotal_cents | |get |The subtotal given as an integer number of cents.|
 +|taxes | |get |An array of different taxes applied to the invoice|
 +|↳ name | |get |A short name for the given tax|
 +|↳ percent | |get |The percentage applied for this tax|
 +|↳ operation | |get |Either "​add"​ or "​subtract"​ indicating whether how the tax affects the total.|
 +|discount |add |get |A string indicating the discount that was applied on the invoice|
 +|total | |get |The total value of the invoice after discounts/​tax as a string.|
 +|total_cents | |get |The total value as an integer number of cents.|
 +|lines | |get |An array of all the invoice lines|
 +|↳ id | |get |The id of the invoice line (unique per account)|
 +|↳ xid | |get |The xid of the line in the system. This is guaranteed to be unique over all accounts.|
 +|↳ item_name | |get |The item name for the line.|
 +|↳ description |add |get |The description displayed on the invoice|
 +|↳ unit_cost |add |get |The cost per unit of the line as a string|
 +|↳ unit_cost_cents | |get |The cost per unit of the line as an integer number of cents.|
 +|↳ quantity |add |get |The quantity for the invoice line|
 +|↳ total | |get |The total of the given line (tax included) as a string|
 +|↳ total_cents | |get |The total as an integer number of cents|
 +|↳ package | |get |If the line is linked to a service, the package of that service at the time of generating the invoice.|
 +|↳ term | |get |If the line is linked to a service, the term of that service at the time of generating the invoice (or null for setup charges).|
 +|client | |get |A client object that the invoice was generated for.|
 +
 +===== /​v1/​invoice/​list =====
 +
 +List all the invoices associated with this account.
 +
 +Results can optionally be filtered by the filters listed below.
 +
 +<code php>
 +    $ curl -u user:pass -d "​perpage=2"​ \
 +    >      https://​api.snapbill.com/​v1/​invoice/​list.json
 +</​code>​
 +
 +<source examples/​invoice.txt-4.json>​
 +
 +==== List Invoices Filters ====
 +
 +^Name ^Availability ^Description^
 +|client_id |get |The id of the clients.|
 +|page |get |The page of results to return.|
 +|perpage |get |The number of results per page to return.|
developers/api/invoice.txt · Last modified: 2016/05/26 14:34 by Jaco van Wyk