Trying to delete an invoice that was created and I get an error Member[id] is not related to the invoice.
using WixEditor
Trying to use APIs to delete/ void an invoice after it’s creation.
import { Permissions, webMethod } from "wix-web-module";
import { invoices } from 'wix-billing-backend';
export const deleteInvoice= webMethod(Permissions.Anyone, (invoiceId) => {
try {
return invoices.getInvoice(invoiceId).then((result) => {
return invoices.deleteInvoice(result.id);
});
} catch (err) {
console.error("deleteInvoiceById error:", err);
throw err;
}
});