API - Planyo Web Services - list_invoices

You are here: Planyo » Help » API » list_invoices

list_invoices

Description:

Lists invoices for given reservation or invoices generated in given period. This function only works with parent&corrective invoices. In case of multiple invoices, a maximum of 50 invoices will be listed. For further items use the 'page' parameter.

Input:

reservation_id int optional
Reservation ID. Either reservation_id or start_date & end_date need to be specified
start_date DateTime optional
Start date of the period for which invoices should be returned. Note that the max span of the period is 31 days
end_date DateTime optional
End date of the period
page int optional
Zero-based page number. The default is 0. Each page lists max 50 invoices.
method string required
must be set to list_invoices
language string optional
by specifying a 2-letter (ISO 639-1) language code (all capital letters e.g. EN, DE, FR, ES, IT) you can change the language of the text values returned
api_key string required
your API key - Click here to get your key. If your API key uses a hash key, you must also include the parameters hash_key and hash_timestamp.

Output:

results array
Array whose items are named arrays containing invoice data (each item contains data about a single invoice). The keys are as follows:
reservation_id - ID of the reservation the invoice belongs to (empty when this is a coupon purchase invoice)
resource_id - ID of the reserved resource
coupon_payment_id - ID of the coupon payment, if this is a coupon purchase invoice
coupon_id - ID of the coupon
sequential_number - the sequential number of the invoice; unique for the planyo site
is_parent_invoice - 'true' for parent invoice and 'false' for corrective invoice
creation_date - the date when the invoice was generated
url - the url where the invoice can be downloaded. By default, the link returns a PDF file. You can make it return HTML code by adding the parameter '&output=html'

In case of multiple invoices, results additionally contains the ['all']['url'] element. It contains the url that allows you to download all returned invoices as PDF. By default, the url when opened in a browser shows the Download file pop-up. If you rather need to return the content directly, add the parameter &pdf_download=0 to the url. This way you can e.g. download the file directly from your server script for farther processing. You can also download the invoices as individual PDF files in a ZIP archive. In such case, add the parameter &zip=1 to the url

API playground:

Click here to test this function in the API playground.