> ## 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.

# Create Payout with Global Markup

> Create a payout payment using global markup configuration.

# Create Payout with Global Markup

When creating a payout payment, you can use the **global markup** configuration that has been set up for your merchant. With global markup, you **do not need to send** the `markup` object in the request payload.

> [!NOTE]
>
> **Global markup is applied automatically**: If the merchant has the markup feature enabled (`enable_markup = true`), the system will automatically search for and apply the submerchant's own markup or, if there is none, the global markup configuration.

## How It Works

1. **Validation**: The system checks if the `enable_markup` flag is active for the submerchant.

2. **Markup Search**: If enabled, the system automatically searches for a markup configuration, first for the submerchant and then for the merchant, based on:
   * `account_id` (submerchant ID)
   * `product` (payout)
   * `payment_method` (markup for payout is currently available for PIX only)

3. **Application**: If the submerchant has its own markup for the payment method, it is applied to the payment. Otherwise, the global markup is applied.

4. **Priority**: If you send an inline `markup` object, it takes precedence over the submerchant and global markups.

## Request Examples

```json PIX with Global Markup theme={null}
{
  "payment_method": "PIX",
  "invoice": "e3317882-f821-455b-b082-dc3ba36e8a57",
  "currency": "BRL",
  "amount": 100.50,
  "country": "BR",
  "beneficiary": {
    "name": "John Doe",
    "document": {
      "type": "CPF",
      "number": "12345678901"
    },
    "pix": {
      "key": "12345678901"
    }
  }
}
```

```bash cURL - PIX with Global Markup theme={null}
curl -X POST "https://api.sandbox.wepayout.com.br/v2/payout/payments" \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "payment_method": "PIX",
    "invoice": "e3317882-f821-455b-b082-dc3ba36e8a57",
    "currency": "BRL",
    "amount": 100.50,
    "country": "BR",
    "beneficiary": {
      "name": "John Doe",
      "document": {
        "type": "CPF",
        "number": "12345678901"
      },
      "pix": {
        "key": "12345678901"
      }
    }
  }'
```

## Response

**id** `integer`

WEpayment's auto generated id, use this id to perform conciliation or perform queries via API / Dashboard.

**merchant** `object`

Merchant object.

**Merchant**

**id** `integer`

Id of the WE account that created the payout.

**name** `string`

Name of the WE account that created the payout.

**payment\_method** `string`

Payment method used for the payout.

Values: `PIX`

**amount** `string`

The payout amount formatted with currency symbol.

**currency** `string`

Currency code (ISO 4217).

**invoice** `string`

Invoice identifier.

**status** `object`

Payout status.

**Status**

**id** `integer`

Status ID.

**name** `string`

Status name (e.g., "Awaiting").

**beneficiary** `object`

Beneficiary information.

**Beneficiary**

**name** `string`

Beneficiary name.

**document** `object`

Document information.

**markup** `object or null`

Markup configuration applied to this payment (submerchant or global).

**Markup Object**

**mode** `string`

Markup mode applied.

Values: `fixed`, `percent`

**amount** `number`

Markup value configured for this payment.

**min\_charge\_value** `number or null`

Minimum markup value when `mode` is `percent`. Will be `null` when `mode` is `fixed`.

**max\_charge\_value** `number or null`

Maximum markup value when `mode` is `percent`. Will be `null` when `mode` is `fixed` or when not specified.

**origin** `string or null`

Level of the markup that was applied.

Values: `sub_merchant`, `global`

```json 201 Created - PIX Payment with Global Markup theme={null}
{
  "id": 12345,
  "merchant": {
    "id": 477,
    "name": "Merchant Name"
  },
  "payment_method": "PIX",
  "amount": "R$ 100,50",
  "currency": "BRL",
  "invoice": "e3317882-f821-455b-b082-dc3ba36e8a57",
  "status": {
    "id": 1,
    "name": "Awaiting"
  },
  "beneficiary": {
    "name": "John Doe",
    "document": {
      "type": "CPF",
      "number": "12345678901"
    }
  },
  "markup": null
}
```

> [!NOTE]
>
> **Markup returns null**: It is normal for the `markup` field to return `null` when using global markup.

```json 422 Unprocessable Entity - Markup Required theme={null}
{
  "message": "The given data was invalid",
  "errors": {
    "markup": [
      "Inline markup is required when no global markup is configured"
    ]
  }
}
```

```json 500 Internal Server Error theme={null}
{
  "error": "Internal server error"
}
```

## Business Rules

> [!WARNING]
>
> **Markup Required**: If `enable_markup = true` for the submerchant and there is neither a submerchant markup nor a global markup configuration for the payment method, you must send an inline `markup` object. Otherwise, the request will fail with a 422 error.

> [!NOTE]
>
> **Automatic Application**: When `enable_markup = true` and a submerchant or global markup exists, it is automatically applied without requiring the `markup` object in the request.

## Error Scenarios

### Scenario 1: enable\_markup = true, No Submerchant or Global Markup, No Inline Markup

If the submerchant has `enable_markup = true` but:

* No submerchant markup configuration exists for the payment method
* No global markup configuration exists for the payment method
* No inline markup object is sent in the request

**Result**: Returns 422 error with message "O campo markup é obrigatório."

### Scenario 2: Error Verifying Global Markup

If there is an error while searching for or verifying the global markup configuration.

**Result**: Returns 422 error with message "Error verifying markup configuration. Please try again or contact support."

## Related Resources

> [card] [Create Payout with Inline Markup](https://docs.wepayout.co/api-reference/markup/payout/create-payout-with-inline-markup.md)
>
> Learn how to create payout with inline markup

> [card] [Create Merchant Markup](https://docs.wepayout.co/api-reference/markup/account/create-merchant-markup.md)
>
> Configure global markup for merchants

> [card] [About Markup](https://docs.wepayout.co/markup/about-markup.md)
>
> Understand markup types and configuration levels

> [card] [Create Payment](https://docs.wepayout.co/api-reference/cash-out/payout/create-payment.md)
>
> Complete documentation for creating payout payments


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.