Adhoc fees are flexible charges that can be applied either in conjunction with a payment or as standalone fees. They serve several business purposes:

- **Post-Payment Charges**: Add additional fees after a payment has been processed (e.g., late fees, service charges)
- **Standalone Fees**: Create charges independent of any payment (e.g., membership fees, administrative fees)

Key features of Adhoc fees:

- Support both positive and negative amounts (when associated with payments)
- Provide detailed transaction history and reporting
- Settle according to configured settlement schedules
- Include customizable descriptions for clear record-keeping

Adhoc fees require specific account configuration and may have limits on amounts and frequency. Contact your account representative to enable and configure Adhoc fee settings for your account.

## API Specification

For detailed API endpoints and request/response schemas for Adhoc fees, see the [Payments API specification](https://docs.getfwd.com/docs/payments-api#tag/Fees).

## Creating Adhoc fees for a payment

### Requirements

1. Your Adhoc Fee Settings must be enabled (Contact your account representative)

### Steps

1. Create a payment using the [Accept Payments](https://docs.getfwd.com/docs/guides/accept-payments) guide

2. Once the payment is created, call the `/fees` endpoint with:

```json
   {
        "payment_id": "pmt_123",
        "amount": 1000, // Amount in cents
        "description": "Late payment fee"
   }
   ```

_Note: You can create multiple Adhoc fees for a single payment, both positive and negative. The sum of all the fees must net to less than the payment amount._

3. The fee will be created and associated with the payment.

_Note: The fee will be settled immediately if the payment has already been settled. If the payment is not settled, the fee will settle when the payment settles._

4. The fee can be fetched with a call to the `/fees/:id` endpoint.

5. The fee transaction can be viewed in the transaction history using the `/transactions/search` endpoint.

## Creating Standalone Adhoc fees

### Requirements

1. Your Adhoc Fee Settings must be enabled (Contact your account representative)
2. The Adhoc fee amount must be within your configured limits

### Steps

1. Call the `/fees` endpoint with:

```json
   {
        "amount": 1000, // Amount in cents
        "description": "Cash payment fee"
   }
   ```

_Note: The amount must be positive and less than the limits defined in your Adhoc fee settings._

2. The fee will be created and processed independently.
   _Note: The fee will be settled according to your configured settlement schedule._

3. The fee can be fetched with a call to the `/fees/:id` endpoint.

4. The fee transaction can be viewed in the transaction history using the `/transactions/search` endpoint.
