The Bookings Validation service plugin lets you implement custom validation logic for booking operations. When a customer attempts to create, cancel, or reschedule a booking on a Wix site, Wix calls your validation method before executing the operation. Your implementation can approve or reject the operation based on your own business rules.
With the Bookings Validation service plugin, you can:
Wix Bookings calls your service plugin at specific points during booking operations. The flow differs slightly depending on whether the operation involves a single-service booking or a multi-service package.
For a single-service booking, Wix calls the validation method that corresponds to the operation being performed.
valid is true, Wix continues with the operation.valid is false, Wix blocks the operation and displays your error message to the customer.Multi-service bookings are packages containing multiple related bookings, such as a spa day that includes a massage, facial, and manicure.
Each method handles errors and timeouts differently:
| Method | On error or timeout |
|---|---|
| Validate Before Create | Operation is blocked (fail-closed). |
| Validate Before Cancel | Operation is blocked (fail-closed). |
| Validate Before Reschedule | Operation continues (fail-open). |
| Validate Before Create Multi Service | Operation is blocked (fail-closed). |
| Validate Before Cancel Multi Service | Operation is blocked (fail-closed). |
| Validate Before Reschedule Multi Service | Operation continues (fail-open). |
The FieldViolation.description and InvalidReason.message values are displayed to the customer when validation fails. Make them clear and actionable, and avoid technical jargon. The FieldViolation.code field is optional and intended for programmatic handling by your system, not for display to customers.
It's important to note the following points before starting to code:
contactDetails (including firstName, lastName, email, phone, and fullAddress) are redacted. The name and email fields for primary and additional resources in bookedEntity.slot.resource are also redacted.CREATE, CANCEL, RESCHEDULE, CREATE_MULTI_SERVICE, CANCEL_MULTI_SERVICE, and RESCHEDULE_MULTI_SERVICE.valid boolean and, when valid is false, an InvalidReason with optional error details.target.startDate.For a comprehensive glossary of Wix Bookings terms, see Terminology.