> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # PreviewPrice # Package: pricing # Namespace: BookingsPricingService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/preview-price.md ## Permission Scopes: Read Bookings - Including Participants: SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE ## Introduction Previews the base price for a set of line items belonging to the same service, before a booking is created. The response includes each line item's individual preview price and the total of all line item preview prices. In most situations, the preview price matches the final booking price when using the same parameters. The final amount may differ due to discounts, booking fees, payment processing charges, or service price changes made by the business between preview and booking creation. Preview Price fails if: - You specify line items that belong to different [services](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction.md). - The site is using a [Bookings Pricing Integration Service Plugin](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction.md). Note that external apps can't currently check whether a plugin is installed on the site before calling Preview Price. To retrieve the price of an existing booking, call [Calculate Price](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-api/calculate-price.md) instead. --- ## REST API ### Schema ``` Method: previewPrice Description: Previews the base price for a set of line items belonging to the same service, before a booking is created. The response includes each line item's individual preview price and the total of all line item preview prices. In most situations, the preview price matches the final booking price when using the same parameters. The final amount may differ due to discounts, booking fees, payment processing charges, or service price changes made by the business between preview and booking creation. Preview Price fails if: - You specify line items that belong to different [services](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction.md). - The site is using a [Bookings Pricing Integration Service Plugin](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction.md). Note that external apps can't currently check whether a plugin is installed on the site before calling Preview Price. To retrieve the price of an existing booking, call [Calculate Price](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-api/calculate-price.md) instead. URL: https://www.wixapis.com/bookings/v2/pricing/v2/pricing/preview Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: bookingLineItems Method parameters: param name: bookingLineItems | type: array | description: Booking line items to preview pricing for. All line items must belong to the same [service](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction.md). | required: true - name: serviceId | type: string | description: [Service GUID](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction.md). Required parameter in: - [Preview Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/preview-price.md) for all service types. All line items must have the same service GUID. - [Calculate Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/calculate-price.md) when using Wix Bookings' default pricing logic. Optional in Calculate Price when using a Pricing Service Provider Plugin. - name: resourceId | type: string | description: [Resource GUID](https://dev.wix.com/docs/rest/business-solutions/bookings/resources/resources-v2/introduction.md). Required parameter in: - [Calculate Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/calculate-price.md) for all service types ([service types](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/about-service-types.md)). - [Preview Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/preview-price.md) for appointment-based services and classes. Optional in Preview Price for courses. - name: serviceChoices | type: array | description: Service choices selected by the customer when booking. Choices are specific values for service options that may affect pricing. For example, the option `ageGroup` may have choices like `child`, `student`, `adult`, and `senior`, each with different pricing. Refer to the [Service Options and Variants API](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/service-options-and-variants/introduction.md) for more details. - name: numberOfParticipants | type: integer | description: Number of participants for this service variant. - name: choices | type: array | description: Service choices selected by these participants. Each choice represents a specific value for a service option. For example, age group, duration, or equipment type. - ONE-OF: - name: custom | type: string | description: Value for one of the choices in the [`CustomServiceOption.choices`](https://example.com) list. Choices are specific values for an option the customer can choose to book. For example, the option `ageGroup` may have these choices: `child`, `student`, `adult`, and `senior`. Each choice may have a different price. - name: duration | type: Duration | description: - name: minutes | type: integer | description: Duration of the service in minutes. Min: 1 minute, Max: 30 days, 23 hours, and 59 minutes - name: name | type: string | description: Name of the duration option. Defaults to the formatted duration e.g. "1 hour, 30 minutes". - name: optionId | type: string | description: GUID of the corresponding option for the choice. For example, the choice `child` could correspond to the option `ageGroup`. In this case, `optionId` is the GUID for the `ageGroup` option. Return type: PreviewPriceResponse - name: priceInfo | type: PriceInfo | description: Pricing information including individual line item costs and total estimated price. - ONE-OF: - name: calculatedPrice | type: number | description: Calculated total price. Available if the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `payment.rateType` is `FIXED`, `VARIED`, or `NO_FEE`. - name: priceDescriptionInfo | type: PriceDescriptionInfo | description: Description of the total price. Available if the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `payment.rateType` is `CUSTOM`. - name: original | type: string | description: Price description in the site's main language. Refer to the [Site Properties API](https://dev.wix.com/docs/api-reference/business-management/site-properties/properties/introduction.md) for more details. - name: translated | type: string | description: Translated price description. Available if the booking was made in a secondary language. - name: bookingLineItems | type: array | description: List of line items, including the number of participants and the price per participant. - name: serviceId | type: string | description: [Service GUID](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction.md). Required parameter in: - [Preview Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/preview-price.md) for all service types. All line items must have the same service GUID. - [Calculate Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/calculate-price.md) when using Wix Bookings' default pricing logic. Optional in Calculate Price when using a Pricing Service Provider Plugin. - name: resourceId | type: string | description: [Resource GUID](https://dev.wix.com/docs/rest/business-solutions/bookings/resources/resources-v2/introduction.md). Required parameter in: - [Calculate Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/calculate-price.md) for all service types ([service types](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/about-service-types.md)). - [Preview Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/preview-price.md) for appointment-based services and classes. Optional in Preview Price for courses. - name: serviceChoices | type: array | description: Service choices selected by the customer when booking. Choices are specific values for service options that may affect pricing. For example, the option `ageGroup` may have choices like `child`, `student`, `adult`, and `senior`, each with different pricing. Refer to the [Service Options and Variants API](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/service-options-and-variants/introduction.md) for more details. - name: numberOfParticipants | type: integer | description: Number of participants for this service variant. - name: choices | type: array | description: Service choices selected by these participants. Each choice represents a specific value for a service option. For example, age group, duration, or equipment type. - ONE-OF: - name: custom | type: string | description: Value for one of the choices in the [`CustomServiceOption.choices`](https://example.com) list. Choices are specific values for an option the customer can choose to book. For example, the option `ageGroup` may have these choices: `child`, `student`, `adult`, and `senior`. Each choice may have a different price. - name: duration | type: Duration | description: - name: minutes | type: integer | description: Duration of the service in minutes. Min: 1 minute, Max: 30 days, 23 hours, and 59 minutes - name: name | type: string | description: Name of the duration option. Defaults to the formatted duration e.g. "1 hour, 30 minutes". - name: optionId | type: string | description: GUID of the corresponding option for the choice. For example, the choice `child` could correspond to the option `ageGroup`. In this case, `optionId` is the GUID for the `ageGroup` option. - name: pricePerParticipant | type: number | description: Price per participant for this service variant. - name: deposit | type: number | description: Total deposit the customer must pay when booking the service. Available if the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `payment.options.deposit` is set to `true`. Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_DURATION_CHOICE | Description: The booking range doesn't match the duration of the selected variant. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: NUMBER_OF_PARTICIPANTS_NOT_FOUND | Description: The `numberOfParticipants` is missing or set to `0`. Specify the number of participants for each line item. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_SERVICE_ID | Description: The specified service GUID doesn't exist or is invalid. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: FAILED_RESOLVING_SERVICE | Description: Couldn't retrieve service information. The service may not exist or is unavailable. ``` ### Examples ### Preview the price for line items with custom choices ```curl curl -X POST \ 'https://www.wixapis.com/bookings/v2/pricing/preview' \ -H 'Authorization: ' \ -d '{ "bookingLineItems": [ { "serviceId": "dae13fbb-4314-4b1c-990d-1d82c280cb2f", "resourceId": "76570209-101f-409b-af97-b445bdb63125", "choices": [ { "optionId": "68ea3e36-4a40-461d-81ef-349499d51c74", "custom": "Adults" } ], "numberOfParticipants": 2 }, { "serviceId": "dae13fbb-4314-4b1c-990d-1d82c280cb2f", "resourceId": "76570209-101f-409b-af97-b445bdb63125", "choices": [ { "optionId": "68ea3e36-4a40-461d-81ef-349499d51c74", "custom": "Child" } ], "numberOfParticipants": 3 } ] }' ``` ### Preview the price for line items with custom pricing options ```curl curl -X POST \ 'https://www.wixapis.com/bookings/v2/pricing/preview' \ -H 'Authorization: ' \ -d '{ "bookingLineItems": [ { "serviceId": "b59d6285-098e-4ac4-8fd4-99e22231d0e9", "resourceId": "76570209-101f-409b-af97-b445bdb63125", "numberOfParticipants": 2 } ] }' ``` ### Preview the price for line items with staff-based pricing options ```curl curl -X POST \ 'https://www.wixapis.com/bookings/v2/pricing/preview' \ -H 'Authorization: ' \ -d '{ "bookingLineItems": [ { "serviceId": "b2f1c9aa-1743-4cac-ae2c-48cc7666365c", "resourceId": "76570209-101f-409b-af97-b445bdb63125", "numberOfParticipants": 2 } ] }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.pricing.BookingsPricingService.previewPrice(bookingLineItems) Description: Previews the base price for a set of line items belonging to the same service, before a booking is created. The response includes each line item's individual preview price and the total of all line item preview prices. In most situations, the preview price matches the final booking price when using the same parameters. The final amount may differ due to discounts, booking fees, payment processing charges, or service price changes made by the business between preview and booking creation. Preview Price fails if: - You specify line items that belong to different [services](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction.md). - The site is using a [Bookings Pricing Integration Service Plugin](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction.md). Note that external apps can't currently check whether a plugin is installed on the site before calling Preview Price. To retrieve the price of an existing booking, call [Calculate Price](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-api/calculate-price.md) instead. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: bookingLineItems Method parameters: param name: bookingLineItems | type: array | description: Booking line items to preview pricing for. All line items must belong to the same [service](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction.md). | required: true - name: serviceId | type: string | description: [Service GUID](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction.md). Required parameter in: - [Preview Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/preview-price.md) for all service types. All line items must have the same service GUID. - [Calculate Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/calculate-price.md) when using Wix Bookings' default pricing logic. Optional in Calculate Price when using a Pricing Service Provider Plugin. - name: resourceId | type: string | description: [Resource GUID](https://dev.wix.com/docs/rest/business-solutions/bookings/resources/resources-v2/introduction.md). Required parameter in: - [Calculate Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/calculate-price.md) for all service types ([service types](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/about-service-types.md)). - [Preview Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/preview-price.md) for appointment-based services and classes. Optional in Preview Price for courses. - name: serviceChoices | type: array | description: Service choices selected by the customer when booking. Choices are specific values for service options that may affect pricing. For example, the option `ageGroup` may have choices like `child`, `student`, `adult`, and `senior`, each with different pricing. Refer to the [Service Options and Variants API](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/service-options-and-variants/introduction.md) for more details. - name: numberOfParticipants | type: integer | description: Number of participants for this service variant. - name: choices | type: array | description: Service choices selected by these participants. Each choice represents a specific value for a service option. For example, age group, duration, or equipment type. - ONE-OF: - name: custom | type: string | description: Value for one of the choices in the [`CustomServiceOption.choices`](https://example.com) list. Choices are specific values for an option the customer can choose to book. For example, the option `ageGroup` may have these choices: `child`, `student`, `adult`, and `senior`. Each choice may have a different price. - name: duration | type: Duration | description: - name: minutes | type: integer | description: Duration of the service in minutes. Min: 1 minute, Max: 30 days, 23 hours, and 59 minutes - name: name | type: string | description: Name of the duration option. Defaults to the formatted duration e.g. "1 hour, 30 minutes". - name: optionId | type: string | description: GUID of the corresponding option for the choice. For example, the choice `child` could correspond to the option `ageGroup`. In this case, `optionId` is the GUID for the `ageGroup` option. Return type: PROMISE - name: priceInfo | type: PriceInfo | description: Pricing information including individual line item costs and total estimated price. - ONE-OF: - name: calculatedPrice | type: number | description: Calculated total price. Available if the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `payment.rateType` is `FIXED`, `VARIED`, or `NO_FEE`. - name: priceDescriptionInfo | type: PriceDescriptionInfo | description: Description of the total price. Available if the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `payment.rateType` is `CUSTOM`. - name: original | type: string | description: Price description in the site's main language. Refer to the [Site Properties API](https://dev.wix.com/docs/api-reference/business-management/site-properties/properties/introduction.md) for more details. - name: translated | type: string | description: Translated price description. Available if the booking was made in a secondary language. - name: bookingLineItems | type: array | description: List of line items, including the number of participants and the price per participant. - name: serviceId | type: string | description: [Service GUID](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction.md). Required parameter in: - [Preview Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/preview-price.md) for all service types. All line items must have the same service GUID. - [Calculate Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/calculate-price.md) when using Wix Bookings' default pricing logic. Optional in Calculate Price when using a Pricing Service Provider Plugin. - name: resourceId | type: string | description: [Resource GUID](https://dev.wix.com/docs/rest/business-solutions/bookings/resources/resources-v2/introduction.md). Required parameter in: - [Calculate Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/calculate-price.md) for all service types ([service types](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/about-service-types.md)). - [Preview Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/preview-price.md) for appointment-based services and classes. Optional in Preview Price for courses. - name: serviceChoices | type: array | description: Service choices selected by the customer when booking. Choices are specific values for service options that may affect pricing. For example, the option `ageGroup` may have choices like `child`, `student`, `adult`, and `senior`, each with different pricing. Refer to the [Service Options and Variants API](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/service-options-and-variants/introduction.md) for more details. - name: numberOfParticipants | type: integer | description: Number of participants for this service variant. - name: choices | type: array | description: Service choices selected by these participants. Each choice represents a specific value for a service option. For example, age group, duration, or equipment type. - ONE-OF: - name: custom | type: string | description: Value for one of the choices in the [`CustomServiceOption.choices`](https://example.com) list. Choices are specific values for an option the customer can choose to book. For example, the option `ageGroup` may have these choices: `child`, `student`, `adult`, and `senior`. Each choice may have a different price. - name: duration | type: Duration | description: - name: minutes | type: integer | description: Duration of the service in minutes. Min: 1 minute, Max: 30 days, 23 hours, and 59 minutes - name: name | type: string | description: Name of the duration option. Defaults to the formatted duration e.g. "1 hour, 30 minutes". - name: optionId | type: string | description: GUID of the corresponding option for the choice. For example, the choice `child` could correspond to the option `ageGroup`. In this case, `optionId` is the GUID for the `ageGroup` option. - name: pricePerParticipant | type: number | description: Price per participant for this service variant. - name: deposit | type: number | description: Total deposit the customer must pay when booking the service. Available if the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `payment.options.deposit` is set to `true`. Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_DURATION_CHOICE | Description: The booking range doesn't match the duration of the selected variant. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: NUMBER_OF_PARTICIPANTS_NOT_FOUND | Description: The `numberOfParticipants` is missing or set to `0`. Specify the number of participants for each line item. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_SERVICE_ID | Description: The specified service GUID doesn't exist or is invalid. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: FAILED_RESOLVING_SERVICE | Description: Couldn't retrieve service information. The service may not exist or is unavailable. ``` ### Examples ### previewPrice ```javascript import { pricing } from '@wix/bookings'; async function previewPrice(bookingLineItems) { const response = await pricing.previewPrice(bookingLineItems); }; ``` ### previewPrice (with elevated permissions) ```javascript import { pricing } from '@wix/bookings'; import { auth } from '@wix/essentials'; async function myPreviewPriceMethod(bookingLineItems) { const elevatedPreviewPrice = auth.elevate(pricing.previewPrice); const response = await elevatedPreviewPrice(bookingLineItems); } ``` ### previewPrice (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { pricing } from '@wix/bookings'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { pricing }, // Include the auth strategy and host as relevant }); async function previewPrice(bookingLineItems) { const response = await myWixClient.pricing.previewPrice(bookingLineItems); }; ``` ---