Search.../

updateCustomerInfo( )

Updates the customer's information for a booking.

Description

The updateCustomerInfo() function returns a Promise that resolves to a Booking object when the specified customer's information has been updated.

Notes:

  • The whole formInfo object is updated for each request. Values for properties that are not included in the request will therefore be deleted.
  • updateCustomerInfo() does not update the information for the corresponding contact or member. To update contacts or members use updateContact() or updateUserFields().
  • Only users with Bookings Admin permissions can update customer information for a booking. You can override the permissions by setting the suppressAuth options to true.

Syntax

function updateCustomerInfo(bookingId: string, formInfo: FormInfo, [options: Options]): Promise<Booking>

updateCustomerInfo Parameters

NAME
TYPE
DESCRIPTION
bookingId
string

ID of the booking to be updated.

formInfo
FormInfo

Updated form info and contact details.

options
Optional
Options

An object representing the available options for updating customer information.

Returns

Return Type:

Promise<Booking>
NAME
TYPE
DESCRIPTION
_id
string

Booking ID.

bookedEntity
BookedEntity

An object describing the entity that was booked.

bookedResources
Array<BookedResource>

List of booked resources. Currently, only one is supported. The booked resource would be the staff-member giving the session.

formInfo
Form

Form information submitted when booking. FormInfo contains contact details, participants, and other form fields, set up for the service.

paymentDetails
PaymentDetails

Payment Details.

status
string

Booking status.

One of:

  • "PENDING_CHECKOUT" The booking is waiting to be checked out.
  • "CONFIRMED" The booking has beed approved by the owner.
  • "CANCELED" The booking has been canceled.
  • "PENDING" The booking has been created.
  • "PENDING_APPROVAL" The booking is waiting for the owner to approve or decline.
  • "DECLINED" The booking was declined by the owner.
attendanceInfo
AttendanceInfo

Attendance information.

bookingSource
BookingSource

An object describing the platform and application that made the booking.

externalUserId
string

External ID provided by the client app on creation.

_createdDate
Date

Date and time the booking was created.

Was this helpful?

Update customer information

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { bookings } from 'wix-bookings-backend';
3
4export const updateCustomerInfo = webMethod(Permissions.Anyone, async () => {
5 const bookingId = '0b535e5c-5d30-493c-bd5e-ef92ba6503b7';
6 const formInfo = {
7 contactDetails: {
8 firstName: 'Fred',
9 lastName: 'Thompson',
10 email: 'fred@thompson.com',
11 phone: '5558707',
12 },
13 paymentSelection: [{
14 rateLabel: 'General',
15 numberOfParticipants: 3
16 }],
17 additionalFields: [{
18 'value': 'A Message from Fred',
19 '_id': '00000000-0000-0000-0000-000000000008'
20 }]
21 }
22 return bookings
23 .updateCustomerInfo(bookingId, formInfo)
24 .then((booking) => {
25 return booking;
26 })
27 .catch((error) => {
28 return error;
29 });
30});
31
32
33/* Returns a promise that resolves to a booking object:
34 *
35 * {
36 * "_id": "0b535e5c-5d30-493c-bd5e-ef92ba6503b7",
37 * "bookedEntity": {
38 * "serviceId": "b71df756-309f-468e-aec2-f82b9a9a9441",
39 * "scheduleId": "53616b1f-0c3c-45a1-b282-675acd248179",
40 * "singleSession": {
41 * "sessionId": "193ZPR9ppP9emJUCLevcLf6orynNEIDt5nc0520xjGQILnPPaF5s62yK3BWz7ExgIRM1HunZjEPUQ0IeScw cTFJNXEmLG2g6Q8tvUJQZrPhU6XKhVrlLZraC3YcVfygADFiCPyyy5IVhgtDpF30FnQDoG8I60n21QAlhok4 LHNlkBszoGZ67jGMeDOqxS8PXZgJx87ByXwfgsN3AfXbndYxESrFnttLnRSFzcsolOnBRWHQAvTO0Tm0lEZ2 wIkEAlBrLj6aximrsee44236Oi5bWmdlEdc6fgZ8rfy8bmNsGyV8ryxoDEs8OrU3KHtZEnocCDS1rwZBU2n",
42 * "start": "2021-01-15T17:30:00Z",
43 * "end": "2021-01-15T18:00:00Z"
44 * },
45 * "title": "Yoga Class",
46 * "location": {
47 * "locationType": "OWNER_BUSINESS"
48 * },
49 * "rate": {
50 * "labeledPriceOptions": {
51 * "general": {
52 * "amount": "50",
53 * "currency": "USD",
54 * "downPayAmount": "0"
55 * }
56 * }
57 * },
58 * "tags": [
59 * "GROUP"
60 * ]
61 * },
62 * "bookedResources": [
63 * {
64 * "id": "76570209-101f-409b-af97-b445bdb63125",
65 * "name": "John Smith",
66 * "email": "jsmith@gmail.com",
67 * "_id": "76570209-101f-409b-af97-b445bdb63125"
68 * }
69 * ],
70 * "status": "CONFIRMED",
71 * "bookingSource": {
72 * "platform": "WEB",
73 * "actor": "CUSTOMER",
74 * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",
75 * "appName": "Wix Bookings"
76 * },
77 * "_createdDate": "2021-01-13T17:51:21.566Z",
78 * "formInfo": {
79 * "paymentSelection": [
80 * {
81 * "rateLabel": "general",
82 * "numberOfParticipants": 3
83 * }
84 * ],
85 * "additionalFields": [
86 * {
87 * "_id": "00000000-0000-0000-0000-000000000008",
88 * "label": "Add Your Message",
89 * "value": "A Message from Fred",
90 * "valueType": "LONG_TEXT",
91 * }
92 * ],
93 * "contactDetails": {
94 * "contactId": "b5d03d59-f4b9-49e5-95e2-864b33f30049",
95 * "firstName": "Fred",
96 * "lastName": "Thompson",
97 * "email": "fred@thompson.com",
98 * "phone": "5558707"
99 * }
100 * },
101 * "paymentDetails": {
102 * "balance": {
103 * "finalPrice": {
104 * "amount": "50",
105 * "currency": "USD",
106 * "downPayAmount": "0"
107 * },
108 * "amountReceived": "0"
109 * },
110 * "state": "PENDING_MARK_AS_PAID",
111 * "wixPayMultipleDetails": [
112 * {
113 * "txId": "893ee533-22fe-4ee5-b2e4-a8aef5c4906c",
114 * "orderId": "d91f9a7e-077f-4d47-9037-ff6a040787a9",
115 * "orderAmount": "50",
116 * "orderStatus": "UNDEFINED",
117 * "paymentVendorName": "offline"
118 * }
119 * ]
120 * }
121 * }
122 */