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';34export const sendInvoiceToCustomer = webMethod(Permissions.Anyone, (id, version, subject, body) => {5 const idAndVersion = {6 "id": id,7 "version": version8 };910 const emailInfo = {11 "subject": subject,12 "body": body13 };1415 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';34export const sendInvoiceToCustomer = webMethod(Permissions.Anyone, (id, subject, body) => {5 const emailInfo = {6 "subject": subject,7 "body": body8 };910 return invoices.getInvoice(id)11 .then( (result) => {12 return invoices.sendInvoice(result.id, emailInfo);13 } );14});