{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Формат запроса к API","description":"Документация API 1Payment — приём платежей и выплаты.","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"формат-запроса-к-api","__idx":0},"children":["Формат запроса к API"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Взаимодействие с API 1Payment — через ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["HTTP-запросы"]}," на ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://api.1payment.com/<имя_метода>"]},". Конкретный URL и набор полей — на странице каждой операции в разделах приёма платежей и выплат."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Успешные и ошибочные ответы методов — ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["JSON"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"способы-передачи-параметров","__idx":1},"children":["Способы передачи параметров"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Способ"},"children":["Способ"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Как передать"},"children":["Как передать"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Заголовки"},"children":["Заголовки"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["GET"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Параметры в query string. Используется в примерах по умолчанию."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["—"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["POST"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Тело ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application/x-www-form-urlencoded"]},", те же поля, что в query для GET."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Content-Type: application/x-www-form-urlencoded"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["POST JSON"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Тело ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application/json"]}," с тем же набором полей."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Content-Type: application/json"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["В документации параметры часто показаны для ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["GET"]},", но для одного и того же метода допустимы ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["GET"]},", ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["POST"]}," или ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["POST JSON"]}," — выберите удобный вариант на своём сервере."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"подпись-запроса--sign-","__idx":2},"children":["Подпись запроса (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sign"]},")"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Защищённые методы требуют параметр ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sign"]}," — MD5, lowercase (hex) от строки:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"<имя_метода> + <параметры_без_sign_в_порядке_A-Z_через_&> + <API_KEY>\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Пример"]}," (метод ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["init_form"]},", в конец строки подставляется значение ключа проекта):"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"text","header":{"controls":{"copy":{}}},"source":"init_formamount=100.00&partner_id=123&project_id=456&shop_url=myshop.ru&user_data=order_777secret_key\n","lang":"text"},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["В подпись входят только ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["фактически переданные"]}," поля, кроме ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sign"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["API_KEY"]}," — ключ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["проекта"]}," (не глобальный ключ партнёра)."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Префикс метода (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["init_form"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["init_payment"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status_payment"]}," и т.д.) — как в документации операции."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Значения параметров в строке подписи — ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["как переданы"]},", без URL-кодирования. В PHP ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["не"]}," используйте ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http_build_query()"]}," для формирования строки подписи (она кодирует ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[":"]}," и другие символы); для HTTP-тела или query string ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http_build_query()"]}," допустим отдельно на шаге отправки запроса."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["На страницах методов есть виджет проверки подписи. Ошибка проверки — ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["error_code"]}," = ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["2"]},", см. ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pages/error-codes-api"},"children":["Коды ошибок (API)"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"колбеки-уведомления","__idx":3},"children":["Колбеки (уведомления)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Финальный статус платежа 1Payment отправляет ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["POST"]}," JSON на ваш ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["notify_url"]},". Подпись колбека — ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["без"]}," префикса имени метода: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["md5(<параметры_в_порядке_A-Z_через_&> + <API_KEY>)"]},". Ваш сервер должен ответить ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["HTTP 200 OK"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Полный перечень полей колбека и особенности по каждому методу — на страницах операций в разделах «Уведомления о статусе (колбеки)»."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"связанные-разделы","__idx":4},"children":["Связанные разделы"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pages/error-codes-api"},"children":["Коды ошибок (API)"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pages/payment-types"},"children":["Типы платежей"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pages/payout-types"},"children":["Типы выплат"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/pages/transaction-statuses"},"children":["Статусы транзакций"]}]}]}]},"headings":[{"value":"Формат запроса к API","id":"формат-запроса-к-api","depth":1},{"value":"Способы передачи параметров","id":"способы-передачи-параметров","depth":2},{"value":"Подпись запроса ( sign )","id":"подпись-запроса--sign-","depth":2},{"value":"Колбеки (уведомления)","id":"колбеки-уведомления","depth":2},{"value":"Связанные разделы","id":"связанные-разделы","depth":2}],"frontmatter":{"seo":{"title":"Формат запроса к API"}},"lastModified":"2026-05-26T17:03:47.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/pages/init-request","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}