Search.../

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 the finalPrice.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 to true.

Syntax

function setBookingAsPaid(bookingId: string, [options: Options]): Promise<Booking>

setBookingAsPaid Parameters

NAME
TYPE
DESCRIPTION
bookingId
string

Booking ID to update as paid.

options
Optional
Options

An object representing the available options for setting a booking as paid.

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?

Set a booking as paid

Copy Code
1import { bookings } from "wix-bookings-backend";
2
3
4export function setBookingAsPaid() {
5 const bookingId = '1b136d38-02e1-4452-8849-c253e29428a5';
6
7 const options = { suppressAuth: true };
8 return bookings.setBookingAsPaid(bookingId, options)
9 .then((booking) => {
10 return booking;
11 })
12 .catch((error) => {
13 return error;
14 });
15
16}
17
18/* Returns a promise that resolves to a booking object:
19 * * {
20 * "_id": "3bab599d-c032-4f4c-89b1-c73dc51f013c",
21 * "bookedEntity": {
22 * "serviceId": "57daccbf-0fc9-4f3d-9c9e-1969947f33fa",
23 * "scheduleId": "b5c9d6f1-8606-4378-9f4b-7e94d98de91f",
24 * "setOfSessions": {
25 * "firstSessionStart": "2021-01-20T14:30:00Z",
26 * "lastSessionEnd": "2021-03-24T14:30:00Z"
27 * },
28 * "title": "12 Part Meditation Course",
29 * "location": {
30 * "locationType": "OWNER_BUSINESS"
31 * },
32 * "rate": {
33 * "labeledPriceOptions": {
34 * "general": {
35 * "amount": "5000",
36 * "currency": "USD",
37 * "downPayAmount": "50"
38 * }
39 * }
40 * },
41 * "tags": [
42 * "COURSE"
43 * ]
44 * },
45 * "bookedResources": [
46 * {
47 * "_id": "76570209-101f-409b-af97-b445bdb63125",
48 * "name": "John Smith",
49 * "email": "jsmith@gmail.com"
50 * }
51 * ],
52 * "status": "CONFIRMED",
53 * "_createdDate": "2021-01-11T08:46:20.703Z",
54 * "bookingSource": {
55 * "platform": "WEB",
56 * "actor": "CUSTOMER",
57 * "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",
58 * "appName": "Wix Bookings"
59 * },
60 * "formInfo": {
61 * "paymentSelection": [
62 * {
63 * "rateLabel": "general",
64 * "numberOfParticipants": 1
65 * }
66 * ],
67 * "additionalFields": [
68 * {
69 * "_id": "00000000-0000-0000-0000-000000000008",
70 * "label": "Add Your Message",
71 * "valueType": "LONG_TEXT"
72 * }
73 * ],
74 * "contactDetails": {
75 * "contactId": "593da82a-9718-4d43-9db0-8414320b3aa0",
76 * "firstName": "Frank White",
77 * "email": "frankw@wmail.com",
78 * "phone": "555 3456",
79 * "timeZone": "America/New_York",
80 * "countryCode": "US"
81 * }
82 * },
83 * "paymentDetails": {
84 * "balance": {
85 * "finalPrice": {
86 * "amount": "5000",
87 * "currency": "USD",
88 * "downPayAmount": "50"
89 * },
90 * "amountReceived": "5000"
91 * },
92 * "state": "COMPLETE",
93 * "wixPayMultipleDetails": [
94 * {
95 * "txId": "eb804fc3-ecab-49c9-8785-0e12d71aaff8",
96 * "orderId": "6fa06198-1c39-4cf0-91db-a01b10720f56",
97 * "orderAmount": "4950",
98 * "orderStatus": "COMPLETE",
99 * "orderApprovalTime": "2021-01-11T08:47:44.757Z",
100 * "paymentVendorName": "inPerson"
101 * },
102 * {
103 * "orderId": "aedcae46-844b-4091-b174-cf90f102629f",
104 * "orderAmount": "50",
105 * "orderStatus": "COMPLETE"
106 * }
107 * ]
108 * }
109 * },
110 */