Events.js all "wixEcom" events are NOT FIRING

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.

im frustrated of all the trials to solve it.

please assist.

What have you already tried:

Additional information:

here is the current Code:

export function wixEcom_onCheckoutCompleted(event) {

  const checkoutSubtotal = event.entity.subtotal.amount;

  const checkoutId = event.entity._id;

  const checkoutComplete = event.entity.completed;

  const eventId = event.metadata.id;

  console.log('Checkout completed', event)

}

export function wixEcom_onOrderUpdated(event) {

  const orderId = event.data.order._id;

  const orderTotalPrice = event.data.order.priceSummary.totalPrice.amount;

  const eventId = event.metadata.id;

  console.log('Order updated', event)

}

export function wixEcom_onCheckoutCreated(event) {
    console.log('Checkout created', event)
  const checkoutSubtotal = event.entity.subtotal.amount;
  const checkoutId = event.entity._id;
  const eventId = event.metadata.id;
  
}


export function wixEcom_onOrderCreated(event) {
    console.log("wixEcom_onOrderCreated")
    const eventId = event.metadata.id
    const entityId = event.entity._id;

}

export async function wixEcom_onOrderPaymentStatusUpdated(event) {
    console.log("event", JSON.stringify(event));
    const order = event.data.order;
    const orderId = order._id;
    const email = order.buyerInfo.email;
    const selectedTemplatesUrls = [];
    order.lineItems.forEach(item => {
        selectedTemplatesUrls.push({
            id: item._id,
            url: item.image
        })
    });
    const phone = order.buyerInfo.phone;

    console.log("orderId", orderId)
    console.log("email", email)
    console.log("selectedTemplatesUrls": )
    selectedTemplatesUrls.forEach(item => {
        console.log(JSON.stringify(item))

    });

    console.log('Order payment status updated', event)

    try {
        // Use a unique identifier for your order records, separate from Wix's _id
        let existingOrder = await wixData.query("orders").eq("orderId", orderId).find();

        if (existingOrder.totalCount === 0) {
            const newOrder = {
                email,
                phone,
                selectedTemplatesUrls
            };

            const createdOrder = await wixData.insert("orders", newOrder);
            console.log('Order inserted in database:', createdOrder);
        } else {
            console.log('Order already exists in database');
        }
    } catch (error) {
        console.error('Error updating order in database:', error);
    }
}

truly desperate here… please assist.

Will escalate internally. In the meantime you should also open a ticket with Contact Wix

Just to confirm. You’re not seeing any logged messages when checking your live Site Logs? About Logs (formerly Site Monitoring)

As in:

  • Open live site logs
  • Do something to trigger an event
  • Observe no logs in site logs

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

yep. i can see these types of logs:

but im not seeing any of my console.log.

@anthony none of the wixEcom events are firing for me too. Specifically I am using the onOrderPaymentStatusUpdated - Velo API Reference - Wix.com

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.

Thanks everyone for sharing your feedback. I can assure you the team is looking into it.