Wix Invoice APIs

Question:
I’m creating an invoice using the wix billing API and it is being created successfully but not getting the invoice in return when calling the getInvoice API. In fact, getting an error saying EntityNotFound. Plus there is no new data inserted in the billing database, it is empty. Either we create the Invoice using API or directly from the dashboard, the billing database is always empty even though the onInvoiceCreated event is working.

Product:
WIX

What are you trying to achieve:
I want to create invoice, get invoice, delete invoice, update invoice. All these using the velo APIs

1 Like

Hi Dylan,

Thanks for bringing this issue to our attention and providing the steps to reproduce it.

I’ve escalated it internally and will update you as soon as I have more information leading to a solution.

Hello Thomas,

Glad to hear from you.
It would be a great help if I could get this issue sorted out asap.

Looking forward to a response from your end.

Thanks

1 Like

Hello Thomas,
I still haven’t got any response from the Wix team. My problem still hasn’t been solved.
It’s been almost a week now.

Hope to hear from you soon.

Thank you

getting the same error

Hello,

I just wanted to followup on this thread to see if there was any resolution to our issue. It would be great to have a positive update as my project has faced a serious timeline delay. Please let me know if we are close to finding a solution.

Thank you

Hi again! I am happy to provide an update about the Wix Invoice APIs.

Invoice functions from the wix-billing-backend API require wixAuth.elevate() in order to work.

Here is an example implementation:


import * as wixAuth from 'wix-auth';
import {invoices} from 'wix-billing-backend';

export function getInvoice(id){
  const elevatedGetInvoice = wixAuth.elevate(invoices.getInvoice)
  return elevatedGetInvoice(id);
}

Let me know if this solves your issue!

Additionally, please note that Wix CMS Billing Collections have been temporarily removed from CMS in both the Editor and Site Dashboard. In the meantime, the Wix Billing Backend API should suit your needs.

Thank you for letting us know about this issue as we seek to actively improve our documentation to reflect changes in our APIs.

2 Likes

The suggested solution works. Thank you.

1 Like

EDIT: Solved. createInvoice() does not require wixAuth.elevate() to work. There was something wrong with the date variables.

How do I combine wixAuth.elevate() with createInvoice()?
Specifically I am not able to integrate the variable createInvoiceFields) into the row with wixAuth.elevate.
When I run the function in the backend I get: [backend/invoice.jsw, createInvoice] returned with undefined

export function createInvoice() {
let createInvoiceFields = {
“title”: “My Invoice”,
“customer”: customer,
“currency”: “USD”,
“lineItems”: lineItems,
“payments”: payments,
“dates”: dates
};
//This cannot work:
const elevatedCreateInvoice = wixAuth.elevate(invoices.createInvoice)
const createInvoice = invoices.createInvoice(createInvoiceFields)

return elevatedCreateInvoice
}

(Wix Editor)

Any idea when the collection will be available again - the above solution doesn’ work for me as I need to access all Invoices for export purposes.

1 Like

Is there any way to get all invoices currently. I need a way to export all invoices itemized to accounting