openapi: 3.0.0
info:
  description: Metaverse Orbs API
  title: Metaverse Orbs API
  version: 1.0.0
paths:
  /v2/merchants/{merchantId}/projects/{projectId}/multicurrency-balance:
    get:
      security:
        - Bearer: []
      description: Gets information about multi virtual currencies and shards balance.
      tags:
        - MultiCurrencies
      summary: Get multi virtual currencies balance
      operationId: multicurrency-balance-v2
      parameters:
        - description: Merchant ID of the client
          name: merchantId
          in: path
          required: true
          schema:
            type: string
        - description: Project ID of the project
          name: projectId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Values of multi virtual crrencies balances.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalance'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '422':
          description: Unprocessable entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
  /v2/merchants/{merchantId}/projects/{projectId}/multicurrency-balance-topup:
    post:
      security:
        - Server: []
      description: Top up user multicurrency balance.
      tags:
        - MultiCurrencies
      summary: Topup user's multicurrency balance
      operationId: multicurrency-balance-topup-v2
      parameters:
        - description: Unique operation ID.
          name: X-OPERATION-ID
          in: header
          required: true
          schema:
            type: string
            format: UUID
            minLength: 36
            maxLength: 36
        - description: Unique operator ID.
          name: X-HOST-ID
          in: header
          required: true
          schema:
            type: string
            format: UUID
            minLength: 36
            maxLength: 36
        - description: Merchant ID of the client
          name: merchantId
          in: path
          required: true
          schema:
            type: string
        - description: Project ID of the project
          name: projectId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/topupMultivcRequest'
      responses:
        '200':
          description: Operation successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/topupMultivcResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '422':
          description: Unprocessable entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
  /v2/merchants/{merchantId}/projects/{projectId}/multicurrency-charge:
    post:
      security:
        - Server: []
      description: Charge shards from user
      tags:
        - Charge
      summary: Charges Shards from user's balance
      operationId: multicurrency-charge-v2
      parameters:
        - description: Merchant ID of the client
          name: merchantId
          in: path
          required: true
          schema:
            type: string
        - description: Project ID of the project
          name: projectId
          in: path
          required: true
          schema:
            type: string
        - description: Unique operation ID.
          name: X-OPERATION-ID
          in: header
          required: true
          schema:
            type: string
            format: UUID
            minLength: 36
            maxLength: 36
        - description: Unique operator ID.
          name: X-HOST-ID
          in: header
          required: true
          schema:
            type: string
            format: UUID
            minLength: 36
            maxLength: 36
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/chargeMultivcRequest'
      responses:
        '200':
          description: Operation successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/result'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '409':
          description: Low balance
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '422':
          description: Unprocessable entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errorResult'
  /v2/merchants/{merchantId}/projects/{projectId}/multicurrency-charge-user:
    post:
      security:
        - Server: []
      description: Charge shards from user by Xsolla Account ID
      tags:
        - Charge
      summary: Charges Shards from user's balance by Xsolla Account ID
      operationId: multicurrency-charge-user-v2
      parameters:
        - description: Merchant ID of the client
          name: merchantId
          in: path
          required: true
          schema:
            type: string
        - description: Project ID of the project
          name: projectId
          in: path
          required: true
          schema:
            type: string
        - description: Unique operation ID.
          name: X-OPERATION-ID
          in: header
          required: true
          schema:
            type: string
            format: UUID
            minLength: 36
            maxLength: 36
        - description: Unique operator ID.
          name: X-HOST-ID
          in: header
          required: true
          schema:
            type: string
            format: UUID
            minLength: 36
            maxLength: 36
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/chargeUserMultivcRequest'
      responses:
        '200':
          description: Operation successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/result'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '409':
          description: Low balance
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '422':
          description: Unprocessable entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
  /v2/merchants/{merchantId}/projects/{projectId}/package:
    get:
      security:
        - Bearer: []
      description: Gets a list of available items.
      tags:
        - Package
      summary: Get package list
      operationId: purchase-info-v2
      parameters:
        - description: Merchant ID of the client
          name: merchantId
          in: path
          required: true
          schema:
            type: string
        - description: Project ID of the project
          name: projectId
          in: path
          required: true
          schema:
            type: string
        - description: The virtual currency SKU
          name: multivc-sku
          in: query
          required: true
          schema:
            type: string
      responses:
        '200':
          description: List of available items.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/list'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '422':
          description: Unprocessable entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
  /v2/merchants/{merchantId}/projects/{projectId}/purchase:
    post:
      security:
        - Bearer: []
      description: Creates a manual purchase.
      tags:
        - Manual purchase
      summary: Create manual purchase
      operationId: create-purchase-v2
      parameters:
        - description: Determine country based on user's ip
          name: X-GEOIP-COUNTRY
          in: header
          schema:
            type: string
        - description: Determine parent payment page
          name: X-IFRAME-HOST-ORIGIN
          in: header
          schema:
            type: string
            format: uri
        - description: Merchant ID of the client
          name: merchantId
          in: path
          required: true
          schema:
            type: string
        - description: Project ID of the project
          name: projectId
          in: path
          required: true
          schema:
            type: string
        - description: Unique operator ID.
          name: X-HOST-ID
          in: header
          required: true
          schema:
            type: string
            format: UUID
            minLength: 36
            maxLength: 36
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/create'
      responses:
        '200':
          description: Operation success
          content:
            application/json:
              schema:
                type: object
                title: Successful charge result
                properties:
                  order_id:
                    description: Order ID.
                    type: integer
                    format: uint32
                  token:
                    description: Payment token.
                    type: string
                example:
                  order_id: 641,
                  token: f4puMEFFDZcx9nv5HoNHIkPe9qghvBQo
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '422':
          description: Unprocessable entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
  /v2/merchants/{merchantId}/projects/{projectId}/user/{userId}/auto-topup:
    get:
      security:
        - Server: []
      description: Retrieve information about automatic purchase.
      tags:
        - MultiCurrencies
      summary: Retrieve info about automatic purchase
      operationId: s2s-list-auto-topup
      parameters:
        - description: Unique operator ID.
          name: X-HOST-ID
          in: header
          required: true
          schema:
            type: string
            format: UUID
            minLength: 36
            maxLength: 36
        - description: Merchant ID of the client
          name: merchantId
          in: path
          required: true
          schema:
            type: string
        - description: Project ID of the project
          name: projectId
          in: path
          required: true
          schema:
            type: string
        - description: Unique User ID.
          name: userId
          in: path
          required: true
          schema:
            type: string
            format: UUID
            minLength: 36
            maxLength: 36
      responses:
        '200':
          description: Information about automatic purchase.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/s2sAutoTopupResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '422':
          description: Unprocessable entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
    put:
      security:
        - Server: []
      description: Updates information about automatic purchase.
      tags:
        - MultiCurrencies
      summary: Update info about automatic purchase
      operationId: s2s-update-auto-topup
      parameters:
        - description: Unique operator ID.
          name: X-HOST-ID
          in: header
          required: true
          schema:
            type: string
            format: UUID
            minLength: 36
            maxLength: 36
        - description: Merchant ID of the client
          name: merchantId
          in: path
          required: true
          schema:
            type: string
        - description: Project ID of the project
          name: projectId
          in: path
          required: true
          schema:
            type: string
        - description: Unique User ID.
          name: userId
          in: path
          required: true
          schema:
            type: string
            format: UUID
            minLength: 36
            maxLength: 36
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/s2sAutoTopupPutRequest'
      responses:
        '200':
          description: Information about automatic purchase.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/s2sAutoTopupResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
        '422':
          description: Unprocessable entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/multicurrencyBalanceTopupV2BadRequestBody'
servers:
  - url: http://orbs.babka.com
components:
  securitySchemes:
    APIKey:
      type: apiKey
      name: X-API-KEY
      in: header
    Bearer:
      type: apiKey
      name: Authorization
      in: header
    Server:
      type: apiKey
      name: X-SERVER-AUTHORIZATION
      in: header
  schemas:
    JWTKey:
      type: object
      properties:
        client_id:
          description: OAuth2 Client ID
          type: number
          format: int64
          nullable: false
        email:
          description: user email
          type: string
          nullable: true
        merchant_id:
          description: Publisher ID of token
          type: number
          format: int64
          nullable: false
        phone_number:
          description: User's phone number
          type: string
          nullable: true
        project_id:
          description: project id
          type: string
          format: uuid
        raw_token:
          description: Raw token string
          type: string
        user_id:
          description: user id
          type: string
          format: uuid
          nullable: true
      x-secret: true
    chargeMultivcRequest:
      type: object
      title: Charge request parameters
      required:
        - shards
        - user_token
        - virtual_currency_sku
      properties:
        shards:
          description: Number of Shards to charge.
          type: integer
          format: int64
          minimum: 1
          nullable: false
        user_token:
          description: Authentication token of the user whose balance is to charge.
          type: string
          minLength: 1
          nullable: false
        virtual_currency_sku:
          description: Multicurrency SKU
          type: string
          minLength: 1
          nullable: false
      example:
        shards: 22
        token: eyJ0eXAiOiJKV1QiLCJhbGciOiJ....LGH2xCeJHxl8u8Xn2aI=
        virtual_currency_sku: blue_orb_point
    chargeUserMultivcRequest:
      type: object
      title: Charge user request parameters
      required:
        - shards
        - user_id
        - virtual_currency_sku
      properties:
        shards:
          description: Number of Shards to charge.
          type: integer
          format: int64
          minimum: 1
          nullable: false
        user_id:
          description: Xsolla Account ID.
          type: string
          format: UUID
          minLength: 1
          nullable: false
        virtual_currency_sku:
          description: Multicurrency SKU
          type: string
          minLength: 1
          nullable: false
      example:
        shards: 22
        user_id: b8fa3003-2448-49fb-bbe2-7f72f420e350
        virtual_currency_sku: blue_orb_point
    create:
      type: object
      title: Purchase create token form
      properties:
        package_item_sku:
          description: Package Item SKU.
          type: string
          nullable: false
        ps_ui_close_button:
          description: PayStation 4 UI close button.
          type: boolean
        ps_ui_locale:
          description: PayStation 4 UI lanugage
          type: string
          enum:
            - en
            - de
            - es
            - ja
            - ko
            - pt
            - cn
            - ru
        ps_ui_theme:
          description: PayStation 4 appearance.
          type: string
        quantity:
          description: Number of items.
          type: integer
          format: int64
          minimum: 1
          nullable: false
      example:
        package_item_sku: xxx-xxx-xxx
        ps_ui_theme: babka_dark
        quantity: 1
    errorResult:
      type: object
      properties:
        error_code:
          description: Error code
          type: string
          nullable: false
        error_description:
          description: Error description
          type: string
          nullable: false
    list:
      type: object
      title: Available items list
      properties:
        items:
          description: List of items.
          type: array
          items:
            type: object
            title: Item
            properties:
              currency:
                description: >-
                  The currency which prices are displayed in. Three-letter
                  currency code per ISO 4217.
                type: string
              name:
                description: Item name.
                type: string
              package_item_sku:
                description: Package Item SKU.
                type: string
              price:
                description: Item price.
                type: string
              url:
                description: Image URL.
                type: string
            nullable: false
      example:
        items:
          - currency:"USD": null
            name: pack of orb
            package_item_sku: xxx-xxx-xxx
            price: 10.33
            url: xxx.xx.com
    multicurrencyBalance:
      type: object
      title: Available items list
      properties:
        items:
          description: List of multicurrency balances.
          type: array
          items:
            type: object
            title: Balances
            properties:
              balance:
                description: Multicurrency balance.
                type: integer
                x-omitempty: false
                nullable: false
              image_url:
                description: Multicurrency image url.
                type: string
              is_allowable_to_buy:
                description: >-
                  To distingush between partially available and available status
                  of virtual currency
                type: boolean
                x-omitempty: false
                nullable: false
              name:
                description: Multicurrency name.
                type: string
              points:
                description: Shards balance in time points.
                type: object
                properties:
                  base:
                    description: Shard base, number of time points in one Multicurrency.
                    type: integer
                    x-omitempty: false
                    nullable: false
                  point:
                    description: Shard balance in time points.
                    type: integer
                    x-omitempty: false
                    nullable: false
                nullable: false
              shards:
                description: Shard balance.
                type: integer
                x-omitempty: false
                nullable: false
              virtual_currency_sku:
                description: Multicurrency sku.
                type: string
            nullable: false
      example:
        items:
          - balance: 14
            image_url: https://imgurl.com
            name: Blue Orb Point
            points:
              base: 240
              point: 80
            shards: 2
            virtual_currency_sku: xxxxx
    multicurrencyBalanceTopupV2BadRequestBody:
      type: object
      properties:
        error_code:
          description: Error code
          type: string
          nullable: false
        error_description:
          description: Error description
          type: string
          nullable: false
      x-go-gen-location: operations
    result:
      type: object
      title: Successful charge result
      properties:
        balance:
          type: object
          properties:
            orbs:
              description: Full balance of a virtual currency.
              type: integer
            shards:
              description: Virtual currency shards balance.
              type: integer
      example:
        balance:
          orbs: 1
          shards: 5
    s2sAutoTopupPutRequest:
      type: object
      title: Auto topup request parameters
      properties:
        items:
          type: array
          items:
            type: object
            title: Item
            required:
              - virtual_currency_sku
            properties:
              enabled:
                description: >-
                  Whether automatic purchase of Blue Orbs is enabled for the
                  user.
                type: boolean
                nullable: false
              virtual_currency_sku:
                description: Virtual Currency SKU.
                type: string
                nullable: false
      example:
        items:
          - enabled: false
            virtual_currency_sku: xxx-xxx-xxx
    s2sAutoTopupResponse:
      type: object
      title: Automatic purchase info
      properties:
        items:
          type: array
          items:
            type: object
            title: Item
            required:
              - enabled
              - virtual_currency_sku
            properties:
              enabled:
                description: >-
                  Whether automatic purchase of multicurrency is enabled for the
                  user.
                type: boolean
                nullable: false
              virtual_currency_sku:
                description: Virtual Currency SKU
                type: string
                nullable: false
      example:
        items:
          - enabled: false
            virtual_currency_sku: xxx-xxx-xxx
    topupMultivcRequest:
      type: object
      title: Topup user multicurrency balance request parameters
      required:
        - shards
        - user_id
        - virtual_currency_sku
      properties:
        shards:
          description: Number of Shards to topup.
          type: integer
          format: int64
          minimum: 1
          nullable: false
        user_id:
          description: Xsolla Account ID.
          type: string
          format: UUID
          minLength: 1
          nullable: false
        virtual_currency_sku:
          description: Multicurrency SKU
          type: string
          minLength: 1
          nullable: false
      example:
        shards: 22
        user_id: b8fa3003-2448-49fb-bbe2-7f72f420e350
        virtual_currency_sku: sapphire_point
    topupMultivcResponse:
      type: object
      title: Successful topup result
      properties:
        balance:
          type: object
          properties:
            balance:
              description: Multicurrency balance.
              type: integer
            shards:
              description: Multicurrency Shards balance.
              type: integer
      example:
        balance:
          balance: 1
          shards: 5
