{"openapi":"3.0.3","info":{"title":"Amypay API","version":"v2","description":"Приём платежей, выдача реквизитов, загрузка чеков и управление заказами мерчанта."},"servers":[{"url":"https://amypay.ru"}],"components":{"securitySchemes":{"BearerApiKey":{"type":"http","scheme":"bearer","description":"API-ключ кассы (merchants.api_key)"}},"schemas":{"Order":{"type":"object","properties":{"number":{"type":"string"},"amount":{"type":"number"},"currency":{"type":"string","example":"RUB"},"status":{"type":"string","enum":["pending","review","paid","canceled","refunded","failed"]},"external_order_id":{"type":"string","nullable":true},"pay_url":{"type":"string","format":"uri"},"pay_token":{"type":"string"},"created_at":{"type":"integer"}}},"OrderCreate":{"type":"object","required":["amount"],"properties":{"amount":{"type":"number","minimum":0.01,"description":"Сумма в RUB"},"external_order_id":{"type":"string"},"description":{"type":"string"},"payer_email":{"type":"string","format":"email"},"metadata":{"type":"object","additionalProperties":true,"description":"Произвольные данные, не более 4 КБ"}}},"AvailablePaymentMethod":{"type":"object","properties":{"method_id":{"type":"integer","example":10},"code":{"type":"string","example":"p2p_sbp"},"title":{"type":"string","example":"СБП"},"icon":{"type":"string","nullable":true},"currency":{"type":"string","example":"RUB"},"estimated_pay_amount":{"type":"number","example":1002.14},"payable_rub":{"type":"number","example":1002.14},"rate_to_rub":{"type":"number","example":1},"client_fee_percent":{"type":"number","example":0},"client_fee_rub":{"type":"number","example":2.1400000000000001},"min_amount":{"type":"number"},"max_amount":{"type":"number"}}},"Payment":{"type":"object","properties":{"method":{"type":"object","properties":{"method_id":{"type":"integer"},"code":{"type":"string"},"title":{"type":"string","nullable":true},"currency":{"type":"string"}}},"provider":{"type":"string","nullable":true},"pay_amount":{"type":"number"},"pay_currency":{"type":"string"},"payable_rub":{"type":"number","nullable":true},"rate_to_rub":{"type":"number","nullable":true},"requisites":{"type":"object","properties":{"type":{"type":"string","enum":["sbp","card","yoomoney","crypto_invoice","crypto","external"]},"address":{"type":"string"},"bank_name":{"type":"string","nullable":true},"recipient_name":{"type":"string","nullable":true}}},"expires_at":{"type":"integer","nullable":true,"description":"Unix timestamp"},"expires_in":{"type":"integer","nullable":true,"description":"Оставшийся TTL в секундах"}}},"Error":{"type":"object","properties":{"ok":{"type":"boolean"},"error":{"type":"string"}}}},"responses":{"ErrorResponse":{"description":"Ошибка запроса","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"security":[{"BearerApiKey":[]}],"paths":{"/api/v2/ping":{"get":{"summary":"Проверка связи","tags":["Utility"],"security":[],"responses":{"200":{"description":"OK"}}}},"/api/v2/orders":{"post":{"summary":"Создать платёж","tags":["Orders"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderCreate"}}}},"responses":{"201":{"description":"Order created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"order":{"$ref":"#/components/schemas/Order"}}}}}},"200":{"description":"Existing order reused for the same external_order_id and amount"},"401":{"$ref":"#/components/responses/ErrorResponse"},"409":{"$ref":"#/components/responses/ErrorResponse"},"422":{"$ref":"#/components/responses/ErrorResponse"}}},"get":{"summary":"Список заказов мерчанта","tags":["Orders"],"parameters":[{"in":"query","name":"page","schema":{"type":"integer","default":1}}],"responses":{"200":{"description":"OK"}}}},"/api/v2/orders/{number}":{"get":{"summary":"Информация о заказе","tags":["Orders"],"parameters":[{"in":"path","name":"number","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK"},"404":{"$ref":"#/components/responses/ErrorResponse"}}}},"/api/v2/orders/{number}/methods":{"get":{"summary":"Доступные способы оплаты заказа","description":"Возвращает методы с рассчитанной суммой и активные реквизиты, если они уже назначены.","tags":["Payment requisites"],"parameters":[{"in":"path","name":"number","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Available methods","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"order":{"$ref":"#/components/schemas/Order"},"methods":{"type":"array","items":{"$ref":"#/components/schemas/AvailablePaymentMethod"}},"payment":{"allOf":[{"$ref":"#/components/schemas/Payment"}],"nullable":true}}}}}},"401":{"$ref":"#/components/responses/ErrorResponse"},"404":{"$ref":"#/components/responses/ErrorResponse"},"409":{"$ref":"#/components/responses/ErrorResponse"}}}},"/api/v2/orders/{number}/payment":{"post":{"summary":"Назначить реквизиты для оплаты","description":"До истечения TTL повторный запрос возвращает то же назначение. После истечения назначаются новые реквизиты.","tags":["Payment requisites"],"parameters":[{"in":"path","name":"number","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["method_id"],"properties":{"method_id":{"type":"integer","minimum":1}}}}}},"responses":{"200":{"description":"Payment requisites assigned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"reused":{"type":"boolean"},"order":{"$ref":"#/components/schemas/Order"},"payment":{"$ref":"#/components/schemas/Payment"}}}}}},"401":{"$ref":"#/components/responses/ErrorResponse"},"404":{"$ref":"#/components/responses/ErrorResponse"},"409":{"$ref":"#/components/responses/ErrorResponse"},"422":{"$ref":"#/components/responses/ErrorResponse"},"503":{"$ref":"#/components/responses/ErrorResponse"}}}},"/api/v2/orders/{number}/receipt":{"post":{"summary":"Загрузить чек","description":"Загрузка чека переводит заказ на проверку и сама по себе не подтверждает оплату.","tags":["Payment requisites"],"parameters":[{"in":"path","name":"number","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["receipt"],"properties":{"receipt":{"type":"string","format":"binary"},"claimed_amount":{"type":"number","minimum":0},"comment":{"type":"string"}}}}}},"responses":{"201":{"description":"Receipt accepted for review","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"receipt_id":{"type":"integer"},"order":{"$ref":"#/components/schemas/Order"}}}}}},"401":{"$ref":"#/components/responses/ErrorResponse"},"404":{"$ref":"#/components/responses/ErrorResponse"},"409":{"$ref":"#/components/responses/ErrorResponse"},"422":{"$ref":"#/components/responses/ErrorResponse"}}}},"/api/v2/wallets":{"get":{"summary":"Балансы пользователя по валютам","tags":["Wallets"],"responses":{"200":{"description":"OK"}}}},"/api/v2/methods":{"get":{"summary":"Список доступных платёжных методов","tags":["Reference"],"security":[{"BearerApiKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"methods":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","example":"card"},"title":{"type":"string","example":"Банковская карта"},"enabled":{"type":"boolean"},"min_amount":{"type":"number"},"max_amount":{"type":"number"}}}}}}}}}}}},"/api/v2/rates":{"get":{"summary":"Курсы валют к RUB","tags":["Reference"],"security":[{"BearerApiKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"base":{"type":"string","example":"RUB"},"rates":{"type":"object","additionalProperties":{"type":"number"},"example":{"USDT":95.200000000000003,"BTC":5800000}},"updated_at":{"type":"integer","example":1730000000}}}}}}}}}}}