> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vargopartners.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Счёт

> Текущее состояние счёта; после оплаты в `client` — клиент со ссылкой подписки. Это источник истины: перед выдачей доступа у себя перечитайте счёт. `expired` не окончательный — поздняя оплата переводит счёт в `succeeded`.



## OpenAPI

````yaml GET /api/partner/v1/payments/{payment_id}
openapi: 3.1.0
info:
  title: VARGO Partner API
  version: '1.0'
  description: >-
    REST API для продажи VPN в своём боте, мини-аппе или на сайте: тарифы,
    счета, клиенты и их устройства. Клиент платит платформе, наценка партнёра
    начисляется на его баланс.


    Ключ партнёра — в заголовке `Authorization: Bearer vgo_live_…`, его выдаёт
    платформа. Ключ живёт только на сервере партнёра: в коде мини-аппа или сайта
    его быть не должно. Деньги — строки в рублях (`"150.00"`), даты — ISO-8601
    UTC. Ошибки — `{error: {code, message, fields}}`: ветвиться по `code`,
    `message` клиенту не показывать.
servers:
  - url: https://api.vargopartners.com
security:
  - PartnerKey: []
paths:
  /api/partner/v1/payments/{payment_id}:
    get:
      tags:
        - Partner API
      summary: Счёт
      description: >-
        Текущее состояние счёта; после оплаты в `client` — клиент со ссылкой
        подписки. Это источник истины: перед выдачей доступа у себя перечитайте
        счёт. `expired` не окончательный — поздняя оплата переводит счёт в
        `succeeded`.
      operationId: get_payment_api_partner_v1_payments__payment_id__get
      parameters:
        - name: payment_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: Id счёта из ответа `POST /payments`
            title: Payment Id
          description: Id счёта из ответа `POST /payments`
      responses:
        '200':
          description: Счёт
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiPayment'
        '401':
          description: >-
            Ключ не принят: `UNAUTHORIZED`. Неверный и отозванный ключ,
            выключенный доступ к API — один ответ
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '422':
          description: >-
            Запрос не прошёл проверку: `code` — `VALIDATION_ERROR`, в `fields` —
            поле и причина
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '429':
          description: >-
            Превышен лимит: `RATE_LIMITED` — повторить после паузы из
            `Retry-After`. У суточных лимитов (`NEW_CLIENTS_DAILY_LIMIT`,
            `TRIAL_DAILY_LIMIT`) заголовка нет — повторять на следующие сутки
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
          headers:
            Retry-After:
              description: >-
                Пауза в секундах до повтора; есть у `RATE_LIMITED` и
                `LINK_ROTATE_TOO_SOON`
              schema:
                type: integer
                minimum: 1
        default:
          description: >-
            Ошибка — тот же конверт; ветвиться по `code`, список кодов — в
            документации
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  schemas:
    ApiPayment:
      properties:
        payment_id:
          type: string
          format: uuid
          title: Payment Id
          description: Id счёта
        status:
          type: string
          enum:
            - pending
            - succeeded
            - failed
            - expired
          title: Status
          description: >-
            `pending` — ждёт оплаты; `succeeded` — оплачен, доступ выдан;
            `expired` — срок оплаты вышел, но статус не окончательный: поздняя
            оплата переводит счёт в `succeeded`; `failed` — оплата не прошла,
            бывает и после `succeeded`, если банк отозвал платёж
        purpose:
          type: string
          enum:
            - subscription
            - devices
          title: Purpose
          description: Что оплачивается
        client_id:
          type: string
          title: Client Id
          description: Id клиента в вашей системе
          examples:
            - user-42
        plan_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Plan Id
          description: 'Тариф — у `purpose: subscription`'
        devices:
          anyOf:
            - type: integer
            - type: 'null'
          title: Devices
          description: 'Сколько устройств — у `purpose: devices`'
        method:
          type: string
          title: Method
          description: Способ оплаты
          examples:
            - sbp
        amount:
          type: string
          title: Amount
          description: Сумма к оплате клиентом
          examples:
            - '150.00'
        platform_amount:
          type: string
          title: Platform Amount
          description: Часть платформы
          examples:
            - '100.00'
        partner_share:
          type: string
          title: Partner Share
          description: 'Наценка партнёра: после оплаты ложится на его баланс'
          examples:
            - '50.00'
        currency:
          type: string
          title: Currency
          description: Валюта
          examples:
            - RUB
        payment_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Payment Url
          description: Страница оплаты для клиента; есть только у `pending`
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Когда счёт выставлен, UTC
        expires_at:
          type: string
          format: date-time
          title: Expires At
          description: >-
            Ориентир срока оплаты, UTC: статус меняется с задержкой до часа,
            поздняя оплата проходит
        paid_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Paid At
          description: Когда счёт оплачен, UTC
        client:
          anyOf:
            - $ref: '#/components/schemas/ApiClient'
            - type: 'null'
          description: Клиент со ссылкой подписки; заполнен у `succeeded`
      type: object
      required:
        - payment_id
        - status
        - purpose
        - client_id
        - plan_id
        - devices
        - method
        - amount
        - platform_amount
        - partner_share
        - currency
        - payment_url
        - created_at
        - expires_at
        - paid_at
        - client
      title: ApiPayment
    ApiError:
      description: 'Конверт любой ошибки: статус HTTP плюс `error.code`.'
      properties:
        error:
          $ref: '#/components/schemas/ApiErrorBody'
          description: Код, текст и поля ошибки
      required:
        - error
      title: ApiError
      type: object
    ApiClient:
      properties:
        client_id:
          type: string
          title: Client Id
          description: Id клиента в вашей системе
          examples:
            - user-42
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Когда клиент заведён, UTC
        subscription:
          anyOf:
            - $ref: '#/components/schemas/ApiSubscription'
            - type: 'null'
          description: Подписка; `null` — подписки не было ни разу
        trial_available:
          type: boolean
          title: Trial Available
          description: >-
            Пробный период сейчас можно выдать: подписки не было, пробный период
            включён партнёру, суточный лимит не исчерпан, клиент не заблокирован
      type: object
      required:
        - client_id
        - created_at
        - subscription
        - trial_available
      title: ApiClient
    ApiErrorBody:
      properties:
        code:
          description: Машиночитаемый код ошибки — ветвиться по нему
          examples:
            - VALIDATION_ERROR
          title: Code
          type: string
        message:
          description: >-
            Текст для логов на языке из `Accept-Language` (`ru` или `en`);
            клиенту не показывать
          title: Message
          type: string
        fields:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          description: Поле → причина у `VALIDATION_ERROR`; у остальных ошибок `null`
          title: Fields
      required:
        - code
        - message
        - fields
      title: ApiErrorBody
      type: object
    ApiSubscription:
      properties:
        status:
          type: string
          enum:
            - active
            - expired
            - suspended
          title: Status
          description: >-
            `active` — действует (у пробной `is_trial: true`); `expired` — срок
            вышел, продление возобновляет подписку с момента оплаты; `suspended`
            — срок идёт, но доступ приостановлен платформой
        is_trial:
          type: boolean
          title: Is Trial
          description: Пробная подписка
        expires_at:
          type: string
          format: date-time
          title: Expires At
          description: Конец срока, UTC
        days_left:
          type: integer
          title: Days Left
          description: Дней до конца срока с округлением вверх; у истёкшей — 0
          examples:
            - 30
        subscription_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Subscription Url
          description: >-
            Ссылка подписки для VPN-приложения. Отдаётся и у истёкшей: после
            продления ссылка та же. `null` — ссылки пока нет
        connect:
          items:
            $ref: '#/components/schemas/ApiConnectLink'
          type: array
          title: Connect
          description: >-
            Готовые ссылки подключения по приложениям; пусто, пока нет ссылки
            подписки
        devices_limit:
          anyOf:
            - type: integer
            - type: 'null'
          title: Devices Limit
          description: Сколько устройств можно подключить; `null` — без ограничения
      type: object
      required:
        - status
        - is_trial
        - expires_at
        - days_left
        - subscription_url
        - connect
        - devices_limit
      title: ApiSubscription
    ApiConnectLink:
      properties:
        app_id:
          type: string
          title: App Id
          description: Код приложения — как в `GET /apps`
          examples:
            - happ
        app_name:
          type: string
          title: App Name
          description: Название приложения
          examples:
            - Happ
        connect_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Connect Url
          description: >-
            Адрес для кнопки «Открыть в приложении»: https-страница, которая
            открывает приложение с подпиской
        qr_payload:
          anyOf:
            - type: string
            - type: 'null'
          title: Qr Payload
          description: 'Строка для QR-кода: его сканирует приложение'
        supports_manual_url:
          type: boolean
          title: Supports Manual Url
          description: Приложение принимает ссылку подписки, вставленную вручную
      type: object
      required:
        - app_id
        - app_name
        - connect_url
        - qr_payload
        - supports_manual_url
      title: ApiConnectLink
  securitySchemes:
    PartnerKey:
      type: http
      scheme: bearer
      description: >-
        Ключ партнёра `vgo_live_…`, его выдаёт платформа. Хранится только на
        сервере партнёра.

````