Please HELP with wix-billing-backend (Can't find a Solution no matter what I try) --- BUG??

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 :slight_smile:

////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);

}

UPDATE:

I figured that when I am logged with the admin credentials it works. Does this means that some of the APIs are only for building a kind of dashboard? I can’t use: sendInvoice( ) and createInvoicePreviewUrl( ) when logged in the invoice creator’s credentials. However it works when Im logged in with the admin credentials.

Is this the intended behaviour for this? This would make the whole api pointless (for me). What I am trying to do:

I have a custom check out process. At the end of the process I would like to create an invoice and send it via email to the member. Does Anybody has tried this?

please help :frowning: