Search.../

sendInvoice( )

Sends an invoice preview link to a customer via email.

Description

The sendInvoice() function returns a Promise that resolves when the invoice with the specified ID and version is sent to the customer listed on the invoice.

Use the emailOptions parameter to specify the subject and body of the email sent to the customer.

Syntax

function sendInvoice(id: IdAndVersion, emailInfo: EmailInfo): Promise<void>

sendInvoice Parameters

NAME
TYPE
DESCRIPTION
id
IdAndVersion

ID and version of the invoice to send.

emailInfo
EmailInfo

Information used when sending the email.

Returns

Fulfilled - When the specified invoice is sent.

Return Type:

Promise<void>

Was this helpful?

Send an invoice to a customer

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { invoices } from 'wix-billing-backend';
3
4export const sendInvoiceToCustomer = webMethod(Permissions.Anyone, (id, version, subject, body) => {
5 const idAndVersion = {
6 "id": id,
7 "version": version
8 };
9
10 const emailInfo = {
11 "subject": subject,
12 "body": body
13 };
14
15 return invoices.sendInvoice(idAndVersion, emailInfo);
16});
Get the invoice version and send the invoice to a customer

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { invoices } from 'wix-billing-backend';
3
4export const sendInvoiceToCustomer = webMethod(Permissions.Anyone, (id, subject, body) => {
5 const emailInfo = {
6 "subject": subject,
7 "body": body
8 };
9
10 return invoices.getInvoice(id)
11 .then( (result) => {
12 return invoices.sendInvoice(result.id, emailInfo);
13 } );
14});