> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vultlocal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Fee Setting

> Create or update fee setting (upsert)

# Update Fee Setting

Create or update a fee setting. Uses upsert - creates if not exists, updates if exists.

## Endpoint

```http theme={null}
PUT /api/v1/fee-settings
```

## Authentication

<ParamField header="Authorization" type="string" required>
  Bearer token (Admin JWT)
</ParamField>

## Request Body

<ParamField body="transaction_type" type="string" required>
  Transaction type
</ParamField>

<ParamField body="party_type" type="string" required>
  Party type: `sender`, `recipient`, `agent`, `processor`
</ParamField>

<ParamField body="fee_type" type="string" required>
  Fee calculation: `percentage` or `flat`
</ParamField>

<ParamField body="fee_value" type="number" required>
  Fee value (percentage 0-100 or flat amount in SLE)
</ParamField>

<ParamField body="debit_enabled" type="boolean">
  Apply fee on debit transactions
</ParamField>

<ParamField body="credit_enabled" type="boolean">
  Apply fee on credit transactions
</ParamField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT "https://demo.api.vultlocal.com/api/v1/fee-settings" \
    -H "Authorization: Bearer ADMIN_JWT" \
    -H "Content-Type: application/json" \
    -d '{
      "transaction_type": "transfer_p2p",
      "party_type": "sender",
      "fee_type": "percentage",
      "fee_value": 1.5,
      "debit_enabled": true
    }'
  ```

  ```json Response theme={null}
  {
    "success": true,
    "message": "Fee settings updated successfully",
    "id": 1,
    "transaction_type": "transfer_p2p",
    "party_type": "sender",
    "updated_by": "admin"
  }
  ```
</CodeGroup>

## Validation

* Percentage fee cannot exceed 100%
* Fee value must be >= 0

## Errors

| Code | Description                                |
| ---- | ------------------------------------------ |
| 400  | Invalid request or percentage exceeds 100% |
| 401  | Unauthorized                               |
| 500  | Internal server error                      |


## OpenAPI

````yaml olive-openapi.json PUT /fee-settings
openapi: 3.0.0
info:
  description: >-
    API Gateway for OLIVE NFC Card Payment System - Comprehensive payment, card
    management, agent operations, and admin authentication. All /api/v1 routes
    require authentication using either API Key or JWT token.
  title: OLIVE NFC Card Payment API
  termsOfService: http://swagger.io/terms/
  contact:
    name: API Support
    email: support@olive.sl
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.0
servers:
  - url: https://olive-gateway-a6ba.onrender.com/api/v1
security: []
paths:
  /fee-settings:
    put:
      tags:
        - Fee Settings
      summary: Update or create fee settings
      description: Update existing or create new fee settings (admin only)
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/handler.FeeSettingsRequest'
        description: Fee settings configuration
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
components:
  schemas:
    handler.FeeSettingsRequest:
      type: object
      required:
        - fee_type
        - party_type
        - transaction_type
      properties:
        credit_enabled:
          type: boolean
        debit_enabled:
          type: boolean
        fee_type:
          type: string
          enum:
            - percentage
            - flat
        fee_value:
          type: number
          minimum: 0
        party_type:
          type: string
        transaction_type:
          type: string
  securitySchemes:
    ApiKeyAuth:
      description: >-
        API Key for third-party integrations (WhatsApp, Smart PAY, VULT).
        Format: 'Bearer olive_live_xxxxxxxxxxxxx'
      type: apiKey
      name: Authorization
      in: header

````