Hello community! hope you are being productive during these days. I have a problem when trying to implement the function sendInvoice( ).
I can create invoices successfully at the end of my checkout flow and receive the data back from the backend with the Id and version of the invoice. I can see the created invoices in the dashboard and the returned Id and version of the invoices are correct. It only fails to send the invoice to the customer. I tried everything without luck… can anybody give me a little help with this? It will be very much appreciated
////FRONTEND CODE SNIPPET
createInvoice(currentUser, paymentItems, payments) //CREATES THE INVOICE
.then ((invoiceInfo) => { //RETURNS INVOICE ID & VERSION
let id = invoiceInfo.id.id
let version = invoiceInfo.id.version
sendInvoiceToCustomer(id,version, "Test Subject","Test Body"); ///Runs Function from backend and pass invoice data
// RETURNS ERROR
/////BACKEND FUNCTION
import wixBilling from 'wix-billing-backend';
export function sendInvoiceToCustomer(id, version, subject, body) {
let idAndVersion = {
"id": id,
"version": version
};
let emailInfo = {
"subject": subject,
"body": body
};
return wixBilling.invoices.sendInvoice(idAndVersion, emailInfo);
}