Search.../

voidInvoice( )

Voids an invoice.

Description

The voidInvoice() function returns a Promise that resolves when the invoice with the specified ID is voided.

Calling voidInvoice() on a draft invoice causes an error.

Syntax

function voidInvoice(id: IdAndVersion): Promise<void>

voidInvoice Parameters

NAME
TYPE
DESCRIPTION
id
IdAndVersion

ID and version of the invoice to void.

Returns

Fulfilled - When the specified invoice is voided.

Return Type:

Promise<void>

Was this helpful?

Void invoice

Copy Code
1import {invoices} from 'wix-billing-backend';
2
3export function voidInvoice(id) {
4 return invoices.getInvoice(id)
5 .then( (result) => {
6 return invoices.voidInvoice(result.id);
7 } );
8}
Get the invoice version and void the invoice

Copy Code
1import {invoices} from 'wix-billing-backend';
2
3export function voidInvoice(id, version) {
4 const idAndVersion = {
5 "id": id,
6 "version": version
7 };
8
9 return invoices.getInvoice(id)
10 .then( (result) => {
11 return invoices.voidInvoice(idAndVersion);
12 } );
13}