Marks a booking as fully paid.
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:
paymentDetails.state
status changes to "COMPLETE"
.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
.
function setBookingAsPaid(
bookingId: string,
options: Options,
): Promise<Booking>;
Booking ID to update as paid.
An object representing the available options for setting a booking as paid.
import { Permissions, webMethod } from "wix-web-module";
import { bookings } from "wix-bookings-backend";
export const setBookingAsPaid = webMethod(Permissions.Anyone, async () => {
const bookingId = "1b136d38-02e1-4452-8849-c253e29428a5";
const options = { suppressAuth: true };
try {
const booking = await bookings.setBookingAsPaid(bookingId, options);
return booking;
} catch (error) {
return error;
}
});
/* Returns a promise that resolves to a booking object:
* * {
* "_id": "3bab599d-c032-4f4c-89b1-c73dc51f013c",
* "bookedEntity": {
* "serviceId": "57daccbf-0fc9-4f3d-9c9e-1969947f33fa",
* "scheduleId": "b5c9d6f1-8606-4378-9f4b-7e94d98de91f",
* "setOfSessions": {
* "firstSessionStart": "2021-01-20T14:30:00Z",
* "lastSessionEnd": "2021-03-24T14:30:00Z"
* },
* "title": "12 Part Meditation Course",
* "location": {
* "locationType": "OWNER_BUSINESS"
* },
* "rate": {
* "labeledPriceOptions": {
* "general": {
* "amount": "5000",
* "currency": "USD",
* "downPayAmount": "50"
* }
* }
* },
* "tags": [
* "COURSE"
* ]
* },
* "bookedResources": [
* {
* "_id": "76570209-101f-409b-af97-b445bdb63125",
* "name": "John Smith",
* "email": "jsmith@gmail.com"
* }
* ],
* "status": "CONFIRMED",
* "_createdDate": "2021-01-11T08:46:20.703Z",
* "bookingSource": {
* "platform": "WEB",
* "actor": "CUSTOMER",
* "appDefId": "13d21c63-b5ec-5912-8397-c3a5ddb27a97",
* "appName": "Wix Bookings"
* },
* "formInfo": {
* "paymentSelection": [
* {
* "rateLabel": "general",
* "numberOfParticipants": 1
* }
* ],
* "additionalFields": [
* {
* "_id": "00000000-0000-0000-0000-000000000008",
* "label": "Add Your Message",
* "valueType": "LONG_TEXT"
* }
* ],
* "contactDetails": {
* "contactId": "593da82a-9718-4d43-9db0-8414320b3aa0",
* "firstName": "Frank White",
* "email": "frankw@wmail.com",
* "phone": "555 3456",
* "timeZone": "America/New_York",
* "countryCode": "US"
* }
* },
* "paymentDetails": {
* "balance": {
* "finalPrice": {
* "amount": "5000",
* "currency": "USD",
* "downPayAmount": "50"
* },
* "amountReceived": "5000"
* },
* "state": "COMPLETE",
* "wixPayMultipleDetails": [
* {
* "txId": "eb804fc3-ecab-49c9-8785-0e12d71aaff8",
* "orderId": "6fa06198-1c39-4cf0-91db-a01b10720f56",
* "orderAmount": "4950",
* "orderStatus": "COMPLETE",
* "orderApprovalTime": "2021-01-11T08:47:44.757Z",
* "paymentVendorName": "inPerson"
* },
* {
* "orderId": "aedcae46-844b-4091-b174-cf90f102629f",
* "orderAmount": "50",
* "orderStatus": "COMPLETE"
* }
* ]
* }
* },
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.