Adds a payment to the invoice and reports the payment to the payment provider.
The addPayment()
function returns a Promise that resolves
when the specified payment is added to the invoice with the specified ID.
ID and version of the invoice.
The payment that should be added to the invoice.
Creates a new invoice.
The createInvoice()
function returns a Promise that resolves to the created invoice's
ID when the invoice is created.
Note: The customer ID and email address listed on the invoice must match an existing contact in the site's contact list.
The data used to create an invoice.
Creates a link that can be used by a customer to preview the invoice.
The createInvoicePreviewUrl()
function returns a Promise that resolves
to a temporary link to a preview of the invoice with the specified ID.
You can get a list of invoices by querying your site's
"Billing/Invoices"
collection.
Each invoice in the query result contains the _id
and version
fields,
which must be used when calling createInvoicePreviewUrl()
.
By default, createInvoicePreviewUrl()
can be called by site contributors only.
To allow customers to generate the invoice preview link,
set suppressAuth
in the options
argument to true
.
Object containing the ID and version of the invoice.
An object with the following boolean property: suppressAuth.
Deletes an invoice by ID.
The deleteInvoice()
function returns a Promise that resolves
when the invoice with the specified ID is deleted.
function deleteInvoice(id: string): Promise<void>;
ID of the invoice to delete.
import { Permissions, webMethod } from "wix-web-module";
import { invoices } from "wix-billing-backend";
export const deleteInvoice = webMethod(Permissions.Anyone, (id) => {
return invoices.deleteInvoice(id);
});