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

# Update Merchant Markup Configuration

> Update markup configuration for a merchant by markup ID.

# Update Merchant Markup Configuration

Use this endpoint to update an existing markup configuration for a merchant, identified by its `markupId`.

## Path Parameters

<ParamField path="markupId" type="integer" required>
  Unique identifier of the markup configuration to be updated.
</ParamField>

## Request Body

<ParamField body="mode" type="string">
  Markup mode to be applied.

  Allowed values:

  * `fixed`
  * `percent`

  Business rules:

  * **Required** if you send any of these fields: `amount`, `min_charge_value`, `max_charge_value`.
</ParamField>

<ParamField body="amount" type="number">
  Markup value to be applied.

  Constraints:

  * Optional
  * Must be greater than or equal to `0.01`
</ParamField>

<ParamField body="min_charge_value" type="number">
  Minimum markup amount when mode is `percent`.

  Business rules:

  * **Required** when `mode` = `percent`
  * **Prohibited** when `mode` = `fixed`
  * Must be greater than or equal to `0.01`
</ParamField>

<ParamField body="max_charge_value" type="number">
  Maximum markup amount when mode is `percent`.

  Business rules:

  * Optional
  * Must be greater than or equal to `min_charge_value`
  * **Prohibited** when `mode` = `fixed`
</ParamField>

<ParamField body="enabled" type="boolean">
  Flag to enable or disable this markup configuration.

  * Optional
  * Allowed values: `true`, `false`
</ParamField>

<Warning>
  **Mode and range rules**

  * If you send any of `amount`, `min_charge_value` or `max_charge_value`, you **must** also send `mode`.
  * When `mode = fixed`, you **must not** send `min_charge_value` or `max_charge_value`.
  * When `mode = percent`, you **must** send `min_charge_value`, and `max_charge_value` is optional but must be greater than or equal to `min_charge_value` when provided.
</Warning>

<Info>
  **Special rule when changing mode**

  If you change the mode from `percent` to `fixed`, the service will internally reset:

  * `min_charge_value = null`
  * `max_charge_value = null`
</Info>

## Request Examples

<CodeGroup>
  ```bash cURL - Update to fixed mode and disable markup theme={null}
  curl -X PATCH "https://api.sandbox.wepayout.com.br/v2/account/markup/1234" \
    -H "Authorization: Bearer SEU_TOKEN_AQUI" \
    -H "Content-Type: application/json" \
    -d '{
      "mode": "fixed",
      "amount": 10.0,
      "enabled": false
    }'
  ```

  ```bash cURL - Invalid percent mode payload (missing min_charge_value) theme={null}
  curl -X PATCH "https://api.sandbox.wepayout.com.br/v2/account/markup/1234" \
    -H "Authorization: Bearer SEU_TOKEN_AQUI" \
    -H "Content-Type: application/json" \
    -d '{
      "mode": "percent",
      "amount": 2.5
    }'
  ```

  ```bash cURL - Disable markup only theme={null}
  curl -X PATCH "https://api.sandbox.wepayout.com.br/v2/account/markup/1234" \
    -H "Authorization: Bearer SEU_TOKEN_AQUI" \
    -H "Content-Type: application/json" \
    -d '{
      "enabled": false
    }'
  ```
</CodeGroup>

## Response

<ResponseField name="id" type="integer">
  Markup configuration ID.
</ResponseField>

<ResponseField name="product" type="string">
  Product where the markup is applied (e.g., `payin`).
</ResponseField>

<ResponseField name="payment_method" type="string">
  Payment method where the markup is applied (e.g., `pix`).
</ResponseField>

<ResponseField name="account_id" type="integer">
  Merchant ID that receives the markup.
</ResponseField>

<ResponseField name="parent_id" type="integer or null">
  Parent relationship ID, when applicable.
</ResponseField>

<ResponseField name="type" type="string">
  Markup scope type. Example: `global`.
</ResponseField>

<ResponseField name="mode" type="string">
  Markup mode. Example: `fixed` or `percent`.
</ResponseField>

<ResponseField name="amount" type="number">
  Markup value configured for this rule.
</ResponseField>

<ResponseField name="min_charge_value" type="number or null">
  Minimum markup value when `mode` is `percent`.
</ResponseField>

<ResponseField name="max_charge_value" type="number or null">
  Maximum markup value when `mode` is `percent`.
</ResponseField>

<ResponseField name="enabled" type="boolean">
  Indicates whether the markup configuration is currently active.
</ResponseField>

<ResponseField name="created_at" type="string">
  Date and time when the markup configuration was created.
</ResponseField>

<ResponseField name="updated_at" type="string">
  Date and time when the markup configuration was last updated.
</ResponseField>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "id": 1234,
    "product": "payin",
    "payment_method": "pix",
    "account_id": 987,
    "parent_id": null,
    "type": "global",
    "mode": "fixed",
    "amount": 10.0,
    "min_charge_value": null,
    "max_charge_value": null,
    "enabled": false,
    "created_at": "2025-01-01 12:00:00",
    "updated_at": "2025-01-10 09:30:00"
  }
  ```

  ```json 422 Unprocessable Entity theme={null}
  {
    "message": "Dados inválidos.",
    "errors": {
      "min_charge_value": [
        "O campo min_charge_value é obrigatório quando mode é percent."
      ]
    }
  }
  ```
</ResponseExample>

## Related Resources

<CardGroup cols={2}>
  <Card title="Create Merchant Markup" icon="plus" href="/api-reference/markup/account/create-merchant-markup">
    Create new markup configurations
  </Card>

  <Card title="List Merchant Markups" icon="list" href="/api-reference/markup/account/list-merchant-markups">
    View all markup configurations
  </Card>

  <Card title="About Markup" icon="circle-info" href="/markup/about-markup">
    Learn about markup types and configuration levels
  </Card>

  <Card title="Create Payin with Global Markup" icon="code" href="/api-reference/markup/payin/create-payin-with-global-markup">
    Use global markup when creating payin charges
  </Card>
</CardGroup>
