You can define backend event handlers in the events.js
backend file.
events.js
backend fileThe way that you add an events.js
file to the backend depends on which IDE you're using.
Add an events.js
file to the src/backend
folder.
To define an event handler in the events.js
file, export a function using a supported export syntax.
The function name should consist of the Wix module and the name of the event, separated by an underscore. You can visit the documentation to confirm the exact function naming and to see what information is passed to the event handler when it is called.
Here is an example of an event handler that triggers when an invoice is paid:
There are two ways to test your backend event handlers: