getInvoice( )
Gets an existing invoice by ID.
Description
The getInvoice()
function returns a Promise that resolves to the invoice
with the specified ID.
Syntax
function getInvoice(id: string): Promise<Invoice>
getInvoice Parameters
NAME
TYPE
DESCRIPTION
ID of the invoice to get.
Returns
Fulfilled - The invoice with the given ID.
Return Type:
NAME
TYPE
DESCRIPTION
ID and version of the invoice.
Status of the invoice. One of:
"Draft"
"Sent"
"Processing"
"Paid"
"Overdue"
"Void"
"Deleted"
"PartiallyPaid"
"PartialAndOverdue"
Number of the invoice, unique within your site.
Title of the invoice.
Currency code.
Locale information.
Customer listed on the invoice.
Line items listed on the invoice.
Discount included in the invoice.
List of payments already received from the customer.
List of taxes calculated based on the line items.
Total values.
Invoice dynamic totals.
Additional metadata included in the invoice.
Invoice company ID.
Whether the invoice was sent to the customer.
Dates associated with the invoice.
Was this helpful?
Get invoice by ID
1import { Permissions, webMethod } from 'wix-web-module';2import { invoices } from 'wix-billing-backend';34export const getInvoice = webMethod(Permissions.Anyone, (id) => {5 return invoices.getInvoice(id);6});78/* Promise resolves to:9 *10 * {11 * "id":{12 * "id": "411a5551-b0f6-4826-8a41-ebae2879f857",13 * "version": 2514 * },15 * "status": "Draft",16 * "number": "0000001",17 * "title": "My Invoice",18 * "currency": "USD",19 * "customer": {20 * "contactId": "4f7c6637-0657-4696-a00b-9bc2ae4e035d",21 * "email": "john.doe@somedomain.com",22 * "address": {23 * "country": "USA",24 * "subdivision": "NY",25 * "city": "New York",26 * "postalCode": "10011",27 * "streetAddress": {28 * "value": "235 W 23rd St",29 * "type": "Name"30 * },31 * "addressLine": "someStreet",32 * "formatted": "235 W 23rd St, New York, NY 10011, USA"33 * },34 * "billingAddress": {35 * "country": "USA",36 * "streetAddress": {37 * "value": "235 W 23rd St",38 * "type": "Name"39 * },40 * "addressLine": "235 W 23rd St, New York, NY 10011, USA",41 * "postalCode": "10011",42 * "subdivision": "NY",43 * "city": "New York",44 * "formatted": "235 W 23rd St, New York, NY 10011, USA"45 * },46 * "shippingAddress": {47 * "country": "USA",48 * "streetAddress": {49 * "value": "235 W 23rd St",50 * "type": "Name"51 * },52 * "addressLine": "235 W 23rd St, New York, NY 10011, USA",53 * "postalCode": "10011",54 * "subdivision": "NY",55 * "city": "New York",56 * "formatted": "235 W 23rd St, New York, NY 10011, USA"57 * },58 * "phone": "5555555555",59 * "company": "Some Company",60 * "companyId": "Some Company Id",61 * "fullName": "John Doe",62 * "firstName": "John",63 * "lastName": "Doe"64 * },65 * "dates": {66 * "issueDate": 2019-03-13T00:00:00.000Z,67 * "dueDate": 2019-06-12T00:00:00.000Z,68 * "lastSeenDate": 2019-03-14T00:00:00.000Z69 * },70 * "discount": {71 * "value": 2.5,72 * "type": "Fixed"73 * },74 * "lineItems":[75 * {76 * "id": "00001",77 * "name": "Item 1",78 * "description": "First Item",79 * "price": 10.5,80 * "quantity": 3,81 * "taxes": [82 * {83 * "name": "tax name",84 * "rate": 8.5,85 * "code": "tax code"86 * }87 * ]88 * },89 * {90 * "id": "00002",91 * "name": "Item 2",92 * "description": "Second Item",93 * "price": 50,94 * "quantity": 1,95 * "taxes": [96 * {97 * "name": "tax name",98 * "rate": 8.5,99 * "code": "tax code"100 * }101 * ]102 * }103 * ],104 * "locale": {105 * "language": "en"106 * },107 * "payments": [{108 * "id": "4j9q4o00-4205-8q83-003d-3ofd9d8wmf0w",109 * "type": "offline",110 * "amount": "25.50",111 * "date": 2019-03-23T00:00:00.000Z"112 * }],113 * "totals": {114 * "discountAmount": null,115 * "taxedAmount": 6.93,116 * "fees": [],117 * "subtotal": 81.5,118 * "total": 88.43119 * },120 * "dynamicTotals": {121 * "paidAmount": 25.50,122 * "balance": 62.39123 * },124 * "taxes": [125 * {126 * "name": "tax name",127 * "rate": 8.5,128 * "taxable": 81.5,129 * "taxed": 6.93,130 * "code": "tax code"131 * }132 * ],133 * "metadata": {134 * "notes": "Some note",135 * "legalTerms": "Some legal terms",136 * "sourceUrl": "http://legalurl.com",137 * "source": "Some source",138 * "sourceRefId": "Some source ref id"139 * },140 * "companyId": "Some company id",141 * "wasSent": true142 * }143 */