Events.js Doesn't Response Right Things

Hello!

I want to use events (events.js) with Wix Billing but I can not get the data. It returns undefined data.

Here is my code: (in event.js)

export function wixBilling_onPriceQuoteSent(event) {
 let data = {
 "invoiceId": event.id.id,
 "customerDetails": event.customer
 }
    console.log("CUSTOMER ID", event.customer.contactId)
 return data;
}

When I try to console.log any data from the event it does not gives me anything.
(I’m checking console log from Site Events in settings)

Here what I see in Site Events:

"root":{

"insertId":"..........4Whurx..W8zfvvqQhtfZxQ"
"timestamp":"2021-06-08T20:19:53.133Z"

"labels":{"siteUrl":"https://www.exweiv.store/"
"revision":"5182"
"namespace":"Velo"
"tenantId":"ce84c366-36f1-4af9-8112-a86214475510"
"viewMode":"Site"
}

"sourceLocation":{"file":"backend/events.js"
"line":6
"column":47
}

"operation":{"id":"1623183592.2421748000609110256"
"producer":"backend"
}

"jsonPayload":{"message":"["Cannot read property 'contactId' of undefined"]"
}
"severity":"ERROR"
"receiveTimestamp":"2021-06-08T20:19:53.140Z"
}

Error is the orange message.
And this is the API that I’m trying to use : onPriceQuoteSent - Velo API Reference - Wix.com

Can anyone help me to solve this because I didn’t understand what’s going on?


Every time I see this?

Hi,

Would you please try to log the all the event parameter?

@ahmadnasriya Yes I did there is no problem I see all event but I can not see details.

@ahmadnasriya


I see everything when I log just event or event.id.id but if I log event.customer.contactId or event.customer.email or anything else it doesnt response

@loeix If you can log the customer to the console that means it should be accessible, I’m not sure what happened, I need to run some tests by myself to figure out what’s going on as on paper, everything seems fine.

@ahmadnasriya I was just able to log event, event.id.id and event.status I did not see anything for anything else. event.customer or event.lineItems everything is send error

Anyone has any idea to fix this ?

The question was answered on this thread .