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 {invoices} from 'wix-billing-backend';
2
3export function sendInvoiceToCustomer(id, version, subject, body) {
4 const idAndVersion = {
5 "id": id,
6 "version": version
7 };
8
9 const emailInfo = {
10 "subject": subject,
11 "body": body
12 };
13
14 return invoices.sendInvoice(idAndVersion, emailInfo);
15}
Get the invoice version and send the invoice to a customer

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