### Python: Get Payment Link Example Source: https://wiki.aaio.so/priem-platezhei Shows an example in Python for generating a payment link. This snippet is useful for integrating payment processing into Python applications using the legacy order creation flow. ```python ```python # This is a placeholder for the actual Python code example. # The code would typically involve using a library or making an API call. print("Python Payment Link Example (Placeholder)") ``` ``` -------------------------------- ### Get AAIO Balance - cURL Example Source: https://wiki.aaio.so/api/poluchenie-balansa Demonstrates how to make a GET request to the AAIO API to retrieve the balance using cURL. It includes the necessary URL and headers. ```bash curl -X 'GET' \ 'https://aaio.so/api/balance' \ -H 'accept: application/json' \ -H 'x-api-key: API_KEY' ``` -------------------------------- ### PHP: Get Payment Link Example Source: https://wiki.aaio.so/priem-platezhei Demonstrates how to obtain a payment link using PHP, likely for redirecting users to a payment gateway. This is part of the legacy order creation method. ```php PHP Payment Link Example (Placeholder)

"; ?> ``` -------------------------------- ### Get Payment Methods - JSON Example Source: https://wiki.aaio.so/api/dostupnye-metody-dlya-sozdaniya-zakaza This JSON object demonstrates a successful response (HTTP 200) from the /api/methods-pay endpoint. It lists available payment methods, their names, minimum and maximum transaction amounts per currency, and commission details. This response is crucial for understanding the structure of available payment options. ```json { "type": "success", "list": { "tether_trc20": { "name": "Tether TRC-20", "min": { "RUB": 410, "UAH": 169, "USD": 6, "EUR": 5 }, "max": { "RUB": 25000, "UAH": 10246, "USD": 312, "EUR": 287 }, "commission_percent": 3, "commission_user_percent": 3, "commission_merchant_percent": 0, "commission_type": "0:100" } } } ``` -------------------------------- ### PHP: Create Order Form Example Source: https://wiki.aaio.so/priem-platezhei Provides an example implementation in PHP for creating an order via a form, a legacy method for payment processing. This snippet demonstrates how to construct and submit the payment form. ```php PHP Form Example (Placeholder)

"; ?> ``` -------------------------------- ### Install AAIO SDK (kewldan & lolkof) Source: https://wiki.aaio.so/gotovye-cms-moduli-i-sdk/python-3-sdk Installs the recommended AAIO SDK developed by kewldan and lolkof. This is the primary SDK to use for interacting with AAIO services via Python 3. It simplifies API calls and data handling. ```bash pip install aaio ``` -------------------------------- ### Install AAIO SDK (Belyashik2K) Source: https://wiki.aaio.so/gotovye-cms-moduli-i-sdk/python-3-sdk Installs the AaioAsync SDK developed by Belyashik2K. This SDK provides asynchronous capabilities for interacting with AAIO. It is suitable for applications requiring non-blocking I/O operations. ```bash pip install AaioAsync ``` -------------------------------- ### PHP: Payment Notification Handler Example Source: https://wiki.aaio.so/priem-platezhei An example handler written in PHP to process payment notifications. This is crucial for updating order status and confirming payments received. ```php 'success', 'message' => 'Notification processed (Placeholder)']); ?> ``` -------------------------------- ### Get Withdrawal Methods API Request Examples (cURL, PHP, Python) Source: https://wiki.aaio.so/api/dostupnye-metody-dlya-vyvoda-sredstv Demonstrates how to call the AAIO.SO API to get available withdrawal methods using cURL, PHP, and Python. Includes setting headers like 'Accept' and 'X-Api-Key', sending a POST request, and handling responses, including error codes and JSON parsing. Note that API key is required and should be kept confidential. ```bash curl -X 'POST' \ 'https://aaio.so/api/methods-payoff' \ -H 'accept: application/json' \ -H 'x-api-key: API_KEY' ``` ```php $merchant_id, 'amount' => $amount, 'currency' => $currency, 'order_id' => $order_id, 'sign' => $sign, 'desc' => $desc, 'lang' => $lang ]); ?> ``` -------------------------------- ### Get AAIO Balance - Python Example Source: https://wiki.aaio.so/api/poluchenie-balansa A Python script utilizing the requests library to retrieve balance information from the AAIO API. It includes error handling for connection and read timeouts, and processes JSON responses. ```python import requests, sys from requests.exceptions import ConnectTimeout, ReadTimeout url = 'https://aaio.so/api/balance' api_key = '' # Ключ API из раздела https://aaio.so/cabinet/api headers = { 'Accept': 'application/json', 'X-Api-Key': api_key } try: response = requests.post(url, headers=headers, timeout=(15, 60)) except ConnectTimeout: print('ConnectTimeout') # Не хватило времени на подключение к сайту sys.exit() except ReadTimeout: print('ReadTimeout') # Не хватило времени на выполнение запроса sys.exit() if(response.status_code in [200, 400, 401]): try: response_json = response.json() # Парсинг результата except: print('Не удалось пропарсить ответ') sys.exit() if(response_json['type'] == 'success'): print(response_json) # Вывод результата else: print('Ошибка: ' + response_json['message']) # Вывод ошибки else: print('Response code: ' + str(response.status_code)) # Вывод неизвестного кода ответа ``` -------------------------------- ### POST /websites/wiki_aaio_so Source: https://wiki.aaio.so/priem-platezhei/redirekt-klienta-s-formy-oplaty Handles redirects from the payment form. A GET request is made to your Success or Failure URLs with order details. ```APIDOC ## GET /websites/wiki_aaio_so ### Description This endpoint describes the parameters used for redirecting a client from the payment form to your Success or Failure URLs. The redirect is performed via a GET request. ### Method GET ### Endpoint `/websites/wiki_aaio_so` ### Query Parameters - **order_id** (string) - Required - The identifier of the order in your system. - **amount** (float) - Required - The amount of the order. - **currency** (string) - Required - The currency of the order. Possible values: `RUB`, `UAH`, `EUR`, `USD` ### Request Example ``` GET /websites/wiki_aaio_so?order_id=YOUR_ORDER_ID&amount=100.50¤cy=USD ``` ### Response #### Success Response (200) This is a redirect, so the response will be a redirect to the specified Success or Failure URL with the query parameters appended. No specific JSON response is provided by this documentation. #### Response Example (Example of a redirect to a Success URL) ``` HTTP/1.1 302 Found Location: https://your-success-url.com/?order_id=YOUR_ORDER_ID&amount=100.50¤cy=USD ``` ``` -------------------------------- ### GET /api/methods-pay Source: https://wiki.aaio.so/api/dostupnye-metody-dlya-sozdaniya-zakaza Retrieves a list of available payment methods for order creation. Requires an API key with specific permissions. ```APIDOC ## GET /api/methods-pay ### Description Retrieves a list of available payment methods for order creation. Requires an API key with specific permissions. ### Method GET ### Endpoint https://aaio.so/api/methods-pay ### Headers - **Accept** (string) - Required - `application/json` - **Content-Type** (string) - Required - `application/x-www-form-urlencoded` - **X-Api-Key** (string) - Required - Your API key obtained from AAIO.so business API keys section. ### Parameters #### Query Parameters - **merchant_id** (uuid) - Required - The ID of your store. ### Request Example ``` GET https://aaio.so/api/methods-pay?merchant_id=your_merchant_id Headers: Accept: application/json Content-Type: application/x-www-form-urlencoded X-Api-Key: YOUR_API_KEY ``` ### Response #### Success Response (200) - **type** (string) - Indicates the success or failure of the request (`success` or `fail`). - **list** (object) - Contains details about available payment methods. - **[method_key]** (object) - Represents a specific payment method (e.g., `tether_trc20`). - **name** (string) - The display name of the payment method. - **min** (object) - Minimum payment amount for different currencies. - **max** (object) - Maximum payment amount for different currencies. - **commission_percent** (number) - Total commission percentage. - **commission_user_percent** (number) - Commission percentage for the user. - **commission_merchant_percent** (number) - Commission percentage for the merchant. - **commission_type** (string) - Commission ratio format (`merchant:user`). #### Error Response (400, 401, 429, 500, 503) - **type** (string) - Indicates the success or failure of the request (`success` or `fail`). - **code** (string) - The HTTP status code or a custom error code. - **message** (string) - A message describing the error. #### Response Example (Success) ```json { "type": "success", "list": { "tether_trc20": { "name": "Tether TRC-20", "min": { "RUB": 410, "UAH": 169, "USD": 6, "EUR": 5 }, "max": { "RUB": 25000, "UAH": 10246, "USD": 312, "EUR": 287 }, "commission_percent": 3, "commission_user_percent": 3, "commission_merchant_percent": 0, "commission_type": "0:100" } } } ``` #### Response Example (Error) ```json { "type": "fail", "code": "400", "message": "Invalid input" } ``` ``` -------------------------------- ### Доступные методы для создания заказа API Source: https://wiki.aaio.so/api API for business to get available methods for creating an order. ```APIDOC ## GET /api/dostupnye-metody-dlya-sozdaniya-zakaza.md ### Description API for business to get available methods for creating an order. ### Method GET ### Endpoint /api/dostupnye-metody-dlya-sozdaniya-zakaza.md ``` -------------------------------- ### Get AAIO Balance - PHP Example Source: https://wiki.aaio.so/api/poluchenie-balansa Provides a PHP script to fetch the balance from the AAIO API. It uses cURL to send the request and handles success and error responses, including JSON parsing and error checking. ```php ``` -------------------------------- ### AAIO.SO API Response Examples (JSON) Source: https://wiki.aaio.so/api/dostupnye-metody-dlya-vyvoda-sredstv Illustrates the JSON structure for API responses when retrieving withdrawal methods. Includes a 'success' type response detailing withdrawal method information (name, min/max amounts, commission) and a 'fail' type response with error codes and messages. These examples are crucial for parsing API results and handling potential errors. ```json { "type": "success", "list": { "tether_trc20": { "name": "Tether TRC-20", "min": 500, "max": 40000, "commission_percent": 3, "commission_sum": 0 } } } ``` ```json { "type": "fail", "code": "400", "message": "message" } ``` -------------------------------- ### Информация о заказе API Source: https://wiki.aaio.so/api API for business to get information about an order. ```APIDOC ## GET /api/informaciya-o-zakaze.md ### Description API for business to get information about an order. ### Method GET ### Endpoint /api/informaciya-o-zakaze.md ``` -------------------------------- ### GET /api/info-pay Source: https://wiki.aaio.so/api/informaciya-o-zakaze Retrieves detailed information about a specific payment order. This endpoint supports both GET and POST methods, but parameters are sent via URL-encoded form data. ```APIDOC ## GET /api/info-pay ### Description Retrieves detailed information about a specific payment order, including its status, amounts, and associated details. ### Method GET, POST ### Endpoint `https://aaio.so/api/info-pay` ### Headers - `Accept`: `application/json` - `Content-Type`: `application/x-www-form-urlencoded` - `X-Api-Key`: `{api_key}` (Required) #### Header Parameters - **`{api_key}`** (string) - Required - Your API key obtained from the AAIO.SO business panel with 'Information about created invoice' permissions. ### Parameters (URL-encoded) #### Query Parameters - **`order_id`** (string) - Required - The unique identifier of the order in your system. - **`merchant_id`** (uuid) - Required - The ID of your merchant account. ### Request Example ``` POST https://aaio.so/api/info-pay Content-Type: application/x-www-form-urlencoded X-Api-Key: YOUR_API_KEY order_id=my_id_123&merchant_id=f56b279c-d250-11ed-afa1-0242ac120002 ``` ### Response #### Success Response (200) - **`type`** (string) - Indicates the success of the request ('success'). - **`id`** (uuid) - The order ID in the AAIO.SO system. - **`order_id`** (string) - The order ID from your system. - **`desc`** (string) - Description of the order. - **`merchant_id`** (uuid) - Your merchant ID. - **`merchant_domain`** (string) - Your merchant domain. - **`method`** (string) - The payment method used (if specified). - **`amount`** (number) - The amount in the payment currency. - **`currency`** (string) - The currency of the payment. - **`profit`** (number) - The net amount credited to your balance (in RUB). - **`commission`** (number) - The merchant commission (in RUB). - **`commission_client`** (number) - The client commission (in RUB). - **`commission_type`** (string) - The commission type in ratio (Merchant Commission:Buyer Commission). - **`email`** (string) - The customer's email (if provided). - **`status`** (string) - The status of the order (e.g., 'in_process', 'success', 'expired', 'hold'). - **`date`** (string) - The date and time the order was created. - **`expired_date`** (string) - The date and time by which the order must be paid. - **`complete_date`** (string) - The date and time the order was completed (only if status is 'success'). - **`us_vars`** (array) - User-defined variables. #### Response Example (Success) ```json { "type": "success", "id": "48ebfc18-e6c7-11ed-a05b-0242ac120003", "order_id": "my_id_123", "desc": "Описание заказа", "merchant_id": "f56b279c-d250-11ed-afa1-0242ac120002", "merchant_domain": "aaio.io", "method": "tether_trc20", "amount": 500, "currency": "RUB", "profit": 485, "commission": 15, "commission_client": 0, "commission_type": "100:0", "email": "example@domain.com", "status": "success", "date": "2023-03-10 17:08:42", "expired_date": "2023-03-11 17:09:21", "complete_date": "2023-03-10 17:09:21", "us_vars": [] } ``` #### Error Responses - **400 Bad Request**: Invalid request parameters. - **401 Unauthorized**: Missing or invalid API key. - **429 Too Many Requests**: Rate limit exceeded. - **500 Internal Server Error**: Server-side error. - **503 Service Unavailable**: The API is temporarily unavailable. #### Response Example (Error) ```json { "type": "fail", "code": "400", "message": "Invalid order ID provided." } ``` ``` -------------------------------- ### Доступные методы для вывода средств API Source: https://wiki.aaio.so/api API for business to get available methods for withdrawals. ```APIDOC ## GET /api/dostupnye-metody-dlya-vyvoda-sredstv.md ### Description API for business to get available methods for withdrawals. ### Method GET ### Endpoint /api/dostupnye-metody-dlya-vyvoda-sredstv.md ``` -------------------------------- ### Курс валют при выводе средств API Source: https://wiki.aaio.so/api API for business to get currency exchange rates for withdrawals. ```APIDOC ## GET /api/kurs-valyut-pri-vyvode-sredstv.md ### Description API for business to get currency exchange rates for withdrawals. ### Method GET ### Endpoint /api/kurs-valyut-pri-vyvode-sredstv.md ``` -------------------------------- ### GET /api/methods-payoff Source: https://wiki.aaio.so/api/dostupnye-metody-dlya-vyvoda-sredstv Retrieves a list of available methods for fund withdrawal. Requires an API key with appropriate permissions. ```APIDOC ## GET /api/methods-payoff ### Description Retrieves a list of available methods for fund withdrawal from the AAIO.SO platform. This endpoint is crucial for displaying withdrawal options to users. ### Method GET ### Endpoint https://aaio.so/api/methods-payoff ### Headers - **Accept** (string) - Required - `application/json` - **X-Api-Key** (string) - Required - Your API key obtained from the AAIO.SO business section. ### Request Example ```json { "headers": { "Accept": "application/json", "X-Api-Key": "YOUR_API_KEY" } } ``` ### Response #### Success Response (200) - **type** (string) - Indicates the success of the operation ('success'). - **list** (object) - An object containing details of each withdrawal method. - **method_key** (string) - The internal code name for the withdrawal method (e.g., 'tether_trc20'). - **name** (string) - The human-readable name of the withdrawal method (e.g., 'Tether TRC-20'). - **min** (number) - The minimum withdrawal amount in rubles. - **max** (number) - The maximum withdrawal amount in rubles. - **commission_percent** (number) - The commission percentage for the withdrawal. - **commission_sum** (number) - The fixed commission amount in rubles. #### Error Response (400, 401, 429, 500, 503) - **type** (string) - Indicates failure ('fail'). - **code** (string) - The HTTP status code or a custom error code. - **message** (string) - A description of the error. #### Response Example (Success) ```json { "type": "success", "list": { "tether_trc20": { "name": "Tether TRC-20", "min": 500, "max": 40000, "commission_percent": 3, "commission_sum": 0 } } } ``` #### Response Example (Error) ```json { "type": "fail", "code": "400", "message": "Invalid API key" } ``` ``` -------------------------------- ### Handle AAIO.IO Payment Notification in PHP Source: https://wiki.aaio.so/priem-platezhei/opoveshenie-ob-oplate-zakaza/primer-obrabotchika-na-php This PHP script validates incoming payment notifications from AAIO.IO. It checks the request method, amount, currency, client IP address against a list of service IPs, and verifies the digital signature to ensure the payment is legitimate. Dependencies include standard PHP functions and a secure connection to fetch AAIO.IO's IP list. ```php 1) { $ip = $explode[0]; } return trim($ip); } // Проверка на IP адрес сервиса (по желанию) $ctx = stream_context_create([ 'http' => [ 'timeout' => 10 ] ]); $ips = json_decode(file_get_contents('https://aaio.io/api/public/ips', false, $ctx)); if (isset($ips->list) && !in_array(getIP(), $ips->list)) { die("hacking attempt"); } // Конец проверки на IP адрес сервиса $sign = hash('sha256', implode(':', [$_POST['merchant_id'], $_POST['amount'], $_POST['currency'], $secret, $_POST['order_id']])); if (!hash_equals($_POST['sign'], $sign)) { die("wrong sign"); } //Так же, рекомендуется проверять не был ли этот заказ уже оплачен или отменен //Оплата прошла успешно, можно проводить операцию. die('OK'); ``` -------------------------------- ### HTML Form for AAIO.SO Payment Submission Source: https://wiki.aaio.so/priem-platezhei/sozdanie-zakaza-perekhodom-na-formu-ustarevshee/primer-formy-na-php This HTML form is designed to be submitted to the AAIO.SO payment gateway. It uses hidden input fields to send the payment details, including the merchant ID, amount, currency, order ID, description, language, and the security signature generated by the PHP code. ```html
``` -------------------------------- ### Генерация платежной ссылки AAIO.SO на Python Source: https://wiki.aaio.so/priem-platezhei/sozdanie-zakaza-perekhodom-na-formu-ustarevshee/primer-polucheniya-ssylki-na-python Этот код на Python демонстрирует процесс создания платежной ссылки для сервиса AAIO.SO. Он включает в себя расчет хеш-подписи для обеспечения безопасности транзакции. Для работы требуется библиотека hashlib и urllib. ```python import hashlib from urllib.parse import urlencode merchant_id = '' # ID Вашего магазина amount = 10.54 # Сумма к оплате currency = 'RUB' # Валюта заказа secret = '' # Секретный ключ №1 из настроек магазина order_id = 'python_order_1' # Идентификатор заказа в Вашей системе desc = 'Order Payment' # Описание заказа lang = 'ru' # Язык формы sign = f':'.join([ str(merchant_id), str(amount), str(currency), str(secret), str(order_id) ]) params = { 'merchant_id': merchant_id, 'amount': amount, 'currency': currency, 'order_id': order_id, 'sign': hashlib.sha256(sign.encode('utf-8')).hexdigest(), 'desc': desc, 'lang': lang } # Выводим ссылку print("https://aaio.so/merchant/pay?" + urlencode(params)) ``` -------------------------------- ### POST /api/methods-pay Source: https://wiki.aaio.so/api/dostupnye-metody-dlya-sozdaniya-zakaza This endpoint is used to initiate a payment or retrieve payment methods. It requires an API key for authentication and a merchant ID. ```APIDOC ## POST /api/methods-pay ### Description This endpoint is used to initiate a payment or retrieve payment methods. It requires an API key for authentication and a merchant ID. ### Method POST ### Endpoint https://aaio.so/api/methods-pay ### Parameters #### Headers - **accept** (string) - Required - Specifies the expected response format, usually `application/json`. - **x-api-key** (string) - Required - Your unique API key for authentication. #### Request Body - **merchant_id** (string) - Required - The unique identifier for your merchant account. ### Request Example ```json { "merchant_id": "f56b279c-d250-11ed-afa1-0242ac120002" } ``` ### Response #### Success Response (200) - **type** (string) - Indicates the status of the operation, e.g., "success". - **message** (string) - A descriptive message about the operation outcome. #### Response Example ```json { "type": "success", "message": "Operation successful.", "data": { ... } } ``` #### Error Response - **type** (string) - Indicates an error, e.g., "error". - **message** (string) - A description of the error. #### Error Response Example ```json { "type": "error", "message": "Invalid API key." } ``` ``` -------------------------------- ### Make Payment Request using Python Source: https://wiki.aaio.so/api/dostupnye-metody-dlya-sozdaniya-zakaza This Python script utilizes the `requests` library to send a payment request to the AAIO.SO API. It includes configurations for URL, headers, and POST data, along with robust error handling for connection and read timeouts, and response parsing. ```python import requests, sys from requests.exceptions import ConnectTimeout, ReadTimeout url = 'https://aaio.so/api/methods-pay' api_key = '' # Ключ API из раздела https://aaio.so/cabinet/api merchant_id = 'f56b279c-d250-11ed-afa1-0242ac120002' # ID Вашего магазина params = { 'merchant_id': merchant_id } headers = { 'Accept': 'application/json', 'X-Api-Key': api_key } try: response = requests.post(url, data=params, headers=headers, timeout=(15, 60)) except ConnectTimeout: print('ConnectTimeout') # Не хватило времени на подключение к сайту sys.exit() except ReadTimeout: print('ReadTimeout') # Не хватило времени на выполнение запроса sys.exit() if(response.status_code in [200, 400, 401]): try: response_json = response.json() # Парсинг результата except: print('Не удалось пропарсить ответ') sys.exit() if(response_json['type'] == 'success'): print(response_json) # Вывод результата else: print('Ошибка: ' + response_json['message']) # Вывод ошибки else: print('Response code: ' + str(response.status_code)) # Вывод неизвестного кода ответа ``` -------------------------------- ### Make Payment Request using cURL Source: https://wiki.aaio.so/api/dostupnye-metody-dlya-sozdaniya-zakaza This snippet demonstrates how to make a POST request to the AAIO.SO API's payment endpoint using cURL. It includes setting the necessary headers and data payload. Ensure you replace 'API_KEY' with your actual API key. ```bash curl -X 'POST' \ 'https://aaio.so/api/methods-pay' \ -H 'accept: application/json' \ -H 'x-api-key: API_KEY' \ -d 'merchant_id=f56b279c-d250-11ed-afa1-0242ac120002' ``` -------------------------------- ### Get SBP Payoff Banks List (cURL) Source: https://wiki.aaio.so/api/banki-dlya-vyvoda-sredstv-na-sbp This snippet demonstrates how to make a GET request to the AAIO SBP payoff banks endpoint using cURL. It includes the necessary headers for authentication and content type negotiation. The request retrieves a list of banks available for SBP transfers. ```bash curl -X 'GET' \ 'https://aaio.so/api/sbp-banks-payoff' \ -H 'accept: application/json' \ -H 'x-api-key: API_KEY' ``` -------------------------------- ### Пример успешного ответа AAIO SO API Source: https://wiki.aaio.so/priem-platezhei/sozdanie-zakaza-zaprosom-rekomenduem Пример JSON ответа от AAIO SO API при успешном создании заказа. Возвращает тип 'success' и URL для проведения оплаты. ```json { "type": "success", "url": "https://......" // URL для оплаты } ``` -------------------------------- ### Получение информации об оплате через API AAIO.so Source: https://wiki.aaio.so/api/informaciya-o-zayavke-na-vyvod-sredstv Этот пример демонстрирует, как получить информацию о выводе средств через API AAIO.so. Он включает в себя примеры реализации на cURL, PHP и Python. Обратите внимание на необходимость указания вашего API ключа и ID вывода средств. Обработка ошибок и парсинг JSON ответа также представлены. ```bash curl -X 'POST' \ 'https://aaio.so/api/info-payoff' \ -H 'accept: application/json' \ -H 'x-api-key: API_KEY' \ -d 'my_id=my_id_123' ``` ```php $my_id ])); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15); // Таймаут подключения к нашему серверу curl_setopt($ch, CURLOPT_TIMEOUT, 60); // Таймаут обработки запроса $result = curl_exec($ch); // Ответ $http_code = curl_getinfo($ch, CURLINFO_RESPONSE_CODE); // Код ответа if (curl_errno($ch)) { die('Connect error:' . curl_error($ch)); // Вывод ошибки соединения } curl_close($ch); if(!in_array($http_code, [200, 400, 401])) { die('Response code: ' . $http_code); // Вывод неизвестного кода ответа } $decoded = json_decode($result, true); // Парсинг результа. На выходе получаем массив данных if(json_last_error() !== JSON_ERROR_NONE) { die('Не удалось пропарсить ответ'); } if($decoded['type'] == 'success') { print_r($decoded); // Вывод результата } else { die('Ошибка: ' . $decoded['message']); // Вывод ошибки } ``` ```python import requests, sys from requests.exceptions import ConnectTimeout, ReadTimeout url = 'https://aaio.so/api/info-payoff' api_key = '' # Ключ API из раздела https://aaio.so/cabinet/api my_id = 'my_id_123' # ID вывода средств в Вашей системе params = { 'my_id': my_id } headers = { 'Accept': 'application/json', 'X-Api-Key': api_key } try: response = requests.post(url, data=params, headers=headers, timeout=(15, 60)) except ConnectTimeout: print('ConnectTimeout') # Не хватило времени на подключение к сайту sys.exit() except ReadTimeout: print('ReadTimeout') # Не хватило времени на выполнение запроса sys.exit() if(response.status_code in [200, 400, 401]): try: response_json = response.json() # Парсинг результата except: print('Не удалось пропарсить ответ') sys.exit() if(response_json['type'] == 'success'): print(response_json) # Вывод результата else: print('Ошибка: ' + response_json['message']) # Вывод ошибки else: print('Response code: ' + str(response.status_code)) # Вывод неизвестного кода ответа ```