Question:
why am I not seeing any fired events.js wix_ecom events?
Product:
Velo
What are you trying to achieve:
Hi,
unfortunately i’ve tried EVERYTHING in this thread and failed.
im simply trying to get a single console.log to see if i can trigger a backend event.
my main goal is to add an order to “orders” collection (i’ve created it manually with extra columns i need) when the order is paid.
but im so much behind it.
I can’t see any backend event logs.
I cant open properties panel on “events.js”
im using new eCom api.
I have the exact same issue with wix-pay-backend. It never fires when a payment status updates. Already have a ticket with wix but its been back and forth and they only send at most 1 message a day. Hope someone has an answer!
Other events, such as a new member created works fine but not this:
export async function wixPay_onPaymentUpdate(event) {
let paymentId = event.payment.id;
let newTransactionStatus = event.status;
console.log("Payment Made")
// Check if the payment was successful
if (newTransactionStatus === "Successful") {
let purchased = event.payment.items[0].name; // or use a unique identifier for the plan
await updateCredits(purchased)
}
}
All these functions work perfect in Functional Testing
After a week of back and forth with wix support i got a message this morning saying that it was fixed, but it still does not trigger.
Since I only sell like 15 different things (different numbers or credits to use my site) I turned everything into a Pricing Plan with 1-time payments. Then, next time they try to use any credits I first check in the backend whether they made a purchase since the last time they bought credits, if so I update a collection that stores their credits with the recent purchase.
This only works if you are selling access to certain parts of your site (ie, when they try to access first check whether they have made a purchase in the backend), but if you are trying to send custom emails or needing code to run immediately on a purchase then you’ll need something else.
When the code I’m trying to run wasn’t doing anything, I tried the following minimalist approach, and nothing is being written to Logging Tools → Wix Logs:
// File: backend/events.js
export function wixStores_onCartCreated(event) {
console.log(“*** onCartCreated test ***”);
console.log(“Event data:”, JSON.stringify(event, null, 2));
}
UPDATE - I discovered that there was a September 2024 update to the API, so I’ve tried another test using newer code and I’m still not getting anything in the logs:
import { Events } from ‘wix-ecom-backend’;
Events.onCartCreated((event) => {
console.log(“*** Minimal new API onCartCreated (listener) ***”);
console.log(“Event data:”, JSON.stringify(event, null, 2));
});