> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - 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).

Preview Price always uses Wix Bookings' standard pricing logic, including on sites that use a [Bookings Pricing Integration Service Plugin](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction.md). On those sites, the preview price can differ from the price the customer is charged.

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).  Preview Price always uses Wix Bookings' standard pricing logic, including on sites that use a [Bookings Pricing Integration Service Plugin](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction.md). On those sites, the preview price can differ from the price the customer is charged.  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<bookingLineItems> | 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 | validation: minItems 1, maxItems 40
              - 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.  | validation: format GUID
              - 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.  | validation: format GUID
              - name: businessLocationId | type: string | description: GUID of the business location the booking takes place at. Used to resolve the price for `LOCATION` service options.  Limited to business locations. Custom and customer locations aren't supported.  Optional in [Preview Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/preview-price.md). If omitted, or if it doesn't match any `LOCATION` choice, the service's default price (`payment.varied.defaultPrice`) is used.  Returned in [Calculate Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/calculate-price.md) based on the location of the booking's slot or, for courses, the booking's schedule.  | validation: format GUID
              - name: serviceChoices | type: array<ServiceChoices> | 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.  | validation: maxItems 40
                 - name: numberOfParticipants | type: integer | description: Number of participants for this service variant.  | validation: minimum 1, format int32
                 - name: choices | type: array<ServiceChoice> | 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.  | validation: maxItems 5
                    - 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  | validation: minimum 1, maximum 44639
                          - name: name | type: string | description: Name of the duration option. Defaults to the formatted duration e.g. "1 hour, 30 minutes".  | validation: maxLength 255
                       - name: dateTime | type: DateTimeRule | description: The matched date-time pricing rule. Available only for `DATE_TIME` options.  
                          - name: name | type: string | description: Name of the date-time rule. For example, "Weekend mornings".  | validation: maxLength 255
                       - name: participantRange | type: ParticipantsRange | description: The matched participants pricing rule. Available only for `NUMBER_OF_PARTICIPANTS` options.  
                          - name: name | type: string | description: Name of the participants range. For example, "Large group".  | validation: maxLength 255
                       - name: durationRange | type: DurationRange | description: The matched duration range tier. Available only for `DURATION_RANGE` options.  
                          - name: name | type: string | description: Name of the duration range tier. For example, "Long stay".  | validation: maxLength 255
                    - 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.  | validation: format GUID
                    - name: choiceId | type: string | description: GUID of the service choice. When provided, the choice details are automatically populated based on this GUID.  | validation: format GUID
              - name: localStartDate | type: string | description: Local start date and time of the booking. For example, `"2024-01-30T13:30:00"`.  Used together with `localEndDate` and `timeZone` to calculate duration-based pricing for services with a duration range configured. If not provided, pricing is calculated based on the number of participants only.  | validation: format LOCAL_DATE_TIME
              - name: localEndDate | type: string | description: Local end date and time of the booking. For example, `"2024-01-30T14:30:00"`.  Used together with `localStartDate` and `timeZone` to calculate duration-based pricing for services with a duration range configured. If not provided, pricing is calculated based on the number of participants only.  | validation: format LOCAL_DATE_TIME
              - name: timeZone | type: string | description: Time zone for `localStartDate` and `localEndDate` in IANA format. For example, `"America/New_York"`.  Required when `localStartDate` and `localEndDate` are provided.  
 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`, `NO_FEE`, or `SUBSCRIPTION`. For `SUBSCRIPTION`, this is the price of 1 billing cycle for all participants. When the booking is paid upfront in one payment, it's the price of all billing cycles, including cycles that are already over. For a `FIXED` or `VARIED` course that has started, this can be a prorated price for the remaining sessions, when the service's `bookingPolicy.prorationPolicy.enabled` is `true`. The prorated price is `0` when none of the course's sessions are remaining. `serviceFullPrice` then holds the price before proration.  
        - 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.  | validation: maxLength 50
           - name: translated | type: string | description: Translated price description. Available if the booking was made in a secondary language.  | validation: maxLength 50
     - name: bookingLineItems | type: array<BookingLineItem> | description: List of line items, including the number of participants and the price per participant.  | validation: maxItems 40
        - 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.  | validation: format GUID
        - 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.  | validation: format GUID
        - name: businessLocationId | type: string | description: GUID of the business location the booking takes place at. Used to resolve the price for `LOCATION` service options.  Limited to business locations. Custom and customer locations aren't supported.  Optional in [Preview Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/preview-price.md). If omitted, or if it doesn't match any `LOCATION` choice, the service's default price (`payment.varied.defaultPrice`) is used.  Returned in [Calculate Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/calculate-price.md) based on the location of the booking's slot or, for courses, the booking's schedule.  | validation: format GUID
        - name: serviceChoices | type: array<ServiceChoices> | 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.  | validation: maxItems 40
           - name: numberOfParticipants | type: integer | description: Number of participants for this service variant.  | validation: minimum 1, format int32
           - name: choices | type: array<ServiceChoice> | 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.  | validation: maxItems 5
              - 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  | validation: minimum 1, maximum 44639
                    - name: name | type: string | description: Name of the duration option. Defaults to the formatted duration e.g. "1 hour, 30 minutes".  | validation: maxLength 255
                 - name: dateTime | type: DateTimeRule | description: The matched date-time pricing rule. Available only for `DATE_TIME` options.  
                    - name: name | type: string | description: Name of the date-time rule. For example, "Weekend mornings".  | validation: maxLength 255
                 - name: participantRange | type: ParticipantsRange | description: The matched participants pricing rule. Available only for `NUMBER_OF_PARTICIPANTS` options.  
                    - name: name | type: string | description: Name of the participants range. For example, "Large group".  | validation: maxLength 255
                 - name: durationRange | type: DurationRange | description: The matched duration range tier. Available only for `DURATION_RANGE` options.  
                    - name: name | type: string | description: Name of the duration range tier. For example, "Long stay".  | validation: maxLength 255
              - 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.  | validation: format GUID
              - name: choiceId | type: string | description: GUID of the service choice. When provided, the choice details are automatically populated based on this GUID.  | validation: format GUID
           - name: pricePerParticipant | type: number | description: Price per participant for this service variant.  Exception: a group appointment (a service of type `APPOINTMENT` with `multipleParticipants.enabled`) has one price for the whole session, and this field holds that session price. A group appointment priced by a `NUMBER_OF_PARTICIPANTS` or `CUSTOM` option is still priced per participant.  To get the amount to charge, use the line item's `calculatedPrice`.  | read-only: true | validation: format double
        - name: localStartDate | type: string | description: Local start date and time of the booking. For example, `"2024-01-30T13:30:00"`.  Used together with `localEndDate` and `timeZone` to calculate duration-based pricing for services with a duration range configured. If not provided, pricing is calculated based on the number of participants only.  | validation: format LOCAL_DATE_TIME
        - name: localEndDate | type: string | description: Local end date and time of the booking. For example, `"2024-01-30T14:30:00"`.  Used together with `localStartDate` and `timeZone` to calculate duration-based pricing for services with a duration range configured. If not provided, pricing is calculated based on the number of participants only.  | validation: format LOCAL_DATE_TIME
        - name: timeZone | type: string | description: Time zone for `localStartDate` and `localEndDate` in IANA format. For example, `"America/New_York"`.  Required when `localStartDate` and `localEndDate` are provided.  
        - name: calculatedPrice | type: number | description: Base price of this line item on its own. `PriceInfo.calculatedPrice` is the total across all line items. For `SUBSCRIPTION`, this is the price of 1 billing cycle for the line item's participants. When the booking is paid upfront in one payment, it's the price of all billing cycles, including cycles that are already over. For a `FIXED` or `VARIED` course that has started, this can be a prorated price for the remaining sessions, when the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `bookingPolicy.prorationPolicy.enabled` is `true`. The prorated price is `0` when none of the course's sessions are remaining.  | read-only: true | validation: format double
        - name: serviceFullPrice | type: number | description: Price of this line item from the service's price settings, for its participants and choices, before proration. Returned only for `FIXED` and `VARIED`, when `calculatedPrice` is lower. For example, for a course that has started, when the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `bookingPolicy.prorationPolicy.enabled` is `true`.  | read-only: true | validation: format double
        - name: subscriptionPriceInfo | type: SubscriptionPriceInfo | description: Subscription price info of this line item: its payment schedule. Returned only if the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `payment.rateType` is `SUBSCRIPTION`.  | read-only: true 
           - name: startDate | type: string | description: Date and time the subscription starts: the service's recurring start date when the course hasn't started and that date is still ahead, and otherwise the date and time of the calculation. When the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `bookingPolicy.prorationPolicy.enabled` is `true` and none of the course's sessions in the current billing cycle are remaining, it's the next billing day at 12:00 UTC instead.  | validation: format date-time
           - name: numberOfPayments | type: integer | description: Number of payments left in the payment schedule, starting at `startDate`: the service's number of payments minus the billing cycles that end before `startDate`, and at least 1. When the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `bookingPolicy.prorationPolicy.enabled` is `true` and none of the course's sessions are remaining, it's `0` and `startDate` isn't returned. Paying upfront in one payment doesn't change this number, while `calculatedPrice` then covers all of the service's billing cycles, including cycles that are already over.  | validation: minimum 0, format int32
           - name: cyclePriceOverrides | type: array<SubscriptionCyclePriceOverride> | description: Prices for specific billing cycles that differ from the regular price per cycle. For example, a prorated first payment for a customer who joins a monthly course after it started. Cycles that no entry covers are charged the regular price per billing cycle. Holds at most 1 entry, for billing cycle `1`. Empty when every cycle is charged the regular price.  | validation: maxItems 1
              - name: cycleFrom | type: integer | description: First billing cycle the price applies to. Always `1`: the first billing cycle of the payment schedule, which starts at `startDate`.  | validation: minimum 1, maximum 1
              - name: numberOfCycles | type: integer | description: Number of consecutive billing cycles the price applies to, starting at `cycleFrom`. Always `1`.  | validation: minimum 1, maximum 1, format int32
              - name: price | type: string | description: Price of each billing cycle this entry covers, for all of the line item's participants.  | validation: decimalValue {"gte":"0","lte":"1000000000000000","maxScale":2}
        - name: sessionCounts | type: SessionCounts | description: Number of sessions of this line item's course, and how many of them are remaining. Returned only for courses.  | read-only: true 
           - name: totalCount | type: integer | description: Number of the course's sessions. Canceled sessions aren't counted.  | validation: minimum 0, format int32
           - name: remainingCount | type: integer | description: Number of the course's sessions that start after the date and time of the calculation. A session that has started isn't remaining, even if it hasn't ended. Canceled sessions aren't counted.  | validation: minimum 0, format int32
        - name: additionalFees | type: array<AppliedAdditionalFee> | description: Additional fees of the line item, for example a cleaning fee. A fee that comes to `0` isn't returned.  | read-only: true | validation: maxItems 5
           - name: feeId | type: string | description: GUID of the additional fee in the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `payment.additionalFees`.  | validation: format GUID
           - name: units | type: number | description: Number of units the fee is charged for. `1` for a `PER_RESERVATION` fee. For a `PER_UNIT` fee, the reservation's duration in the service's `schedule.availabilityConstraints.durationRange.unitType`, for example `3` for a 3-day reservation, or for 3 nights of an overnight service. `1` when the service has no duration range.  | validation: format double
           - name: amount | type: number | description: Fee amount to charge: the service's fee amount multiplied by `units`, rounded half up to 2 decimal places.  | validation: format double
     - name: serviceFullPrice | type: number | description: Total of the line items' `serviceFullPrice`. A line item without `serviceFullPrice` adds its `calculatedPrice`. Returned only when at least 1 line item returns `serviceFullPrice`.  | read-only: true | validation: format double
     - 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`. Doesn't include additional fees.  | validation: format double
     - name: totalAdditionalFees | type: number | description: Sum of the additional fees on all line items. Returned only when `calculatedPrice` is returned and at least 1 fee applies.  | read-only: true | validation: format double
     - name: calculatedPriceWithFees | type: number | description: `calculatedPrice` plus `totalAdditionalFees`. Returned only when `calculatedPrice` is returned and at least 1 fee applies.  | read-only: true | validation: format double

 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 pricing options
```curl
curl -X POST \
'https://www.wixapis.com/bookings/v2/pricing/preview' \
-H 'Authorization: <AUTH>' \
-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: <AUTH>' \
-d '{
  "bookingLineItems": [ {
    "serviceId": "b2f1c9aa-1743-4cac-ae2c-48cc7666365c",
    "resourceId": "76570209-101f-409b-af97-b445bdb63125",
    "numberOfParticipants": 2
   } ]
}'
```

### Preview the price for line items with custom choices
```curl
curl -X POST \
'https://www.wixapis.com/bookings/v2/pricing/preview' \
-H 'Authorization: <AUTH>' \
-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
  } ]
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.bookings.pricing.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).  Preview Price always uses Wix Bookings' standard pricing logic, including on sites that use a [Bookings Pricing Integration Service Plugin](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction.md). On those sites, the preview price can differ from the price the customer is charged.  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<BookingLineItem> | 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 | validation: minItems 1, maxItems 40
              - 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.  | validation: format GUID
              - 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.  | validation: format GUID
              - name: businessLocationId | type: string | description: GUID of the business location the booking takes place at. Used to resolve the price for `LOCATION` service options.  Limited to business locations. Custom and customer locations aren't supported.  Optional in [Preview Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/preview-price.md). If omitted, or if it doesn't match any `LOCATION` choice, the service's default price (`payment.varied.defaultPrice`) is used.  Returned in [Calculate Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/calculate-price.md) based on the location of the booking's slot or, for courses, the booking's schedule.  | validation: format GUID
              - name: serviceChoices | type: array<ServiceChoices> | 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.  | validation: maxItems 40
                 - name: numberOfParticipants | type: integer | description: Number of participants for this service variant.  | validation: minimum 1, format int32
                 - name: choices | type: array<ServiceChoice> | 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.  | validation: maxItems 5
                    - 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  | validation: minimum 1, maximum 44639
                          - name: name | type: string | description: Name of the duration option. Defaults to the formatted duration e.g. "1 hour, 30 minutes".  | validation: maxLength 255
                       - name: dateTime | type: DateTimeRule | description: The matched date-time pricing rule. Available only for `DATE_TIME` options.  
                          - name: name | type: string | description: Name of the date-time rule. For example, "Weekend mornings".  | validation: maxLength 255
                       - name: participantRange | type: ParticipantsRange | description: The matched participants pricing rule. Available only for `NUMBER_OF_PARTICIPANTS` options.  
                          - name: name | type: string | description: Name of the participants range. For example, "Large group".  | validation: maxLength 255
                       - name: durationRange | type: DurationRange | description: The matched duration range tier. Available only for `DURATION_RANGE` options.  
                          - name: name | type: string | description: Name of the duration range tier. For example, "Long stay".  | validation: maxLength 255
                    - 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.  | validation: format GUID
                    - name: choiceId | type: string | description: GUID of the service choice. When provided, the choice details are automatically populated based on this GUID.  | validation: format GUID
              - name: localStartDate | type: string | description: Local start date and time of the booking. For example, `"2024-01-30T13:30:00"`.  Used together with `localEndDate` and `timeZone` to calculate duration-based pricing for services with a duration range configured. If not provided, pricing is calculated based on the number of participants only.  | validation: format LOCAL_DATE_TIME
              - name: localEndDate | type: string | description: Local end date and time of the booking. For example, `"2024-01-30T14:30:00"`.  Used together with `localStartDate` and `timeZone` to calculate duration-based pricing for services with a duration range configured. If not provided, pricing is calculated based on the number of participants only.  | validation: format LOCAL_DATE_TIME
              - name: timeZone | type: string | description: Time zone for `localStartDate` and `localEndDate` in IANA format. For example, `"America/New_York"`.  Required when `localStartDate` and `localEndDate` are provided.  
 Return type: PROMISE<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`, `NO_FEE`, or `SUBSCRIPTION`. For `SUBSCRIPTION`, this is the price of 1 billing cycle for all participants. When the booking is paid upfront in one payment, it's the price of all billing cycles, including cycles that are already over. For a `FIXED` or `VARIED` course that has started, this can be a prorated price for the remaining sessions, when the service's `bookingPolicy.prorationPolicy.enabled` is `true`. The prorated price is `0` when none of the course's sessions are remaining. `serviceFullPrice` then holds the price before proration.  
        - 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.  | validation: maxLength 50
           - name: translated | type: string | description: Translated price description. Available if the booking was made in a secondary language.  | validation: maxLength 50
     - name: bookingLineItems | type: array<BookingLineItem> | description: List of line items, including the number of participants and the price per participant.  | validation: maxItems 40
        - 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.  | validation: format GUID
        - 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.  | validation: format GUID
        - name: businessLocationId | type: string | description: GUID of the business location the booking takes place at. Used to resolve the price for `LOCATION` service options.  Limited to business locations. Custom and customer locations aren't supported.  Optional in [Preview Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/preview-price.md). If omitted, or if it doesn't match any `LOCATION` choice, the service's default price (`payment.varied.defaultPrice`) is used.  Returned in [Calculate Price](https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/pricing-api/calculate-price.md) based on the location of the booking's slot or, for courses, the booking's schedule.  | validation: format GUID
        - name: serviceChoices | type: array<ServiceChoices> | 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.  | validation: maxItems 40
           - name: numberOfParticipants | type: integer | description: Number of participants for this service variant.  | validation: minimum 1, format int32
           - name: choices | type: array<ServiceChoice> | 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.  | validation: maxItems 5
              - 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  | validation: minimum 1, maximum 44639
                    - name: name | type: string | description: Name of the duration option. Defaults to the formatted duration e.g. "1 hour, 30 minutes".  | validation: maxLength 255
                 - name: dateTime | type: DateTimeRule | description: The matched date-time pricing rule. Available only for `DATE_TIME` options.  
                    - name: name | type: string | description: Name of the date-time rule. For example, "Weekend mornings".  | validation: maxLength 255
                 - name: participantRange | type: ParticipantsRange | description: The matched participants pricing rule. Available only for `NUMBER_OF_PARTICIPANTS` options.  
                    - name: name | type: string | description: Name of the participants range. For example, "Large group".  | validation: maxLength 255
                 - name: durationRange | type: DurationRange | description: The matched duration range tier. Available only for `DURATION_RANGE` options.  
                    - name: name | type: string | description: Name of the duration range tier. For example, "Long stay".  | validation: maxLength 255
              - 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.  | validation: format GUID
              - name: choiceId | type: string | description: GUID of the service choice. When provided, the choice details are automatically populated based on this GUID.  | validation: format GUID
           - name: pricePerParticipant | type: number | description: Price per participant for this service variant.  Exception: a group appointment (a service of type `APPOINTMENT` with `multipleParticipants.enabled`) has one price for the whole session, and this field holds that session price. A group appointment priced by a `NUMBER_OF_PARTICIPANTS` or `CUSTOM` option is still priced per participant.  To get the amount to charge, use the line item's `calculatedPrice`.  | read-only: true 
        - name: localStartDate | type: string | description: Local start date and time of the booking. For example, `"2024-01-30T13:30:00"`.  Used together with `localEndDate` and `timeZone` to calculate duration-based pricing for services with a duration range configured. If not provided, pricing is calculated based on the number of participants only.  | validation: format LOCAL_DATE_TIME
        - name: localEndDate | type: string | description: Local end date and time of the booking. For example, `"2024-01-30T14:30:00"`.  Used together with `localStartDate` and `timeZone` to calculate duration-based pricing for services with a duration range configured. If not provided, pricing is calculated based on the number of participants only.  | validation: format LOCAL_DATE_TIME
        - name: timeZone | type: string | description: Time zone for `localStartDate` and `localEndDate` in IANA format. For example, `"America/New_York"`.  Required when `localStartDate` and `localEndDate` are provided.  
        - name: calculatedPrice | type: number | description: Base price of this line item on its own. `PriceInfo.calculatedPrice` is the total across all line items. For `SUBSCRIPTION`, this is the price of 1 billing cycle for the line item's participants. When the booking is paid upfront in one payment, it's the price of all billing cycles, including cycles that are already over. For a `FIXED` or `VARIED` course that has started, this can be a prorated price for the remaining sessions, when the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `bookingPolicy.prorationPolicy.enabled` is `true`. The prorated price is `0` when none of the course's sessions are remaining.  | read-only: true 
        - name: serviceFullPrice | type: number | description: Price of this line item from the service's price settings, for its participants and choices, before proration. Returned only for `FIXED` and `VARIED`, when `calculatedPrice` is lower. For example, for a course that has started, when the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `bookingPolicy.prorationPolicy.enabled` is `true`.  | read-only: true 
        - name: subscriptionPriceInfo | type: SubscriptionPriceInfo | description: Subscription price info of this line item: its payment schedule. Returned only if the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `payment.rateType` is `SUBSCRIPTION`.  | read-only: true 
           - name: startDate | type: Date | description: Date and time the subscription starts: the service's recurring start date when the course hasn't started and that date is still ahead, and otherwise the date and time of the calculation. When the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `bookingPolicy.prorationPolicy.enabled` is `true` and none of the course's sessions in the current billing cycle are remaining, it's the next billing day at 12:00 UTC instead.  
           - name: numberOfPayments | type: integer | description: Number of payments left in the payment schedule, starting at `startDate`: the service's number of payments minus the billing cycles that end before `startDate`, and at least 1. When the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `bookingPolicy.prorationPolicy.enabled` is `true` and none of the course's sessions are remaining, it's `0` and `startDate` isn't returned. Paying upfront in one payment doesn't change this number, while `calculatedPrice` then covers all of the service's billing cycles, including cycles that are already over.  | validation: minimum 0, format int32
           - name: cyclePriceOverrides | type: array<SubscriptionCyclePriceOverride> | description: Prices for specific billing cycles that differ from the regular price per cycle. For example, a prorated first payment for a customer who joins a monthly course after it started. Cycles that no entry covers are charged the regular price per billing cycle. Holds at most 1 entry, for billing cycle `1`. Empty when every cycle is charged the regular price.  | validation: maxItems 1
              - name: cycleFrom | type: integer | description: First billing cycle the price applies to. Always `1`: the first billing cycle of the payment schedule, which starts at `startDate`.  | validation: minimum 1, maximum 1
              - name: numberOfCycles | type: integer | description: Number of consecutive billing cycles the price applies to, starting at `cycleFrom`. Always `1`.  | validation: minimum 1, maximum 1, format int32
              - name: price | type: string | description: Price of each billing cycle this entry covers, for all of the line item's participants.  | validation: decimalValue {"gte":"0","lte":"1000000000000000","maxScale":2}
        - name: sessionCounts | type: SessionCounts | description: Number of sessions of this line item's course, and how many of them are remaining. Returned only for courses.  | read-only: true 
           - name: totalCount | type: integer | description: Number of the course's sessions. Canceled sessions aren't counted.  | validation: minimum 0, format int32
           - name: remainingCount | type: integer | description: Number of the course's sessions that start after the date and time of the calculation. A session that has started isn't remaining, even if it hasn't ended. Canceled sessions aren't counted.  | validation: minimum 0, format int32
        - name: additionalFees | type: array<AppliedAdditionalFee> | description: Additional fees of the line item, for example a cleaning fee. A fee that comes to `0` isn't returned.  | read-only: true | validation: maxItems 5
           - name: feeId | type: string | description: GUID of the additional fee in the [service's](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) `payment.additionalFees`.  | validation: format GUID
           - name: units | type: number | description: Number of units the fee is charged for. `1` for a `PER_RESERVATION` fee. For a `PER_UNIT` fee, the reservation's duration in the service's `schedule.availabilityConstraints.durationRange.unitType`, for example `3` for a 3-day reservation, or for 3 nights of an overnight service. `1` when the service has no duration range.  
           - name: amount | type: number | description: Fee amount to charge: the service's fee amount multiplied by `units`, rounded half up to 2 decimal places.  
     - name: serviceFullPrice | type: number | description: Total of the line items' `serviceFullPrice`. A line item without `serviceFullPrice` adds its `calculatedPrice`. Returned only when at least 1 line item returns `serviceFullPrice`.  | read-only: true 
     - 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`. Doesn't include additional fees.  
     - name: totalAdditionalFees | type: number | description: Sum of the additional fees on all line items. Returned only when `calculatedPrice` is returned and at least 1 fee applies.  | read-only: true 
     - name: calculatedPriceWithFees | type: number | description: `calculatedPrice` plus `totalAdditionalFees`. Returned only when `calculatedPrice` is returned and at least 1 fee applies.  | read-only: 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 booking line items
```javascript
import { pricing } from "@wix/bookings";

const bookingLineItems = [
  {
    serviceId: "8e8839e1-5f16-4e82-a3bb-a1db594b29ba",
    resourceId: "a0ff6dd0-d635-4d3e-9d94-2fe8dbc7f694",
    numberOfParticipants: 1,
  },
];

async function previewPrice() {
  const response = await pricing.previewPrice(bookingLineItems);
}

```

### previewPrice (self-managed)
Self-managed 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);
};
```

---