List invoices
Lists on or more invoices for the authenticated/specified user.
Request
HTTP GET to /invoices
Parameters
Name | Required | Value | Description | Data type | Default |
---|---|---|---|---|---|
id | No | /invoices/32 | Invoice ID | ID |
|
number | No | number=1254 | Invoice number without prefix | String |
|
companyid | No (Yes*) | companyid=1 | Retrieves invoices belonging to the user for the specified company. | ID | The owning company of the business unit for the logged on/specified user |
state | No | state=1 | Retrieves invoices for specified user and status | Integer | See status below |
productids | No | productids=1,2,3 | All invoices containing any of the specified products | ID-list |
* Requried if ID is specified
Example:
APIURL/invoices.xml?apikey=338934897438&state=6
Response
Tag | Data type | Example | Description |
---|---|---|---|
invoices |
| <invoices> | root-tag that encloses all invoices |
invoice |
| <invoice> | Invoice |
id | ID | <id>1044</id> | Unique ID |
number | String | <number>796</number> | Invoice number |
prefix | String | <prefix>F</prefix> | Invoice number prefix |
orderedby | String | Acme INC., Homer Simpson | Invoice recipient |
orderedbycustomerid | ID | <orderedbycustomerid>23</orderedbycustomerid> | personID for the customer |
totalamount | Integer | 99900 | The totalt amount of the invoice in cents/ören |
rest | Integer | 50000 | The remaining amount yet to be paid in cents/ören |
invoicedate | Date | 2015-01-01 | Invoice date |
duedate | Date | 2015-01-31 | Due date |
payeddate | Date | 2015-01-28 | Date of final payment |
state |
|
| Status, see below |
number | Integer | <number>2</number> | Status, see below |
value | String | <value>Pending</value> | Reported status, see below |
reminderamount | Integer | <reminderamount>2500</reminderamount> | Reminder fee in cents/ören |
company |
| <company><id>1</id><name>Acme INC.</name></company> | The invoicing company |
<invoices> <invoice> <id>1044</id> <number>796</number> <prefix>F</prefix> <orderedby>Homer Simpson</orderedby> <orderedbycustomerid>23</orderedbycustomerid> <totalamount>17000</totalamount> <rest>17000</rest> <invoicedate>2015-01-11</invoicedate> <duedate>2015-01-21</duedate> <payeddate/> <state> <number>2</number> <value>Pending</value> </state> <reminderamount>2500</reminderamount> <company> <id>1</id> <name>Acme INC.</name> </company> </invoice> <invoice> ... </invoice> </invoices>
Create invoice
Create an invoice for the authenticated/specified user. There are three alternatives:
- Create an invoice and set status "Not sent"
- Create an invoice and send it by e-mail
- Create an invoice and send ut by "Central print". See Invoice distribution for more information
Request
HTTP POST to /invoices
Parameters
Name | Required | Value | Description | Data type | Default |
---|---|---|---|---|---|
orderid | Yes | 66 | ID för en beställning | ID |
|
distributionmethod | No | Name of the distribution method. Valid values are "email" and "centralprint21grams" | String | ||
templateid | No (* Yes) | 55 | ID of the template to use if a distribution method is specified | ID |
|
duedate | No | 2015-01-31 | Due date | Date | Configurable in BRP with the setting invoiceDaysWeb |
* Required if "distributionmethod" is specified.
Important information about invoice distribution
- Read the Invoice distribution documentation to understand what features BRP has support for and how to get up and running with invoice distribution.
- If "distributionmethod" is not specified the invoice will automatically be set to status 1, "Not sent". See invoice status info below.
- If "distributionmethod" is specified BRP will attempt to distribute the invoice using the specified method. If successful the invoice will receive status 9, "Waiting to be sent". If unsuccessful the invoices will retain it's original status, 1, "Not sent".
- The "distributionmethod=email" requires that the customer (or other recipient) has a valid e-mail address and an ID for a specific template, "templateid". The ID can be found in BRP by selection Report templates from the Settings menu.
- The "distributionmethod=centralprint21grams" requires that the customer (or other recipient) has a valid post address.
- The invoice will be sent and managed by the scheduled activity "Invoice distribution". Once sent the status will be modified to "Sent", this is also logged on the History tab for each specific invoice. If BRP is unable to send the invoice the status will be reset to 1, "Not sent", and any error messages will also be found on the History tab for each invoice.
Example:
APIURL/invoices.xml?apikey=338934897438&orderid=66
Response
The same as "List invoices".
Status
See Invoice status for more detailed information in regards to each specific state.
The "Number" is constant. The "Value" can however vary due to locale and future development. The meaning will however not change over time. "Number=1" will always refer to an invoice this is not sent, irregardless of the contextual lable. Always use "Number" and keep your own list for the values.
Number | Value |
---|---|
1 | Not sent |
2 | Pending |
3 | Completed |
4 | Reminder |
5 | Reminder bureau |
6 | Bill collection |
7 | Sent |
8 | Exported |
9 | Waiting to be sent |