When a user hits a “Submit” button on the page, I want to generate an invoice and navigate the user to the invoice preview. I do this by calling a function inside of a web module.
The function executes successfully when I test in Preview mode, however, it fails when testing on the live site. I get the error: “Required permissions are missing(wix-quotes.manage)”
The web module permissions are set to “Anyone”.
I can also successfully run “wixBilling.invoices.createInvoice(createInvoiceFields)” within the web module, so it just seems that “wixBilling.invoices.createInvoicePreviewUrl(idAndVersion)” is giving me trouble. Below is a stripped down version of my larger function for the purposes of troubleshooting. Behavior is the same.
Do you have Wix Invoices app installed on your site for this to work with? invoices
The wix-billing-backend module contains functionality for working with your site’s invoices from backend code.
Hi @givemeawhiskey, thanks for the prompt response. I don’t know of any “Wix invoices app” other than the ‘wix-billing-backend’ module and the invoice features that come with any Wix account. But yes, I’m loading:
import wixBilling from 'wix-billing-backend'
To clarify, the .createInvoice() method works just fine for me. However the .createInvoicePreviewUrl() does not. My above example uses hardcoded values for the IdAndVersion object, which were returned when I created an invoice.
I’ve been troubleshooting this for several days with no luck. Even when I start fresh with nothing but that function itself, I get an error. I think it’s either a permissions problem or I’m using the module in an unintended way.