POST

Calculate Price


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

The Custom Pricing extension lets site owners add custom pricing to bookings on the site. The custom pricing is calculated and used as the basis for the price when checking out the booking, overriding the standard Bookings pricing logic.

Parameter: An Options object, which contains the booking. Response: An object that contains the calculatedPrice:

Copy
{ "calculatedPrice": 100 }
Endpoint
POST
{DEPLOYMENT-URI}/v1/calculate-price
Body Params
bookingBooking

Booking to calculate the price for.

Response Object
bookingLineItemsArray <BookingLineItem>maxItems 10

List of line items, including information about the number of participants and the price per participant.


depositnumberformat double

Total deposit the customer must pay when booking the service. Provide only when the service includes a deposit. Returning a deposit is optional. If you return a deposit that's greater than the calculatedPrice, the deposit's value is ignored. Instead, the customer must pay the total calculatedPrice in full upfront as if it was a deposit.


ONE OF:

calculatedPricenumber

Calculated total price. Available only when the service's price has been set up as numerical value in the schedule.rate.labeledPriceOptions object.


priceDescriptionstring

Description of the total price. Available only when the service's price has been set up as text value in the schedule.rate.priceText field.

The data payload will include the following object as an encoded JWT. For the purposes of this example, we show the request and response objects decoded.

Request
cURL
curl -X POST \ 'https://provider.example.com/v2/calculate-price' \ -H 'user-agent: Wix' \ -H 'accept-encoding: gzip, deflate' \ -H 'content-type: text/plain; charset=utf-8' \ -d '{ "data": { "request": { "booking": { "endDate": "2023-01-23T17:00:00Z", "paymentStatus": "UNDEFINED", "bookingSource": { "platform": "WEB", "actor": "CUSTOMER" }, "sendSmsReminder": false, "flowControlSettings": { "skipBusinessConfirmation": false, "skipAvailabilityValidation": false, "withRefund": false, "skipSelectedPaymentOptionValidation": false, "ignoreBookingWindow": false }, "revision": "1", "id": "7474452d-ab93-4d42-af61-b15e9f93981d", "status": "CREATED", "createdBy": { "anonymousVisitorId": "c7808c1d-e6a5-49e5-bcbe-b3fcf2f72d28", "identityType": "UNKNOWN" }, "selectedPaymentOption": "OFFLINE", "contactDetails": { "firstName": "Jenny", "email": "jenny@mycompany.com" }, "additionalFields": [], "bookedEntity": { "slot": { "location": { "locationType": "OWNER_BUSINESS" }, "endDate": "2023-01-23T17:00:00.000Z", "timezone": "Europe/Dublin", "resource": { "id": "76570209-101f-409b-af97-b445bdb63125", "name": "Veronique", "scheduleId": "07f7dd1d-2808-4fd5-8e0d-fa5a31960123" }, "scheduleId": "9fd22198-3854-4692-bf40-75a685f0dbf4", "startDate": "2023-01-23T16:00:00.000Z", "serviceId": "b37e907a-ff3e-4165-bcc2-79d3a4cbf1da" }, "title": "SPI-priced service", "tags": [ "INDIVIDUAL" ] }, "startDate": "2023-01-23T16:00:00Z", "participantNotification": { "notifyParticipants": true }, "updatedDate": "2023-01-23T13:33:40.025Z", "totalParticipants": 1, "createdDate": "2023-01-23T13:33:40.025Z" } }, "metadata": { "requestId": "1674480822.92546993606315181", "identity": { "identityType": "ANONYMOUS_VISITOR", "anonymousVisitorId": "c7808c1d-e6a5-49e5-bcbe-b3fcf2f72d28" }, "instanceId": "bb2b1658-9855-4598-b1e0-48e8cdb7f98a" } }, "aud": "3467d501-9004-498d-9b5c-d50f6d4ede66", "iss": "wix.com", "iat": 1674480823, "exp": 1678080823 }'
Response
JSON
{ "calculatedPrice": 16.0, "deposit": 5.0 }
Did this help?