Voids an invoice.
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.
function voidInvoice(id: IdAndVersion): Promise<void>;
ID and version of the invoice to void.
import { Permissions, webMethod } from "wix-web-module";
import { invoices } from "wix-billing-backend";
export const voidInvoice = webMethod(Permissions.Anyone, (id) => {
return invoices.getInvoice(id).then((result) => {
return invoices.voidInvoice(result.id);
});
});
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.