openapi: 3.0.3
info:
  title: Subscriptions XML API
  version: 1.0.2+729a0f9a
  description: "Партнёрское XML API подписок.\n\nАутентификация выполняется полями тела запроса: SubscriptionProjectID, Now и Signature.\nNow — метка времени UTC в формате yyyyMMddHHmmss.\nSignature считается по версии, назначенной проекту:\nверсия 1 — MD5(SubscriptionProjectID + Now + PartnerPassword),\nверсия 2 — HMAC-SHA256(SubscriptionProjectID + Now, PartnerPassword).\n\nКод HTTP всегда 200, результат обработки передаётся в теле полями StatusID и StatusName.\nСпецификация построена по контрактам сборки Planet3.Subscriptions.Api.DataContracts\nи разделу handlers файла Web.config."
  x-source-commit: 729a0f9a
servers:
  - url: "https://{host}"
    variables:
      host:
        default: example.org
tags:
  - name: Subscriptions
    description: Методы партнёрского API подписок
paths:
  /Http/Services/CreateSubscription.aspx:
    post:
      summary: Создание подписки
      operationId: SubscriptionCreator
      tags:
        - Subscriptions
      requestBody:
        required: true
        content:
          application/xml:
            schema:
              $ref: "#/components/schemas/SubscriptionCreatorRequest"
            examples:
              sms_pin:
                summary: SubscriptionCreator / sms_pin
                value: |
                  <?xml version="1.0" encoding="utf-8"?>
                  <Request>
                    <SubscriptionProjectID>2001</SubscriptionProjectID>
                    <Subscriber_MSISDN>79600000000</Subscriber_MSISDN>
                    <Now>YOUR_TIMESTAMP</Now>
                    <Signature>YOUR_SIGNATURE</Signature>
                  </Request>
              card:
                summary: SubscriptionCreator / card
                value: |
                  <?xml version="1.0" encoding="utf-8"?>
                  <Request>
                    <SubscriptionProjectID>2001</SubscriptionProjectID>
                    <CustomerType>Card</CustomerType>
                    <CustomerId>SANDBOX-CUSTOMER-1</CustomerId>
                    <Now>YOUR_TIMESTAMP</Now>
                    <Signature>YOUR_SIGNATURE</Signature>
                  </Request>
              wap:
                summary: SubscriptionCreator / wap
                value: |
                  <?xml version="1.0" encoding="utf-8"?>
                  <Request>
                    <SubscriptionProjectID>2001</SubscriptionProjectID>
                    <ClientIP>80.70.60.50</ClientIP>
                    <Localization>ru-RU</Localization>
                    <Now>YOUR_TIMESTAMP</Now>
                    <Signature>YOUR_SIGNATURE</Signature>
                  </Request>
      responses:
        "200":
          description: Ответ платформы. Результат обработки передаётся полями StatusID и StatusName.
          content:
            application/xml:
              schema:
                $ref: "#/components/schemas/SubscriptionCreatorResponse"
              examples:
                sms_pin:
                  summary: SubscriptionCreator / sms_pin
                  value: |
                    <?xml version="1.0" encoding="utf-8"?>
                    <Response>
                      <StatusName>REQUEST_ACCEPTED</StatusName>
                      <SubscriptionID>1000000001</SubscriptionID>
                      <SubscriberAcceptanceRequired>true</SubscriberAcceptanceRequired>
                      <SubscriberAcceptanceChannel>SMS_PIN</SubscriberAcceptanceChannel>
                      <OperatorID>22</OperatorID>
                      <PaidUntil>2026-09-21T12:00:00Z</PaidUntil>
                    </Response>
        "500":
          description: Внутренняя ошибка платформы
  /Http/Services/CancelSubscription.aspx:
    post:
      summary: Отмена подписки
      operationId: SubscriptionCancel
      tags:
        - Subscriptions
      requestBody:
        required: true
        content:
          application/xml:
            schema:
              $ref: "#/components/schemas/SubscriptionCancelRequest"
            examples:
              cancel:
                summary: SubscriptionCancel / cancel
                value: |
                  <?xml version="1.0" encoding="utf-8"?>
                  <Request>
                    <SubscriptionProjectID>2001</SubscriptionProjectID>
                    <SubscriptionID>1000000001</SubscriptionID>
                    <Now>YOUR_TIMESTAMP</Now>
                    <Signature>YOUR_SIGNATURE</Signature>
                  </Request>
      responses:
        "200":
          description: Ответ платформы. Результат обработки передаётся полями StatusID и StatusName.
          content:
            application/xml:
              schema:
                $ref: "#/components/schemas/SubscriptionCancelResponse"
              examples:
                cancel:
                  summary: SubscriptionCancel / cancel
                  value: |
                    <?xml version="1.0" encoding="utf-8"?>
                    <Response>
                      <StatusName>REQUEST_ACCEPTED</StatusName>
                      <OperatorID>22</OperatorID>
                    </Response>
        "500":
          description: Внутренняя ошибка платформы
  /Http/Services/ApproveSubscription.aspx:
    post:
      summary: Подтверждение подписки
      operationId: ApproveSubscription
      tags:
        - Subscriptions
      requestBody:
        required: true
        content:
          application/xml:
            schema:
              $ref: "#/components/schemas/ApproveSubscriptionRequest"
            examples:
              approve:
                summary: ApproveSubscription / sms_pin
                value: |
                  <?xml version="1.0" encoding="utf-8"?>
                  <Request>
                    <SubscriptionProjectID>2001</SubscriptionProjectID>
                    <SubscriptionID>1000000001</SubscriptionID>
                    <PinCode>1234</PinCode>
                    <Now>YOUR_TIMESTAMP</Now>
                    <Signature>YOUR_SIGNATURE</Signature>
                  </Request>
      responses:
        "200":
          description: Ответ платформы. Результат обработки передаётся полями StatusID и StatusName.
          content:
            application/xml:
              schema:
                $ref: "#/components/schemas/ApproveSubscriptionResponse"
              examples:
                approve:
                  summary: ApproveSubscription / sms_pin
                  value: |
                    <?xml version="1.0" encoding="utf-8"?>
                    <Response>
                      <StatusName>REQUEST_ACCEPTED</StatusName>
                      <SubscriptionID>1000000001</SubscriptionID>
                      <OperatorID>22</OperatorID>
                      <PaidUntil>2026-09-21T12:00:00Z</PaidUntil>
                    </Response>
        "500":
          description: Внутренняя ошибка платформы
  /Http/Services/ResendPinCode.aspx:
    post:
      summary: Повторная отправка PIN-кода
      operationId: ResendPinCode
      tags:
        - Subscriptions
      requestBody:
        required: true
        content:
          application/xml:
            schema:
              $ref: "#/components/schemas/ResendPinCodeRequest"
            examples:
              resend:
                summary: ResendPinCode / sms_pin
                value: |
                  <?xml version="1.0" encoding="utf-8"?>
                  <Request>
                    <SubscriptionProjectID>2001</SubscriptionProjectID>
                    <SubscriptionID>1000000001</SubscriptionID>
                    <Now>YOUR_TIMESTAMP</Now>
                    <Signature>YOUR_SIGNATURE</Signature>
                  </Request>
      responses:
        "200":
          description: Ответ платформы. Результат обработки передаётся полями StatusID и StatusName.
          content:
            application/xml:
              schema:
                $ref: "#/components/schemas/ResendPinCodeResponse"
              examples:
                resend:
                  summary: ResendPinCode / sms_pin
                  value: |
                    <?xml version="1.0" encoding="utf-8"?>
                    <Response>
                      <StatusName>REQUEST_ACCEPTED</StatusName>
                    </Response>
        "500":
          description: Внутренняя ошибка платформы
  /Http/Services/GetSubscriptionStatus.aspx:
    post:
      summary: Статус подписки
      operationId: GetSubscriptionStatus
      tags:
        - Subscriptions
      requestBody:
        required: true
        content:
          application/xml:
            schema:
              $ref: "#/components/schemas/GetSubscriptionStatusRequest"
            examples:
              status:
                summary: GetSubscriptionStatus / active
                value: |
                  <?xml version="1.0" encoding="utf-8"?>
                  <Request>
                    <SubscriptionProjectID>2001</SubscriptionProjectID>
                    <SubscriptionID>1000000001</SubscriptionID>
                    <Now>YOUR_TIMESTAMP</Now>
                    <Signature>YOUR_SIGNATURE</Signature>
                  </Request>
      responses:
        "200":
          description: Ответ платформы. Результат обработки передаётся полями StatusID и StatusName.
          content:
            application/xml:
              schema:
                $ref: "#/components/schemas/GetSubscriptionStatusResponse"
              examples:
                status:
                  summary: GetSubscriptionStatus / active
                  value: |
                    <?xml version="1.0" encoding="utf-8"?>
                    <Response>
                      <StatusName>REQUEST_ACCEPTED</StatusName>
                      <SubscriptionStatus>Active</SubscriptionStatus>
                      <Country>ru</Country>
                      <OperatorID>22</OperatorID>
                      <SubscriptionID>1000000001</SubscriptionID>
                      <SubscriptionProjectID>2001</SubscriptionProjectID>
                      <PaidUntilUtc>2026-09-21T12:00:00Z</PaidUntilUtc>
                    </Response>
        "500":
          description: Внутренняя ошибка платформы
  /Http/Services/GetSubscriptions:
    post:
      summary: Список подписок
      operationId: GetSubscriptions
      tags:
        - Subscriptions
      requestBody:
        required: true
        content:
          application/xml:
            schema:
              $ref: "#/components/schemas/GetSubscriptionsRequest"
            examples:
              list:
                summary: GetSubscriptions / by msisdn
                value: |
                  <?xml version="1.0" encoding="utf-8"?>
                  <Request>
                    <SubscriptionProjectID>2001</SubscriptionProjectID>
                    <Subscriber_MSISDN>79600000000</Subscriber_MSISDN>
                    <Now>YOUR_TIMESTAMP</Now>
                    <Signature>YOUR_SIGNATURE</Signature>
                  </Request>
      responses:
        "200":
          description: Ответ платформы. Результат обработки передаётся полями StatusID и StatusName.
          content:
            application/xml:
              schema:
                $ref: "#/components/schemas/GetSubscriptionsResponse"
              examples:
                list:
                  summary: GetSubscriptions / by msisdn
                  value: |
                    <?xml version="1.0" encoding="utf-8"?>
                    <Response>
                      <StatusName>REQUEST_ACCEPTED</StatusName>
                      <Subscriptions>
                        <SubscriptionID>1000000001</SubscriptionID>
                        <SubscriptionProjectID>2001</SubscriptionProjectID>
                        <SubscriptionStatus>Active</SubscriptionStatus>
                        <Country>ru</Country>
                        <OperatorID>22</OperatorID>
                        <Subscriber_MSISDN>79600000000</Subscriber_MSISDN>
                        <PaidUntil>2026-09-21T12:00:00Z</PaidUntil>
                        <Active>true</Active>
                        <Approved>true</Approved>
                      </Subscriptions>
                    </Response>
        "500":
          description: Внутренняя ошибка платформы
  /Http/Services/RefundBillingOperation.aspx:
    post:
      summary: Возврат платежа
      operationId: RefundBillingOperation
      tags:
        - Subscriptions
      requestBody:
        required: true
        content:
          application/xml:
            schema:
              $ref: "#/components/schemas/RefundBillingOperationRequest"
            examples:
              refund:
                summary: RefundBillingOperation / refund
                value: |
                  <?xml version="1.0" encoding="utf-8"?>
                  <Request>
                    <SubscriptionProjectID>2001</SubscriptionProjectID>
                    <BillingOperationID>0f4f4a1e-6f0b-4a8b-9c3f-2a1d5e7c9b10</BillingOperationID>
                    <Now>YOUR_TIMESTAMP</Now>
                    <Signature>YOUR_SIGNATURE</Signature>
                  </Request>
      responses:
        "200":
          description: Ответ платформы. Результат обработки передаётся полями StatusID и StatusName.
          content:
            application/xml:
              schema:
                $ref: "#/components/schemas/RefundBillingOperationResponse"
              examples:
                refund:
                  summary: RefundBillingOperation / refund
                  value: |
                    <?xml version="1.0" encoding="utf-8"?>
                    <Response>
                      <StatusName>REQUEST_ACCEPTED</StatusName>
                      <BillingOperationID>0f4f4a1e-6f0b-4a8b-9c3f-2a1d5e7c9b10</BillingOperationID>
                    </Response>
        "500":
          description: Внутренняя ошибка платформы
components:
  schemas:
    SubscriptionCreatorRequest:
      type: object
      properties:
        Now:
          type: string
        Signature:
          type: string
        SubscriptionProjectID:
          type: integer
          format: int32
        MerchantSubsID:
          type: string
        Localization:
          type: string
        Subscriber_MSISDN:
          type: string
        SubscriberID:
          type: integer
          format: int64
        BillingPeriod:
          type: string
        BillingCount:
          type: string
        BillingPeriodIntervalType:
          type: string
        StartTimeUtc:
          type: string
        BillingStartTimeUtc:
          type: string
        ContentProjectUID:
          type: string
        SubscriptionTitle:
          type: string
        ResendSmsPinIfSubscriptionAlreadyExists:
          type: string
        ClientIP:
          type: string
        CustomerId:
          type: string
        CustomerType:
          type: string
        ExpectedApprovingType:
          type: string
        ExternalApprovingType:
          type: string
          enum:
            - NONE
            - IVR
            - SMS
            - USSD
            - SMS_PIN
            - AUTH_PAGE
            - AUTH_PAGE_AOC
            - SMS_AOC
        ContentLogin:
          type: string
        ContentPassword:
          type: string
        AdditionalParams:
          type: string
        ApplyPreAuthTemplate:
          type: boolean
        ExternalServiceId:
          type: string
        PartnerLandingSplitId:
          type: string
        LandingPageId:
          type: string
      required:
        - Now
        - Signature
        - SubscriptionProjectID
      xml:
        name: Request
    SubscriptionCreatorResponse:
      type: object
      properties:
        StatusID:
          type: integer
          format: int32
        StatusName:
          type: string
        ErrorDescription:
          type: string
        ErrorReasonID:
          type: string
        ErrorReasonName:
          type: string
        SubscriptionID:
          type: string
        SubscriptionStatus:
          type: string
        MerchantSubsID:
          type: string
        SubscriberAcceptanceRequired:
          type: string
        SubscriberAcceptanceChannel:
          type: string
        NetworkID:
          type: string
        OperatorID:
          type: string
        AuthorizeUrl:
          type: string
        PaidUntil:
          type: string
        TrialExists:
          type: string
      xml:
        name: Response
    SubscriptionCancelRequest:
      type: object
      properties:
        Now:
          type: string
        Signature:
          type: string
        SubscriptionProjectID:
          type: integer
          format: int32
        SubscriptionID:
          type: integer
          format: int64
        Subscriber_MSISDN:
          type: string
        SubscriberID:
          type: integer
          format: int64
        SendSmsNotification:
          type: string
        ClientIP:
          type: string
      required:
        - Now
        - Signature
        - SubscriptionProjectID
      xml:
        name: Request
    SubscriptionCancelResponse:
      type: object
      properties:
        StatusID:
          type: integer
          format: int32
        StatusName:
          type: string
        ErrorDescription:
          type: string
        ErrorReasonID:
          type: string
        ErrorReasonName:
          type: string
        MerchantSubsID:
          type: string
        OperatorID:
          type: string
        CancelUrl:
          type: string
      xml:
        name: Response
    ApproveSubscriptionRequest:
      type: object
      properties:
        Now:
          type: string
        Signature:
          type: string
        SubscriptionProjectID:
          type: integer
          format: int32
        PinCode:
          type: string
        ClientIP:
          type: string
        SubscriptionID:
          type: string
        Subscriber_MSISDN:
          type: string
        SubscriberID:
          type: string
        SendSmsNotification:
          type: string
      required:
        - Now
        - Signature
        - SubscriptionProjectID
      xml:
        name: Request
    ApproveSubscriptionResponse:
      type: object
      properties:
        StatusID:
          type: integer
          format: int32
        StatusName:
          type: string
        ErrorDescription:
          type: string
        ErrorReasonID:
          type: string
        ErrorReasonName:
          type: string
        SubscriptionID:
          type: string
        MerchantSubsID:
          type: string
        OperatorID:
          type: string
      xml:
        name: Response
    ResendPinCodeRequest:
      type: object
      properties:
        Now:
          type: string
        Signature:
          type: string
        SubscriptionProjectID:
          type: integer
          format: int32
        SubscriptionID:
          type: integer
          format: int64
        Subscriber_MSISDN:
          type: string
        SubscriberID:
          type: integer
          format: int64
        ClientIP:
          type: string
      required:
        - Now
        - Signature
        - SubscriptionProjectID
      xml:
        name: Request
    ResendPinCodeResponse:
      type: object
      properties:
        StatusID:
          type: integer
          format: int32
        StatusName:
          type: string
        ErrorDescription:
          type: string
        ErrorReasonID:
          type: string
        ErrorReasonName:
          type: string
      xml:
        name: Response
    GetSubscriptionStatusRequest:
      type: object
      properties:
        Now:
          type: string
        Signature:
          type: string
        SubscriptionProjectID:
          type: integer
          format: int32
        SubscriptionID:
          type: string
        RequestID:
          type: string
        Subscriber_MSISDN:
          type: string
        SubscriberID:
          type: string
        ClientIP:
          type: string
      required:
        - Now
        - Signature
        - SubscriptionProjectID
      xml:
        name: Request
    GetSubscriptionStatusResponse:
      type: object
      properties:
        StatusID:
          type: integer
          format: int32
        StatusName:
          type: string
        ErrorDescription:
          type: string
        ErrorReasonID:
          type: string
        ErrorReasonName:
          type: string
        SubscriptionStatus:
          type: string
        Country:
          type: string
        OperatorID:
          type: string
        SubscriptionID:
          type: string
        SubscriptionProjectID:
          type: string
        StatusUrl:
          type: string
        RequestID:
          type: string
        MerchantSubsID:
          type: string
        PaidUntilUtc:
          type: string
        Subscriber_MSISDN:
          type: string
        ClosedTime:
          type: string
      required:
        - SubscriptionProjectID
      xml:
        name: Response
    GetSubscriptionsRequest:
      type: object
      properties:
        Now:
          type: string
        Signature:
          type: string
        SubscriptionProjectID:
          type: integer
          format: int32
        Subscriber_MSISDN:
          type: string
        SubscriberID:
          type: string
        ClientIP:
          type: string
      required:
        - Now
        - Signature
        - SubscriptionProjectID
      xml:
        name: Request
    SubscriptionInfo:
      type: object
      properties:
        StatusID:
          type: integer
          format: int32
        StatusName:
          type: string
        ErrorDescription:
          type: string
        ErrorReasonID:
          type: string
        ErrorReasonName:
          type: string
        SubscriptionID:
          type: integer
          format: int64
        SubscriptionProjectID:
          type: integer
          format: int32
        SubscriptionProjectTitle:
          type: string
        SubscriptionStatus:
          type: string
        Country:
          type: string
        OperatorID:
          type: integer
          format: int32
        NetworkID:
          type: integer
          format: int32
        Subscriber_MSISDN:
          type: string
        MerchantSubsID:
          type: string
        RenewPeriod:
          type: integer
          format: int32
        PaidUntil:
          type: string
        TrialExists:
          type: boolean
        ActualRenewCount:
          type: integer
          format: int32
        CreateTime:
          type: string
        ClosedTime:
          type: string
        Active:
          type: boolean
        Approved:
          type: boolean
        AcceptanceChannel:
          type: string
        ClientIP:
          type: string
      required:
        - SubscriptionProjectID
      xml:
        name: Response
    GetSubscriptionsResponse:
      type: object
      properties:
        StatusID:
          type: integer
          format: int32
        StatusName:
          type: string
        ErrorDescription:
          type: string
        ErrorReasonID:
          type: string
        ErrorReasonName:
          type: string
        Subscriptions:
          type: array
          items:
            allOf:
              - $ref: "#/components/schemas/SubscriptionInfo"
            xml:
              name: Subscriptions
          xml:
            wrapped: false
      xml:
        name: Response
    RefundBillingOperationRequest:
      type: object
      properties:
        Now:
          type: string
        Signature:
          type: string
        BillingOperationID:
          type: string
          format: uuid
        SubscriptionProjectID:
          type: integer
          format: int32
      required:
        - Now
        - Signature
        - SubscriptionProjectID
      xml:
        name: Request
    RefundBillingOperationResponse:
      type: object
      properties:
        StatusID:
          type: integer
          format: int32
        StatusName:
          type: string
        ErrorDescription:
          type: string
        ErrorReasonID:
          type: string
        ErrorReasonName:
          type: string
        BillingOperationID:
          type: string
          format: uuid
      xml:
        name: Response
