Event for when an Invoice gets Void/Canceled

Hi everyone, hope you doing well.
I’m a Wix Studio coder, and wanted to know if someone found a workaround for this:

I saw that the wix-billing-backend api does not include an event for when an invoices gets void/canceled. We got onInvoicePaid() and also onInvoiceOverdue() but not sign for the one I’m telling you.

Since we do not longer have access to the old Billing/Invoices collection managed by Wix, currently I’m storing the data I need from the onInvoicePaid() event on a collection to feed an admin dashboard.

However sometimes, there are cases where an invoice gets canceled and I have not quick way to listen for such event and flag that record on my collection. Resulting in a manual fix.

I thought I would then schedule a task that runs at everynight to check into all my invoices (from that day) and compare them to details from getInvoice(). But even though I have the Invoice ID, it tells me that my “member is not associated with such Invoice” ??

I do not know if that’s because I can only call getInvoice() for the invoices that I created through createInvoice(). If that’s so, it’s very disappointing for my case. :pensive_face:

That being said, have you overcome this scenario already ? Is there a way to actually automate this process and catch when an Invoice gets voided ?

Thx in advance,
Juan H.

Hi Juan! Sorry to hear about the difficulties, I’ve submitted feedback requesting event handlers for deleted/voided invoices.

Regarding your workaround, I’m not sure I understand the exact error you’re getting without seeing your code. One thing I’d check is to try using wixAuth.elevate with your getInvoice function (see this forum comment as an example).

Thx @emmy, you were right about wrapping the function with wixAuth.elevate stopped the error. I didn’t try it before since usually when the use of elevate is required, the docs point that.

So, can you also do a request to add that guideline on getInvoice documentation ? So new users know how to call it properly. :100:

Now I can implement a daily check on invoices, which serves as a workound until the Wix Team enables event handler for deleted/voided invoices. :clap:

Since there is no ETA for that, how I can get notified when that event handler gets added ?

1 Like

Glad it worked! I’ll pass that feedback to the documentation team. :slightly_smiling_face:

And for the feature request, you can check if it’s on the Product Roadmap. If not, you can submit a request for it. You’ll be notified if there are any updates to it!