> 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

# CollectAppliedBookingFees

# Package: pricing

# Namespace: BookingFees

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/bookings/pricing/booking-fees/collect-applied-booking-fees.md

## Permission Scopes:
Manage Bookings: SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS

## Introduction

Collects booking fees by charging the customer using the payment method that's
saved on the corresponding [eCommerce order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/introduction.md)


<blockquote class="warning">

__Warning:__
Currently, there is no validation that prevents idempotent requests.
This means that your code must make sure to not charge customers multiple
times for the same booking fee. You could use
[List Transactions For Single Order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-transactions/list-transactions-for-single-order.md)
to check which charges were made previously for an eCommerce order.

</blockquote>

An HTTP status of `200` means that all booking fees were successfully collected.
Any other HTPP status means that collection failed.

Collects the order's `additionalFees.price.amount` that's related to the
booking fees. If there are multiple additional fees on the eCommerce order,
the amount that's collected differs from `priceSummary.totalAdditionalFees.amount`.

Possible failure reasons include:
+ The order's `status` isn't `APPROVED`.
+ There is no payment method saved on the order.
+ The order's `balanceSummary.balance.amount` is lower than the
`additionalFees.price.amount` to collect.
+ The order's `additionalFeeId` doesn't belong to a Wix Bookings cancellation fee.

---

## REST API

### Schema

```
 Method: collectAppliedBookingFees
 Description: Collects booking fees by charging the customer using the payment method that's saved on the corresponding [eCommerce order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/introduction.md)   <blockquote class="warning">  __Warning:__ Currently, there is no validation that prevents idempotent requests. This means that your code must make sure to not charge customers multiple times for the same booking fee. You could use [List Transactions For Single Order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-transactions/list-transactions-for-single-order.md) to check which charges were made previously for an eCommerce order.  </blockquote>  An HTTP status of `200` means that all booking fees were successfully collected. Any other HTPP status means that collection failed.  Collects the order's `additionalFees.price.amount` that's related to the booking fees. If there are multiple additional fees on the eCommerce order, the amount that's collected differs from `priceSummary.totalAdditionalFees.amount`.  Possible failure reasons include: + The order's `status` isn't `APPROVED`. + There is no payment method saved on the order. + The order's `balanceSummary.balance.amount` is lower than the `additionalFees.price.amount` to collect. + The order's `additionalFeeId` doesn't belong to a Wix Bookings cancellation fee.
 URL: https://www.wixapis.com/_api/booking-fees/v1/booking-fees/collect
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  orderId, additionalFeeId
 Method parameters: 
   param name: additionalFeeId | type: additionalFeeId | description: GUID of the additional fee that's related to all given booking fees. | required: true | validation: format GUID
   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.  | validation: minLength 1, maxLength 5000
   param name: orderId | type: orderId | description: GUID of the eCommerce order that includes the booking fees as a single `additionalFee`. | required: true | validation: format GUID
 Return type: CollectAppliedBookingFeesResponse
  - name: collectedPrice | type: Price | description: Collected amount.  
     - name: amount | type: string | description: Amount.  | validation: decimalValue {"gte":"0","lte":"1000000000000000","maxScale":2}
     - name: formattedAmount | type: string | description: Amount formatted with currency symbol.  | read-only: true | validation: maxLength 100

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: FEE_IS_NOT_BOOKING_FEE | Description: The specified additional fee isn't a booking fee.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: ADDITIONAL_FEE_NOT_FOUND | Description: Couldn't find the additional fee.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: ORDER_NOT_FOUND | Description: Couldn't find the order.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ORDER_BALANCE_NON_POSITIVE | Description: The order balance is `0` or negative. There is no outstanding amount to collect.


```

### Examples

### Collect booking fees
```curl
curl -X POST \
'https://www.wixapis.com/_api/booking-fees/v1/booking-fees/collect' \
-H 'Authorization: <AUTH>'
-d '{
  "order_id": "b12ac1a5-810b-45ed-8b23-8a24cc31bbd0",
  "additional_fee_id": "981a1567-c02f-4a1f-9c3e-c86ff891ecbf"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.bookings.bookingFees.collectAppliedBookingFees(orderId, options)
 Description: Collects booking fees by charging the customer using the payment method that's saved on the corresponding [eCommerce order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/introduction.md)   <blockquote class="warning">  __Warning:__ Currently, there is no validation that prevents idempotent requests. This means that your code must make sure to not charge customers multiple times for the same booking fee. You could use [List Transactions For Single Order](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/orders/order-transactions/list-transactions-for-single-order.md) to check which charges were made previously for an eCommerce order.  </blockquote>  An HTTP status of `200` means that all booking fees were successfully collected. Any other HTPP status means that collection failed.  Collects the order's `additionalFees.price.amount` that's related to the booking fees. If there are multiple additional fees on the eCommerce order, the amount that's collected differs from `priceSummary.totalAdditionalFees.amount`.  Possible failure reasons include: + The order's `status` isn't `APPROVED`. + There is no payment method saved on the order. + The order's `balanceSummary.balance.amount` is lower than the `additionalFees.price.amount` to collect. + The order's `additionalFeeId` doesn't belong to a Wix Bookings cancellation fee.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  orderId, options.additionalFeeId, options
 Method parameters: 
   param name: orderId | type: string | description: GUID of the eCommerce order that includes the booking fees as a single `additionalFee`. | required: true | validation: format GUID
   param name: options | type: CollectAppliedBookingFeesOptions  none | required: true 
        - name: additionalFeeId | type: string | description: GUID of the additional fee that's related to all given booking fees. | required: true | validation: format GUID
        - name: businessNotification | type: BusinessNotification | description: Information about whether to notify the business about failing to collect the booking fees from the customer and the message to send.  
           - 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.  | validation: minLength 1, maxLength 5000
 Return type: PROMISE<CollectAppliedBookingFeesResponse>
  - name: collectedPrice | type: Price | description: Collected amount.  
     - name: amount | type: string | description: Amount.  | validation: decimalValue {"gte":"0","lte":"1000000000000000","maxScale":2}
     - name: formattedAmount | type: string | description: Amount formatted with currency symbol.  | read-only: true | validation: maxLength 100

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: FEE_IS_NOT_BOOKING_FEE | Description: The specified additional fee isn't a booking fee.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: ADDITIONAL_FEE_NOT_FOUND | Description: Couldn't find the additional fee.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: ORDER_NOT_FOUND | Description: Couldn't find the order.
   HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ORDER_BALANCE_NON_POSITIVE | Description: The order balance is `0` or negative. There is no outstanding amount to collect.


```

### Examples

### collectAppliedBookingFees
```javascript
import { bookingFees } from '@wix/bookings';

async function collectAppliedBookingFees(orderId,options) {
  const response = await bookingFees.collectAppliedBookingFees(orderId,options);
};
```

### collectAppliedBookingFees (with elevated permissions)
```javascript
import { bookingFees } from '@wix/bookings';
import { auth } from '@wix/essentials';

async function myCollectAppliedBookingFeesMethod(orderId,options) {
  const elevatedCollectAppliedBookingFees = auth.elevate(bookingFees.collectAppliedBookingFees);
  const response = await elevatedCollectAppliedBookingFees(orderId,options);
}
```

### collectAppliedBookingFees (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 { 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 collectAppliedBookingFees(orderId,options) {
  const response = await myWixClient.bookingFees.collectAppliedBookingFees(orderId,options);
};
```

---