Invoice
extends DataTransferObject
in package
implements
DataModel
Invoices in FreshBooks are what gets sent to Clients, detailing specific goods or services performed or provided by the Administrator of their System, and the amount that Client owes to the Admin.
Tags
Table of Contents
Interfaces
Constants
- RESPONSE_FIELD = 'invoice'
Properties
- $accountId : string
- $accountingSystemId : string
- $address : string
- $amount : Money
- $autoBill : bool
- $autoBillStatus : string
- $city : string
- $clientId : int
- $code : string
- $country : string
- $createdAt : DateTimeImmutable
- $createDate : DateTime
- $currencyCode : string
- $currentOrganization : string
- $datePaid : DateTime
- $depositAmount : Money
- $depositPercentage : string
- $depositStatus : string
- $description : string
- $discountDescription : string
- $discountTotal : Money
- $discountValue : float
- $displayStatus : string
- $dueDate : DateTime
- $dueOffsetDays : int
- $estimateId : int
- $firstName : string
- $generationDate : DateTime
- $groundMail : bool
- $id : int
- $invoiceId : int
- $invoiceNumber : string
- $language : string
- $lastName : string
- $lastOrderStatus : string
- $lines : array<string|int, mixed>
- $notes : string
- $organization : string
- $outstanding : Money
- $ownerId : int
- $paid : Money
- $parent : int
- $paymentStatus : string
- $PONumber : string
- $presentation : InvoicePresentation
- $province : string
- $sentId : int
- $showAttachments : bool
- $status : int
- $street : string
- $street2 : string
- $terms : string
- $updated : DateTimeImmutable
- $useDefaultPresentation : bool
- $v3Status : string
- $VATName : string
- $VATNumber : string
- $visState : int
Methods
- getContent() : array<string|int, mixed>
- Get the data as an array to POST or PUT to FreshBooks, removing any read-only fields.
Constants
RESPONSE_FIELD
public
mixed
RESPONSE_FIELD
= 'invoice'
Properties
$accountId
public
string
$accountId
Get unique identifier of the account the invoice exists on.
The same as getAccountingSystemId()
.
$accountingSystemId
public
string
$accountingSystemId
Unique identifier of account the invoice exists on.
$address
public
string
$address
First line of address on invoice.
$amount
public
Money
$amount
Total amount of invoice.
Money object containing amount and currency code.
$autoBill
public
bool
$autoBill
Whether this invoice has a credit card saved.
$autoBillStatus
public
string
$autoBillStatus
Whether this invoice has a credit card saved.
Values are: failed
, retry
, success
.
$city
public
string
$city
City for address on invoice.
$clientId
public
int
$clientId
The id of the client the invoice is for.
Note: The API request/response uses customerid
rather than clientid
.
$code
public
string
$code
Postal/ZIP code for address on invoice.
$country
public
string
$country
Country for address on invoice.
$createdAt
public
DateTimeImmutable
$createdAt
The date/time the invoice was created.
Note: The API returns this data in "US/Eastern", but it is converted here to UTC.
$createDate
public
DateTime
$createDate
Date the invoice was created.
The API returns this in YYYY-MM-DD format. It is converted to a DateTime.
$currencyCode
public
string
$currencyCode
Three-letter currency code for invoice.
$currentOrganization
public
string
$currentOrganization
The current name of the client's organization.
Once an invoice is set, the organization will not reflect any changes to the client but the current organization is available.
$datePaid
public
DateTime
$datePaid
Date invoice was fully paid.
The API returns this in YYYY-MM-DD format.
$depositAmount
public
Money
$depositAmount
Amount required as deposit if required.
Money object containing amount and currency code.
$depositPercentage
public
string
$depositPercentage
Percent of the invoice's value required as a deposit.
$depositStatus
public
string
$depositStatus
Description of deposits applied to invoice.
Note: This is only writeable on creation.
Values: paid
, unpaid
, partial
, converted
, none
.
$description
public
string
$description
Description of first line of invoice
$discountDescription
public
string
$discountDescription
Client-visible note about discount.
$discountTotal
public
Money
$discountTotal
Amount discounted.
Money object containing amount and currency code.
$discountValue
public
float
$discountValue
Percent amount being discounted from the subtotal.
$displayStatus
public
string
$displayStatus
Description of status. Used primarily for the FreshBooks UI.
$dueDate
public
DateTime
$dueDate
Date invoice is marked as due by calculated from due_offset_days
.
If due_offset_days
is not set, it will default to the date of issue.
The API returns this in YYYY-MM-DD format.
$dueOffsetDays
public
int
$dueOffsetDays
Number of days from creation that invoice is due.
$estimateId
public
int
$estimateId
Id of associated estimate, 0 if none.
$firstName
public
string
$firstName
First name of client being invoiced.
$generationDate
public
DateTime
$generationDate
The date the invoice was generated from a invoice profile or null if it was not generated.
The API returns this in YYYY-MM-DD format.
$groundMail
public
bool
$groundMail
Whether invoice should be sent via ground mail.
$id
public
int
$id
The unique identifier of this invoice within this business.
$invoiceId
public
int
$invoiceId
The unique identifier of this invoice within this business.
$invoiceNumber
public
string
$invoiceNumber
The user-specified number that appears on the invoice.
$language
public
string
$language
Two-letter language code (e.g. "en", "fr")
$lastName
public
string
$lastName
Last name of client being invoiced.
$lastOrderStatus
public
string
$lastOrderStatus
Describes status of last attempted payment.
Note: This is only writeable on creation.
$lines
public
array<string|int, mixed>
$lines
Lines of the invoice.
Note: These are only returned with a invoice call using a "lines" include. TODO: code example
$notes
public
string
$notes
Notes listed on invoice.
$organization
public
string
$organization
Name of organization being invoiced.
This is the value of the organization of the client but is denormalized so that changes to the client are not reflected on past invoices.
$outstanding
public
Money
$outstanding
Amount outstanding on invoice.
Money object containing amount and currency code.
$ownerId
public
int
$ownerId
Id of creator of invoice. 1 if business admin, other if created by another user. Eg. a contractor.
$paid
public
Money
$paid
Amount paid on invoice.
Money object containing amount and currency code.
$parent
public
int
$parent
Id of object this invoice was generated from, 0 if none
$paymentStatus
public
string
$paymentStatus
Description of payment status.
One of unpaid
, partial
, paid
, and auto-paid
.
$PONumber
public
string
$PONumber
Reference number for address on invoice.
$presentation
public
InvoicePresentation
$presentation
Define invoice logo and styles.
By default, if no presentation specified in a new invoice request payload,
it will be assigned a default presentation. To override this default behaviour,
set useDefaultPresentation
to false.
Note: The presentation details are only returned with a invoice call using a "presentation" include.
$province
public
string
$province
Province/state for address on invoice.
$sentId
public
int
$sentId
User id of user who sent the invoice. Typically 1 for the business admin.
$showAttachments
public
bool
$showAttachments
Whether attachments on invoice are rendered in FreshBooks UI.
$status
public
int
$status
Set the status of the invoice.
This is only writable at creation and cannot be manually set later.
Values are:
- 0: DISPUTED. An Invoice with the Dispute option enabled, which has been disputed by a Client. This is a feature of FreshBooks Classic only and should only appear in migrated accounts.
- 1: DRAFT. An Invoice that has been created, but not yet sent.
- 2: SENT. An Invoice that has been sent to a Client or marked as sent.
- 3: VIEWED. An Invoice that has been viewed by a Client.
- 4: PAID. A fully paid Invoice.
- 5: AUTOPAID. An Invoice paid automatically with a saved credit card.
- 6: RETRY. An Invoice that would normally be paid automatically, but encountered a processing issue, either due to a bad card or a service outage. It will be retried 1 day later.
- 7: FAILED. An Invoice that was in Retry status which again encountered a processing issue when being retried.
- 8: PARTIAL. An Invoice that has been partially paid.
Tags
$street
public
string
$street
Street for address on invoice.
$street2
public
string
$street2
Second line of street for address on invoice.
$terms
public
string
$terms
Terms listed on invoice.
$updated
public
DateTimeImmutable
$updated
The time of last modification.
$useDefaultPresentation
public
bool
$useDefaultPresentation
Whether invoice should use the default presentation.
By default, if no presentation specified in new invoice request payload it will be assigned a default presentation.
To override this default behaviour, set useDefaultPresentation to false.
$v3Status
public
string
$v3Status
v3 status fields give a descriptive name to states which can be used in filters.
Note: This is only writeable on creation.
Values are:
- created: Invoice is created and in no other state
- draft: Invoice is saved in draft status
- sent: Invoice has been sent
- viewed: Invoice has been viewed by recipient
- failed: An autobill related to the invoice has been tried more than once and failed
- retry: An autobill related to the invoice has been tried once and failed, and will be retried
- success: An autobill related to the invoice has succeeded
- autopaid: A payment has been tied to the invoice automatically via autobill
- paid: Payments related to the invoice have succeeded and the object is fully paid
- partial: Some payment related to the invoice has succeeded but the invoice is not yet paid off
- disputed: The invoice is disputed
- resolved: The invoice was disputed and the dispute has been marked as resolved
- overdue: The invoice required an action at an earlier date that was not met
- deposit_partial: The invoice has a related deposit which has been partially paid
- deposit_paid: The invoice has a related deposit which has been fully paid
- declined: The invoice has a related order which has been declined
- pending: The invoice has a related order which is pending
Tags
$VATName
public
string
$VATName
Value Added Tax name of client if provided.
$VATNumber
public
string
$VATNumber
Value Added Tax number of client.
$visState
public
int
$visState
The visibility state: active, deleted, or archived
Methods
getContent()
Get the data as an array to POST or PUT to FreshBooks, removing any read-only fields.
public
getContent() : array<string|int, mixed>