> 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 # ApplyBookingFeesToOrder # Package: pricing # Namespace: BookingFees # Method link: https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/booking-fees/apply-booking-fees-to-order.md ## Permission Scopes: Manage Bookings: SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS ## Introduction Applies booking fees to an [eCommerce order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/introduction.md). The booking fees are added as a single additional fee to the eCommerce order. The order's `additionalFee.lineItemIds` array is set to the list of corresponding booking IDs. By default, the `additionalFee.price.amount` is the sum of all booking fee prices. But you may provide a `priceOverride` instead. The override price can't be higher than the sum of all booking fees. Apply Booking Fees to Order also updates the prices of all affected line items in the relevant eCommerce order to zero. After a cancellation fee is applied to an eCommerce order, the cancellation fee's `price.value` is updated to `0.00` and its trigger is set to `UNKNOWN_TRIGGER`. You can retrieve the fee amount from the corresponding `additionalFee` object of the eCommerce order with [Search Orders](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/search-orders.md). If you apply multiple booking fees to an eCommerce order, they either all fail or all succeed together. For example, the call fails if the booking fees are associated with different eCommmerce orders. --- ## REST API ### Schema ``` Method: applyBookingFeesToOrder Description: Applies booking fees to an [eCommerce order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/introduction.md). The booking fees are added as a single additional fee to the eCommerce order. The order's `additionalFee.lineItemIds` array is set to the list of corresponding booking GUIDs. By default, the `additionalFee.price.amount` is the sum of all booking fee prices. But you may provide a `priceOverride` instead. The override price can't be higher than the sum of all booking fees. Apply Booking Fees to Order also updates the prices of all affected line items in the relevant eCommerce order to zero. After a cancellation fee is applied to an eCommerce order, the cancellation fee's `price.value` is updated to `0.00` and its trigger is set to `UNKNOWN_TRIGGER`. You can retrieve the fee amount from the corresponding `additionalFee` object of the eCommerce order with [Search Orders](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/search-orders.md). If you apply multiple booking fees to an eCommerce order, they either all fail or all succeed together. For example, the call fails if the booking fees are associated with different eCommmerce orders. URL: https://www.wixapis.com/v1/booking-fees/apply Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: bookingIds, priceOverride.value, priceOverride.currency Method parameters: param name: bookingIds | type: array | description: IDs of the bookings for which to apply booking fees to an eCommerce order. | required: true param name: businessNotification | type: BusinessNotification - name: notifyBusiness | type: boolean | description: Whether to notify the business about changes made to the booking fees. Default is false. - name: message | type: string | description: Optional custom message to send. param name: priceOverride | type: Money | description: Money. Default format to use. Sufficiently compliant with majority of standards: w3c, ISO 4217, ISO 20022, ISO 8583:2003. - name: value | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative. | required: true - name: currency | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD). | required: true Return type: ApplyBookingFeesToOrderResponse - name: bookingFees | type: array | description: Booking fees that were applied as a single additional fee to the eCommerce order. - name: id | type: string | description: Booking fee GUID. - name: bookingId | type: string | description: GUID of the booking associated with the fee. - name: cancellationFee | type: CancellationFee | description: Cancellation fee details. - name: price | type: Money | description: Price the customer must pay. - name: value | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative. - name: currency | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD). - name: formattedValue | type: string | description: Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative. - name: status | type: BookingFeeStatus | description: Status of the booking fee. - enum: - UNKNOWN_STATUS: There is no eCommerce order associated with the booking. - PREVIEW: The fee is informational only; the customer doesn't have to pay it. For example, it shows how much the customer would owe if they canceled the booking now. - NOT_YET_APPLIED_TO_ORDER: The booking fee hasn't been added to the eCommerce order yet. - APPLIED_TO_ORDER: The booking fee has been added to the eCommerce order. The customer may not have paid it yet. - name: trigger | type: Trigger | description: Information about what triggered the creation of the booking fee. - enum: - UNKNOWN_TRIGGER: There is no information about what triggered the creation of the booking fee. - NOT_ATTENDED: The booking fee was created because the customer didn't show up to the booking or canceled after the expiration of the last cancellation window. - BOOKING_CANCELED: The booking fee was created because the customer canceled the booking before the expiration of the last cancellation window. - name: policyDetails | type: PolicyDetails | description: Information about the [booking policy snapshot](https://dev.wix.com/docs/api-reference/business-solutions/bookings/policies/booking-policy-snapshots/introduction.md) according to which the fee was created. - name: id | type: string | description: GUID of the booking policy. - name: description | type: string | description: Description of the booking policy. - name: descriptionTranslated | type: string | description: Translated description of the booking policy according to the buyer language of the eCommerce order. - name: ecomOrderInfo | type: EcomOrderInfo | description: Information about the eCommerce order to which the booking fees are applied. - name: orderId | type: string | description: Order GUID. - name: additionalFeePrice | type: Price | description: Additional fee price. - name: amount | type: string | description: Amount. - name: formattedAmount | type: string | description: Amount formatted with currency symbol. - name: additionalFeeId | type: string | description: The eCommerce additional fee id that was created on the order. Possible Errors: HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: PRICE_OVERRIDE_INSUFFICIENT_PERMISSIONS | Description: The [identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities.md) used to call the method doesn't have the required permissions. HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: BOOKING_FEE_NOT_FOUND | Description: Couldn't find the booking fee. HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: ORDER_NOT_FOUND | Description: Couldn't find the order. HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: ORDER_IS_ALREADY_EDITED | Description: The order was already edited. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: UPDATING_ITEM_WITH_RELATED_ADDITIONAL_FEE_IS_FORBIDDEN | Description: The order line item has an associated additional fee and can't be updated. Remove the additional fee before updating the item. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: UPDATING_ITEM_WITH_RELATED_DISCOUNT_IS_FORBIDDEN | Description: The order line item has an associated discount and can't be updated. Remove the discount before updating the item. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: BOOKING_FEE_AND_ORDER_CURRENCIES_ARE_INCONSISTENT | Description: The booking fee currency doesn't match the order currency. Ensure both use the same currency. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ORDER_CANNOT_BE_EDITED | Description: The order can't be edited. Verify the order status and try again. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ORDER_WITH_TAXABLE_EXISTING_ADDITIONAL_FEE_CANNOT_BE_EDITED | Description: The order has a taxable additional fee and can't be edited. Contact support for assistance. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: PARTIALLY_OR_FULLY_REFUNDED_ORDER_CANNOT_BE_EDITED | Description: The order was partially or fully refunded and can't be edited. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: BOOKING_FEE_ALREADY_APPLIED | Description: The booking fee was already applied to the order. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: PRICE_OVERRIDE_EXCEEDS_MAX | Description: The `priceOverride` exceeds the total of all booking fees. Reduce the override amount or omit it to use the calculated fee total. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: BOOKING_IDS_BELONG_TO_DIFFERENT_ORDERS | Description: The specified booking GUIDs are associated with different eCommerce orders. All bookings must belong to the same order. HTTP Code: 500 | Status Code: INTERNAL | Application Code: FAILED_APPLYING_BOOKING_FEE_TO_ORDER | Description: Couldn't apply the booking fee to the order. Try again later. HTTP Code: 500 | Status Code: INTERNAL | Application Code: FAILED_CALCULATING_BOOKING_FEE | Description: Couldn't calculate the booking fee. Verify the booking details and try again. ``` ### Examples ### Apply booking fees with price override to order ```curl curl -X POST \ 'https://www.wixapis.com/_api/booking-fees/v1/booking-fees/apply' \ -H 'Authorization: ' -d '{ "bookingIds": [ "52384da2-f6cf-45ac-9537-d92e2ca514e8" ], "priceOverride": { "value": "4", "currency": "USD" }, "businessNotification": { "notifyBusiness": true } }' ``` ### Apply booking fees to order ```curl curl -X POST \ 'https://www.wixapis.com/_api/booking-fees/v1/booking-fees/apply' \ -H 'Authorization: ' \ -d '{ "bookingIds": [ "a717b687-aaa8-4e35-85ba-adbd88bbadd8", "ff04b4b3-b386-4db1-8990-60c5ec6f4229" ] }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.pricing.BookingFees.applyBookingFeesToOrder(bookingIds, options) Description: Applies booking fees to an [eCommerce order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/introduction.md). The booking fees are added as a single additional fee to the eCommerce order. The order's `additionalFee.lineItemIds` array is set to the list of corresponding booking GUIDs. By default, the `additionalFee.price.amount` is the sum of all booking fee prices. But you may provide a `priceOverride` instead. The override price can't be higher than the sum of all booking fees. Apply Booking Fees to Order also updates the prices of all affected line items in the relevant eCommerce order to zero. After a cancellation fee is applied to an eCommerce order, the cancellation fee's `price.value` is updated to `0.00` and its trigger is set to `UNKNOWN_TRIGGER`. You can retrieve the fee amount from the corresponding `additionalFee` object of the eCommerce order with [Search Orders](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/search-orders.md). If you apply multiple booking fees to an eCommerce order, they either all fail or all succeed together. For example, the call fails if the booking fees are associated with different eCommmerce orders. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: bookingIds, options.priceOverride.value, options.priceOverride.currency Method parameters: param name: bookingIds | type: array | description: IDs of the bookings for which to apply booking fees to an eCommerce order. | required: true param name: options | type: ApplyBookingFeesToOrderOptions none - name: priceOverride | type: Money | description: Custom price override for the additional fee that's added to the eCommerce order. The override mustn't exceed the sum of all booking fees. You must have the `OVERRIDE_BOOKING_FEE_PRICE` permission to use this property. - name: value | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative. | required: true - name: currency | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD). | required: true - name: businessNotification | type: BusinessNotification | description: Information about the message to the business and whether to send it if the booking fee application to the eCommerce order fails. - name: notifyBusiness | type: boolean | description: Whether to notify the business about changes made to the booking fees. Default is false. - name: message | type: string | description: Optional custom message to send. Return type: PROMISE - name: bookingFees | type: array | description: Booking fees that were applied as a single additional fee to the eCommerce order. - name: _id | type: string | description: Booking fee GUID. - name: bookingId | type: string | description: GUID of the booking associated with the fee. - name: cancellationFee | type: CancellationFee | description: Cancellation fee details. - name: price | type: Money | description: Price the customer must pay. - name: value | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative. - name: currency | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD). - name: formattedValue | type: string | description: Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative. - name: status | type: BookingFeeStatus | description: Status of the booking fee. - enum: - UNKNOWN_STATUS: There is no eCommerce order associated with the booking. - PREVIEW: The fee is informational only; the customer doesn't have to pay it. For example, it shows how much the customer would owe if they canceled the booking now. - NOT_YET_APPLIED_TO_ORDER: The booking fee hasn't been added to the eCommerce order yet. - APPLIED_TO_ORDER: The booking fee has been added to the eCommerce order. The customer may not have paid it yet. - name: trigger | type: Trigger | description: Information about what triggered the creation of the booking fee. - enum: - UNKNOWN_TRIGGER: There is no information about what triggered the creation of the booking fee. - NOT_ATTENDED: The booking fee was created because the customer didn't show up to the booking or canceled after the expiration of the last cancellation window. - BOOKING_CANCELED: The booking fee was created because the customer canceled the booking before the expiration of the last cancellation window. - name: policyDetails | type: PolicyDetails | description: Information about the [booking policy snapshot](https://dev.wix.com/docs/api-reference/business-solutions/bookings/policies/booking-policy-snapshots/introduction.md) according to which the fee was created. - name: _id | type: string | description: GUID of the booking policy. - name: description | type: string | description: Description of the booking policy. - name: descriptionTranslated | type: string | description: Translated description of the booking policy according to the buyer language of the eCommerce order. - name: ecomOrderInfo | type: EcomOrderInfo | description: Information about the eCommerce order to which the booking fees are applied. - name: orderId | type: string | description: Order GUID. - name: additionalFeePrice | type: Price | description: Additional fee price. - name: amount | type: string | description: Amount. - name: formattedAmount | type: string | description: Amount formatted with currency symbol. - name: additionalFeeId | type: string | description: The eCommerce additional fee id that was created on the order. Possible Errors: HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: PRICE_OVERRIDE_INSUFFICIENT_PERMISSIONS | Description: The [identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities.md) used to call the method doesn't have the required permissions. HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: BOOKING_FEE_NOT_FOUND | Description: Couldn't find the booking fee. HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: ORDER_NOT_FOUND | Description: Couldn't find the order. HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: ORDER_IS_ALREADY_EDITED | Description: The order was already edited. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: UPDATING_ITEM_WITH_RELATED_ADDITIONAL_FEE_IS_FORBIDDEN | Description: The order line item has an associated additional fee and can't be updated. Remove the additional fee before updating the item. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: UPDATING_ITEM_WITH_RELATED_DISCOUNT_IS_FORBIDDEN | Description: The order line item has an associated discount and can't be updated. Remove the discount before updating the item. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: BOOKING_FEE_AND_ORDER_CURRENCIES_ARE_INCONSISTENT | Description: The booking fee currency doesn't match the order currency. Ensure both use the same currency. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ORDER_CANNOT_BE_EDITED | Description: The order can't be edited. Verify the order status and try again. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ORDER_WITH_TAXABLE_EXISTING_ADDITIONAL_FEE_CANNOT_BE_EDITED | Description: The order has a taxable additional fee and can't be edited. Contact support for assistance. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: PARTIALLY_OR_FULLY_REFUNDED_ORDER_CANNOT_BE_EDITED | Description: The order was partially or fully refunded and can't be edited. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: BOOKING_FEE_ALREADY_APPLIED | Description: The booking fee was already applied to the order. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: PRICE_OVERRIDE_EXCEEDS_MAX | Description: The `priceOverride` exceeds the total of all booking fees. Reduce the override amount or omit it to use the calculated fee total. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: BOOKING_IDS_BELONG_TO_DIFFERENT_ORDERS | Description: The specified booking GUIDs are associated with different eCommerce orders. All bookings must belong to the same order. HTTP Code: 500 | Status Code: INTERNAL | Application Code: FAILED_APPLYING_BOOKING_FEE_TO_ORDER | Description: Couldn't apply the booking fee to the order. Try again later. HTTP Code: 500 | Status Code: INTERNAL | Application Code: FAILED_CALCULATING_BOOKING_FEE | Description: Couldn't calculate the booking fee. Verify the booking details and try again. ``` ### Examples ### applyBookingFeesToOrder ```javascript import { bookingFees } from '@wix/bookings'; async function applyBookingFeesToOrder(bookingIds,options) { const response = await bookingFees.applyBookingFeesToOrder(bookingIds,options); }; ``` ### applyBookingFeesToOrder (with elevated permissions) ```javascript import { bookingFees } from '@wix/bookings'; import { auth } from '@wix/essentials'; async function myApplyBookingFeesToOrderMethod(bookingIds,options) { const elevatedApplyBookingFeesToOrder = auth.elevate(bookingFees.applyBookingFeesToOrder); const response = await elevatedApplyBookingFeesToOrder(bookingIds,options); } ``` ### applyBookingFeesToOrder (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 { bookingFees } from '@wix/bookings'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { bookingFees }, // Include the auth strategy and host as relevant }); async function applyBookingFeesToOrder(bookingIds,options) { const response = await myWixClient.bookingFees.applyBookingFeesToOrder(bookingIds,options); }; ``` ---