where to call onPlanPurchased( ) method after it is in events.js or does it gets automatically called???

My idea is to make a wallet collection in database which I will create manually through wix velo code. After a pricing plan is purchased by the user where to do I call onPlanPurchased( ) method to add the amount in the wallet

import wixData from 'wix-data';

export function wixPaidPlans_onPlanPurchased(event) {
  if (event.order.price.amount === 0) {
     let orderData = {
       "title": "Free plan purchased",
       "data": event.order
     };
     wixData.insert("planEvents", orderData);
  } else {
     let orderData = {
       "title": "Regular plan purchased",
       "data": event.order
     };
     wixData.insert("planEvents", orderData); 
  }
}

The event handler onPlanPurchased() is not called. As the documentation states that is: " An event that fires when a user purchases a plan. "

=> Note that the wix-paid-plans-backend module has been deprecated and will continue to work. A newer version is available at wix-pricing-plans and wix-pricing-plans-backend .