setBookingAsPaid( )
Marks a booking as fully paid.
Description
The setBookingAsPaid()
function returns a Promise that resolves when the booking is set as fully paid.
When the business has received full payment from the customer, the booking can be marked as fully paid.
When a booking is set as paid, the following events occur:
- The
paymentDetails.state
status changes to"COMPLETE"
. - The
amountReceived
value is updated to thefinalPrice.amount
value.
You cannot mark a booking as paid if the booking status
is "PENDING_APPROVAL"
.
Note: Only users with Bookings Admin permissions can mark a booking as paid. You can override the permissions by setting the
suppressAuth
options totrue
.
Syntax
function setBookingAsPaid(bookingId: string, [options: Options]): Promise<Booking>
setBookingAsPaid Parameters
NAME
TYPE
DESCRIPTION
Booking ID to update as paid.
An object representing the available options for setting a booking as paid.
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?
Set a booking as paid
1import { Permissions, webMethod } from 'wix-web-module';2import { bookings } from 'wix-bookings-backend';34export const setBookingAsPaid = webMethod(Permissions.Anyone, async () => {5 const bookingId = '1b136d38-02e1-4452-8849-c253e29428a5';67 const options = { suppressAuth: true };8 try {9 const booking = await bookings.setBookingAsPaid(bookingId, options);10 return booking;11 } catch (error) {12 return error;13 }14});1516/* Returns a promise that resolves to a booking object:17 * * {18 * "_id": "3bab599d-c032-4f4c-89b1-c73dc51f013c",19 * "bookedEntity": {20 * "serviceId": "57daccbf-0fc9-4f3d-9c9e-1969947f33fa",21 * "scheduleId": "b5c9d6f1-8606-4378-9f4b-7e94d98de91f",22 * "setOfSessions": {23 * "firstSessionStart": "2021-01-20T14:30:00Z",24 * "lastSessionEnd": "2021-03-24T14:30:00Z"25 * },26 * "title": "12 Part Meditation Course",27 * "location": {28 * "locationType": "OWNER_BUSINESS"29 * },30 * "rate": {31 * "labeledPriceOptions": {32 * "general": {33 * "amount": "5000",34 * "currency": "USD",35 * "downPayAmount": "50"36 * }37 * }38 * },39 * "tags": [40 * "COURSE"41 * ]42 * },43 * "bookedResources": [44 * {45 * "_id": "76570209-101f-409b-af97-b445bdb63125",46 * "name": "John Smith",47 * "email": "jsmith@gmail.com"48 * }49 * ],50 * "status": "CONFIRMED",51 * "_createdDate": "2021-01-11T08:46:20.703Z",52 * "bookingSource": {53 * "platform": "WEB",54 * "actor": "CUSTOMER",55 * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",56 * "appName": "Wix Bookings"57 * },58 * "formInfo": {59 * "paymentSelection": [60 * {61 * "rateLabel": "general",62 * "numberOfParticipants": 163 * }64 * ],65 * "additionalFields": [66 * {67 * "_id": "00000000-0000-0000-0000-000000000008",68 * "label": "Add Your Message",69 * "valueType": "LONG_TEXT"70 * }71 * ],72 * "contactDetails": {73 * "contactId": "593da82a-9718-4d43-9db0-8414320b3aa0",74 * "firstName": "Frank White",75 * "email": "frankw@wmail.com",76 * "phone": "555 3456",77 * "timeZone": "America/New_York",78 * "countryCode": "US"79 * }80 * },81 * "paymentDetails": {82 * "balance": {83 * "finalPrice": {84 * "amount": "5000",85 * "currency": "USD",86 * "downPayAmount": "50"87 * },88 * "amountReceived": "5000"89 * },90 * "state": "COMPLETE",91 * "wixPayMultipleDetails": [92 * {93 * "txId": "eb804fc3-ecab-49c9-8785-0e12d71aaff8",94 * "orderId": "6fa06198-1c39-4cf0-91db-a01b10720f56",95 * "orderAmount": "4950",96 * "orderStatus": "COMPLETE",97 * "orderApprovalTime": "2021-01-11T08:47:44.757Z",98 * "paymentVendorName": "inPerson"99 * },100 * {101 * "orderId": "aedcae46-844b-4091-b174-cf90f102629f",102 * "orderAmount": "50",103 * "orderStatus": "COMPLETE"104 * }105 * ]106 * }107 * },108 */