> ## 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 Payin with Global Markup

> Create a payin charge using global markup configuration.

# Create Payin with Global Markup

When creating a payin charge, 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` (payin)
   * `payment_method` (pix, boleto, etc.)

3. **Application**: If the submerchant has its own markup for the payment method, it is applied to the charge. 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": "YOUR-CODE1234",
  "currency": "BRL",
  "amount": 10000,
  "country": "BR",
  "buyer": {
    "name": "Buyer Name",
    "document": {
      "type": "CPF",
      "number": "34960826312"
    },
    "email": "buyer-email@wepayments.com.br"
  },
  "pix": {
    "expire_date": "2025-12-31T23:59:59"
  }
}
```

```json Boleto with Global Markup theme={null}
{
  "payment_method": "boleto",
  "invoice": "YOUR-INVOICE-CODE",
  "currency": "BRL",
  "amount": 50000,
  "country": "BR",
  "buyer": {
    "name": "Buyer Name",
    "email": "buyer@example.com",
    "document": {
      "type": "CPF",
      "number": "12345678901"
    },
    "address": {
      "street": "Street Name",
      "number": "123",
      "complement": "Apt 456",
      "zipcode": "12345000",
      "city": "City Name",
      "district": "District Name",
      "state_code": "SP"
    }
  },
  "originator_legal_entity": {
    "name": "Company Name",
    "document": "12345678901",
    "helpdesk": "company.com"
  },
  "boleto": {
    "expire_date": "2025-12-31"
  }
}
```

```bash cURL - PIX with Global Markup theme={null}
curl -X POST "https://api.sandbox.wepayout.com.br/v2/payin/payments" \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "payment_method": "pix",
    "invoice": "YOUR-CODE1234",
    "currency": "BRL",
    "amount": 10000,
    "country": "BR",
    "buyer": {
      "name": "Buyer Name",
      "document": {
        "type": "CPF",
        "number": "34960826312"
      },
      "email": "buyer-email@wepayments.com.br"
    },
    "pix": {
      "expire_date": "2025-12-31T23:59:59"
    }
  }'
```

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

**name** `string`

Name of the WE account that created the payin.

**hash** `string`

WEpayments auto generated hash, use this hash to send your user to the payment page.

**payment\_page** `string`

The WEpayments payment page is the place where you will redirect the end customer to pay the bill.

**invoice** `string`

Your identification number.

**payment\_method** `string`

Payment method that will be used in payin.

Values: `pix`, `boleto`

**amount** `integer`

The payin total amount in cents.

**currency** `object`

Currency object.

**Currency**

**id** `integer`

Currency id.

**code** `string`

Currency code (ISO 4217).

**status** `string`

Current status of the payin.

Example: `pending`

**markup** `object`

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

**Markup Object**

**mode** `string`

Markup mode applied.

Values: `fixed`, `percent`

**amount** `number`

Markup value configured for this charge.

**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 Charge with Global Markup theme={null}
{
  "id": 51687,
  "merchant": {
    "id": 477,
    "name": "Merchant Name"
  },
  "hash": "abc123def456",
  "payment_page": "https://payment.wepayments.com.br/abc123def456",
  "invoice": "YOUR-CODE1234",
  "payment_method": "pix",
  "amount": 10000,
  "currency": {
    "id": 1,
    "code": "BRL"
  },
  "status": "pending",
  "markup": {
    "mode": "percent",
    "amount": 2.5,
    "min_charge_value": 0.50,
    "max_charge_value": 10.00,
    "origin": "sub_merchant"
  }
}
```

```json 422 Unprocessable Entity - Markup Required theme={null}
{
  "status": false,
  "message": "Validation error",
  "data": {
    "markup": [
      "O campo markup é obrigatório."
    ]
  }
}
```

```json 422 Unprocessable Entity - Error Verifying Markup theme={null}
{
  "message": "Os dados fornecidos são inválidos.",
  "errors": {
    "markup": [
      "Error verifying markup configuration. Please try again or contact support."
    ]
  }
}
```

```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 Payin with Inline Markup](https://docs.wepayout.co/api-reference/markup/payin/create-payin-with-inline-markup.md)
>
> Learn how to create payin 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 Charge](https://docs.wepayout.co/api-reference/cash-in/payin/create-charge)
>
> Complete documentation for creating payin charges


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