For some reason I can not get wixPaidPlans_onPlanPurchased(event) to trigger in the backend events.js file.
import wixData from 'wix-data';
export function wixPaidPlans_onPlanPurchased(event) {
console.log("purchased reoccuring");
let paymentNET = ((event.payment.amount * 0.971) - 0.30).toFixed(2);
let paymentDetails = {
'paymentID': event.order.id,
'paymentAmount': event.order.price.amount,
'paymentNET': paymentNET,
'paymentItems': event.order.planName,
'transactionStatus': event.order.paymentStatus,
'transactionId': event.order.wixPayOrderId,
'data': event.order
};
wixData.insert("Payments", paymentDetails)
.then((results) => {
console.log("inserting into transactions database");
let item = results; //see item below
}).catch((err) => {
let errorMsg = err;
console.log(err);
});
}
Any ideas what is going on. At one point it was working (sort of) sometimes it would trigger. But not it is not triggering at all.
Thank you for the help.
Currently facing the same issue. Has it been resolved or am I doing something wrong. I also have an events.js file in the Backend folder which exports the same function. Any ideas ?
Thanks
Ha have the same problem, any update