# PIX This method initiates a **payout via PIX** (Brazil). Send a request to the `init_payout` endpoint with `payout_type=pix`. The final status is sent to `notify_url` configured in the project payout settings; you can also poll status via [Payout status](./status.md). Request and signature format — see [API request format](../init-request.md). ## How it works 1. **Request** — your server sends a signed request to `init_payout` with the recipient Tax ID / CPF and payout amount. 2. **Response** — the API returns `order_id` and initial `status` (`2`, `PENDING`). 3. **Processing** — the system processes the payout. 4. **Notification (callback)** — the final status is sent as **POST** JSON to your `notify_url`. See [Transaction statuses](../transaction-statuses.md) for `status` and `status_description` codes. ## Technical details | | | | --- | --- | | **Endpoint** | `https://api.1payment.com/init_payout` | | **Methods** | `GET`, `POST` | | **Response format** | JSON | | **Payout type** | The request must include `payout_type=pix` (see [Payout types](../payout-types.md)) | ## Request parameters ### Required | Parameter | Type | Description | | --- | --- | --- | | `payout_type` | String | Always `pix`. | | `partner_id` | Integer | Your unique ID in the 1Payment system. | | `project_id` | Integer | Your project identifier. | | `amount` | Number | Payout amount: strictly **from 10 to 15000** (in the project currency). | | `destination` | String | Recipient Tax ID / CPF. | | `user_data` | String | Your internal payout ID (unique on the partner side). | | `sign` | String | Request signature (see the Signature section). | ## Signature (`sign`) Signature: MD5, lowercase (hex). General rules — [API request format](../init-request.md#подпись-запроса-sign). **Formula:** ```text MD5(init_payout + + ) ``` **Example string before hashing:** ```text init_payoutamount=50&destination=12345&partner_id=1234&payout_type=pix&project_id=5678&user_data=1secret_key ``` ### Verify signature in the documentation {% signatureVerifier method="init_payout" preset="pix_init_payout" /%} ## Request examples {% codeTabs %} {% tab label="Node.js" %} ```javascript const crypto = require('crypto'); const axios = require('axios'); async function createPixPayout(apiKey, params) { // 1. Сортируем параметры по алфавиту const sortedKeys = Object.keys(params).sort(); const queryString = sortedKeys.map((key) => `${key}=${params[key]}`).join('&'); // 2. Подпись с префиксом init_payout const baseString = `init_payout${queryString}${apiKey}`; params.sign = crypto.createHash('md5').update(baseString).digest('hex'); // 3. GET-запрос const response = await axios.get('https://api.1payment.com/init_payout', { params }); return response.data; } const apiKey = process.env.ONEPAYMENT_API_KEY; const data = { payout_type: 'pix', partner_id: 1234, project_id: 5678, amount: 50, destination: '12345', user_data: '1', }; createPixPayout(apiKey, data).then(console.log); ``` {% /tab %} {% tab label="Python" %} ```python import hashlib import os import requests def create_pix_payout(api_key: str, params: dict) -> dict: # 1. Сортировка параметров по алфавиту sorted_keys = sorted(params.keys()) query_string = "&".join(f"{k}={params[k]}" for k in sorted_keys) # 2. Подпись init_payout base_string = f"init_payout{query_string}{api_key}" params["sign"] = hashlib.md5(base_string.encode("utf-8")).hexdigest() # 3. GET-запрос response = requests.get("https://api.1payment.com/init_payout", params=params) response.raise_for_status() return response.json() api_key = os.environ["ONEPAYMENT_API_KEY"] data = { "payout_type": "pix", "partner_id": 1234, "project_id": 5678, "amount": 50, "destination": "12345", "user_data": "1", } print(create_pix_payout(api_key, data)) ``` {% /tab %} {% tab label="PHP" %} ```php $v) { if ($k === 'sign') { continue; } $tail .= "{$k}={$v}&"; } $tail = substr($tail, 0, -1); // 2. Формирование подписи (префикс init_payout) $params['sign'] = md5('init_payout' . $tail . $apiKey); // 3. Запрос к API $url = 'https://api.1payment.com/init_payout?' . http_build_query($params); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); return $response; } // Пример данных запроса $apiKey = getenv('ONEPAYMENT_API_KEY'); $data = [ 'payout_type' => 'pix', 'partner_id' => 1234, 'project_id' => 5678, 'amount' => 50, 'destination' => '12345', 'user_data' => '1', ]; echo createPixPayout($apiKey, $data); ``` {% /tab %} {% tab label="cURL" %} ```bash # 1–2. Подпись: md5("init_payout" + amount=50&destination=12345&partner_id=1234&payout_type=pix&project_id=5678&user_data=1 + API_KEY) curl -sS "https://api.1payment.com/init_payout?payout_type=pix&partner_id=1234&project_id=5678&amount=50&destination=12345&user_data=1&sign=PASTE_MD5_HEX" ``` {% /tab %} {% /codeTabs %} ## API response Successful response (`200`): ```json { "order_id": "8p3brmb19gfg0sg8gcwhws8kgc748s87", "status": 2, "status_description": "PENDING", "status_code": 0 } ``` | Field | Description | | --- | --- | | `order_id` | Payout ID in the 1Payment system; use for [status requests](./status.md). | | `status` | Numeric status code: `2` — pending, `3` — success, `4` — declined. | | `status_description` | `PENDING`, `SUCCESS`, or `FAILURE`. | | `status_code` | Decline reason code (when `status` = `4`); see [Error codes (declines)](../decline-error-codes.md). | Request error (`400`): ```json { "error_code": 2 } ``` ## Status notifications (callbacks) After the payout reaches a **final** status, a **POST** notification in JSON format is sent to your `notify_url` (from project payout settings). Structure is the same as for other payouts; `payout_type` is `pix`. **Important:** your server must return **HTTP 200 OK**. Otherwise the system retries the callback **once per minute for 10 minutes**. **Callback signature verification:** MD5 of all parameters in alphabetical order joined with `&` + `API_KEY` (**without** the `init_payout` prefix). See [API request format](../init-request.md#колбеки-уведомления) for details. ## Related sections - [Payout status](./status.md) - [Bank card](./card.md) - [SEPA](./sepa.md) - [FPS](./fps.md) - [SBP payout](./sbp.md) - [Payout types](../payout-types.md) - [Transaction statuses](../transaction-statuses.md) - [Error codes (API)](../error-codes-api.md) - [Error codes (declines)](../decline-error-codes.md)