Get booking ID when booking is placed

Can confirm i am able to grab the booking ID from the event and store it in a collection. Next step is to pull it back out on the front end and update the actual booking with my payment transaction ID.

Great progress thank you for your patience and help.

Here is the code for anyone else needing to write a field to a collection, please make sure you have defined the field you are writing to in the collection editor.

events.js:
import wixData from ‘wix-data’ ;

export function wixBookings_onBookingConfirmed ( event ) {
const bookingId = event.booking._id ;
let entry = {
“bookingId” : bookingId
};

wixData . insert ( “NameOfYourCollection” , entry ). then (( result ) => {
// OK
}). catch ( ( err ) => {
// Do something with err
});
}