Not being called => wixPricingPlans_onOrderPurchased

I have a PricingPlan in place and would want to perform some action when the Plan is purchased.

In the events.js file I have the following code:

export function wixPricingPlans_onOrderPurchased(event) {
  console.log('wixPricingPlans_onOrderPurchased')
}

export function wixPricingPlans_onOrderStarted(event) {
  console.log('wixPricingPlans_onOrderStarted')
}

export function wixPricingPlans_onPlanPurchased(event) {
  console.log('wixPricingPlans_onPlanPurchased')
}

Unfortunately None are being called…

However when I manually create a button and call

wixPayBackend.createPayment

following event is fired

export function wixPay_onPaymentUpdate(event) {

The question is;; are the events only called when I explicitly call the PricingPlan purchase API — or should it be called by default anyways…

Any suggestion how to get the event working?

Hello. If you read through the i ntroduction in the API docs , tehre is information about the lifecycle of an order which should help you understand under which circumstances different events will be triggered

I’m also having issues with creating backend event handlers right now. I successfully got them working in the past. But somehow newly created backend handlers are NOT* fired at the moment. Even the sample code from backend/events.js is not working on a published site.

// This is from the sample code in backend/events.js. It is not firing on a published website when an image is uploaded.

export function wixMediaManager_onFileUploaded(event) {
console.log(‘The file "’ + event.fileInfo.fileName + ‘" was uploaded to the Media Manager’);
}

If you believe you are experiencing a bug, please start a ticket with customer care. This forum is a community forum place for devs to help each other with code. fwiw I am having no current issues with events.js on my sites so could be something else in your case.

I’ve submitted a ticket, but was told to go to the forum. I have a website with existing backend event handlers in events.js working just fine. If I try to create a new event handler, it is not being fired. Can you kindly create a new site, add a backend event handler (any handler), publish the website, and check if it’s working for you? Thank you!

Hi Amanda, can you read my post again… Doesn’t it look coming from the API docs?

Have already gone through it; multiple times; the issue is - it’s not working as it’s written in the Docs…

Further annoying things — I created an automation to call a webhook when pricing plan order is purchased.

And surprisingly that is also not being called…

Hey Mustafa, I’m sorry that it is not working. If you believe it to be a bug at this point you will want to submit a report to customer care so the issue can be raised with the appropriate team. Customer care is not active in this forum as it is intended as a community space for folks to help each other with code.

How to report a bug

Hi Mustafa,

Just letting you know that the event handlers are working for me again after publishing the site. I am using the following event handlers:

wixEvents_onEventCreated
wixEvents_onEventDeleted
wixEvents_onEventUpdated

I have the same issue with onNewOrder! Has anyone figured out a fix yet?