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 useupdateContact()
orupdateUserFields()
.- Only users with Bookings Admin permissions can update customer information for a booking. You can override the permissions by setting the
suppressAuth
options totrue
.
Syntax
function updateCustomerInfo(bookingId: string, formInfo: FormInfo, [options: Options]): Promise<Booking>
updateCustomerInfo Parameters
NAME
TYPE
DESCRIPTION
ID of the booking to be updated.
Updated form info and contact details.
An object representing the available options for updating customer information.
Returns
Return Type:
NAME
TYPE
DESCRIPTION
Booking ID.
An object describing the entity that was booked.
List of booked resources. Currently, only one is supported. The booked resource would be the staff-member giving the session.
Form information submitted when booking. FormInfo contains contact details, participants, and other form fields, set up for the service.
Payment Details.
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.
Attendance information.
An object describing the platform and application that made the booking.
External ID provided by the client app on creation.
Date and time the booking was created.
Was this helpful?
Update customer information
1import { bookings } from "wix-bookings-backend";23export function updateCustomerInfo() {4 const bookingId = '0b535e5c-5d30-493c-bd5e-ef92ba6503b7';5 const formInfo = {6 contactDetails: {7 firstName: 'Fred',8 lastName: 'Thompson',9 email: 'fred@thompson.com',10 phone: '5558707',11 },12 paymentSelection: [{13 rateLabel: 'General',14 numberOfParticipants: 315 }],16 additionalFields: [{17 'value': 'A Message from Fred',18 '_id': '00000000-0000-0000-0000-000000000008'19 }]20 }21 return bookings22 .updateCustomerInfo(bookingId, formInfo)23 .then((booking) => {24 return booking;25 })26 .catch((error) => {27 return error;28 });29}303132/* Returns a promise that resolves to a booking object:33 *34 * {35 * "_id": "0b535e5c-5d30-493c-bd5e-ef92ba6503b7",36 * "bookedEntity": {37 * "serviceId": "b71df756-309f-468e-aec2-f82b9a9a9441",38 * "scheduleId": "53616b1f-0c3c-45a1-b282-675acd248179",39 * "singleSession": {40 * "sessionId": "193ZPR9ppP9emJUCLevcLf6orynNEIDt5nc0520xjGQILnPPaF5s62yK3BWz7ExgIRM1HunZjEPUQ0IeScw cTFJNXEmLG2g6Q8tvUJQZrPhU6XKhVrlLZraC3YcVfygADFiCPyyy5IVhgtDpF30FnQDoG8I60n21QAlhok4 LHNlkBszoGZ67jGMeDOqxS8PXZgJx87ByXwfgsN3AfXbndYxESrFnttLnRSFzcsolOnBRWHQAvTO0Tm0lEZ2 wIkEAlBrLj6aximrsee44236Oi5bWmdlEdc6fgZ8rfy8bmNsGyV8ryxoDEs8OrU3KHtZEnocCDS1rwZBU2n",41 * "start": "2021-01-15T17:30:00Z",42 * "end": "2021-01-15T18:00:00Z"43 * },44 * "title": "Yoga Class",45 * "location": {46 * "locationType": "OWNER_BUSINESS"47 * },48 * "rate": {49 * "labeledPriceOptions": {50 * "general": {51 * "amount": "50",52 * "currency": "USD",53 * "downPayAmount": "0"54 * }55 * }56 * },57 * "tags": [58 * "GROUP"59 * ]60 * },61 * "bookedResources": [62 * {63 * "id": "76570209-101f-409b-af97-b445bdb63125",64 * "name": "John Smith",65 * "email": "jsmith@gmail.com",66 * "_id": "76570209-101f-409b-af97-b445bdb63125"67 * }68 * ],69 * "status": "CONFIRMED",70 * "bookingSource": {71 * "platform": "WEB",72 * "actor": "CUSTOMER",73 * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",74 * "appName": "Wix Bookings"75 * },76 * "_createdDate": "2021-01-13T17:51:21.566Z",77 * "formInfo": {78 * "paymentSelection": [79 * {80 * "rateLabel": "general",81 * "numberOfParticipants": 382 * }83 * ],84 * "additionalFields": [85 * {86 * "_id": "00000000-0000-0000-0000-000000000008",87 * "label": "Add Your Message",88 * "value": "A Message from Fred",89 * "valueType": "LONG_TEXT",90 * }91 * ],92 * "contactDetails": {93 * "contactId": "b5d03d59-f4b9-49e5-95e2-864b33f30049",94 * "firstName": "Fred",95 * "lastName": "Thompson",96 * "email": "fred@thompson.com",97 * "phone": "5558707"98 * }99 * },100 * "paymentDetails": {101 * "balance": {102 * "finalPrice": {103 * "amount": "50",104 * "currency": "USD",105 * "downPayAmount": "0"106 * },107 * "amountReceived": "0"108 * },109 * "state": "PENDING_MARK_AS_PAID",110 * "wixPayMultipleDetails": [111 * {112 * "txId": "893ee533-22fe-4ee5-b2e4-a8aef5c4906c",113 * "orderId": "d91f9a7e-077f-4d47-9037-ff6a040787a9",114 * "orderAmount": "50",115 * "orderStatus": "UNDEFINED",116 * "paymentVendorName": "offline"117 * }118 * ]119 * }120 * }121 */