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

# Create purchase



## OpenAPI

````yaml POST /purchases/create
openapi: 3.0.0
info:
  title: StreamSkill - OpenApi 3.0
  description: ''
  termsOfService: https://streamskill.pro/en/privacy_policy
  version: 1.0.0
  contact:
    email: streamskillpro@gmail.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://api.streamskill.pro/v1
    description: Production server - v1
security:
  - bearerAuth: []
paths:
  /purchases/create:
    parameters:
      - $ref: '#/components/parameters/Accept-Language'
      - $ref: '#/components/parameters/expandPurchase'
    post:
      summary: Create Purchase
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CartObject'
      responses:
        '200':
          $ref: '#/components/responses/Purchase'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/validationError'
components:
  parameters:
    Accept-Language:
      name: Accept-Language
      in: header
      required: false
      description: The language of the response
      schema:
        $ref: '#/components/schemas/LanguageObject'
    expandPurchase:
      name: expand
      in: query
      required: false
      description: >-
        The expand of the purchase (you can use multiple values separated by
        commas)
      schema:
        type: string
        enum:
          - tarif
          - parent
          - api
          - chatbot
        example: tarif,parent
  schemas:
    CartObject:
      type: object
      required:
        - tarif
        - channel
      properties:
        tarif:
          $ref: '#/components/schemas/TarifObject'
        channel:
          type: string
          example: twitch
          description: >-
            The channel (or another slug for tarif, for example - video id, clip
            id, etc.)
        interval:
          type: integer
          example: 10
          maximum: 86400
          minimum: 1
          description: The interval of the purchase (if tarif supports custom interval)
        lang:
          type: string
          default: auto
          example: en
          description: >-
            Stream language for AI Chatbots. Only applicable for AI Chatbots
            tariffs. See the list of supported languages below.
          enum:
            - auto
            - en
            - ru
            - uk
            - de
            - es
            - fr
            - it
            - pt
            - pl
            - tr
            - ar
            - zh
            - ja
            - ko
            - hi
            - th
            - vi
            - id
            - ms
            - tl
            - ca
            - da
            - nl
            - 'no'
            - ro
            - sk
            - fi
            - sv
            - cs
            - el
            - bg
            - hu
            - zh-hk
            - other
        comment:
          type: string
          example: Test comment
          default: ''
          description: The comment for the purchase
        start:
          type: boolean
          default: false
          example: false
          description: >-
            Start the purchase after creation (Use only if tariff supports
            start)
    LanguageObject:
      type: string
      enum:
        - en
        - ru
      default: en
    TarifObject:
      type: object
      required:
        - id
      properties:
        id:
          type: integer
          description: The ID of the tarif
          example: 1
          minimum: 1
        quantity:
          type: integer
          description: The quantity of the tarif (if tarif supports custom quantity)
          example: 1000
          minimum: 1
          maximum: 10000
        duration:
          type: integer
          description: >-
            The duration of the tarif (if tarif supports custom duration or is
            hourly)
          example: 24
          minimum: 1
          maximum: 24
          default: 1
    PurchaseObject:
      type: object
      properties:
        id:
          type: integer
          description: The ID of the purchase
          example: 1
          minimum: 1
        price:
          type: number
          description: The price of the purchase
          example: 10
        currency:
          $ref: '#/components/schemas/CurrencyObject'
        created_at:
          type: integer
          format: int64
          description: The timestamp of the purchase creation
          example: 1640000000
        order_type:
          type: string
          description: The type of the order
          example: twitch_viewers
        channel:
          type: string
          description: >-
            The channel (or another slug for tarif, for example - video id, clip
            id, etc.)
          example: https://www.twitch.tv/twitch
        status:
          $ref: '#/components/schemas/PurchaseStatusObject'
        service:
          type: string
          enum:
            - twitch
            - trovo
            - kick
            - youtube
          description: The service of the purchase
          example: twitch
        parent:
          type: boolean
          description: The parent of the purchase
          default: false
        api:
          type: boolean
          description: The API of the purchase
          example: true
        chatbot:
          type: boolean
          description: The chatbot of the purchase
          default: false
        tarif:
          type: integer
          description: The ID of the tarif
          example: 1
          minimum: 1
    CurrencyObject:
      type: string
      enum:
        - usd
        - rub
      example: usd
    PurchaseStatusObject:
      type: string
      enum:
        - created
        - awaiting
        - working
        - stopped
        - completed
        - failed
        - deleted
        - refunded
      example: active
      description: The status of the purchase
  responses:
    Purchase:
      description: OK
      headers:
        Date:
          $ref: '#/components/headers/Date'
        Server:
          $ref: '#/components/headers/Server'
        Content-Length:
          $ref: '#/components/headers/Content-Length'
        Keep-Alive:
          $ref: '#/components/headers/Keep-Alive'
        Connection:
          $ref: '#/components/headers/Connection'
        Content-Type:
          $ref: '#/components/headers/Content-Type'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PurchaseObject'
    Unauthorized:
      description: Unauthorized
      headers:
        Date:
          $ref: '#/components/headers/Date'
        Server:
          $ref: '#/components/headers/Server'
        Content-Length:
          $ref: '#/components/headers/Content-Length'
        Keep-Alive:
          $ref: '#/components/headers/Keep-Alive'
        Connection:
          $ref: '#/components/headers/Connection'
        Content-Type:
          $ref: '#/components/headers/Content-Type'
      content:
        application/json:
          schema:
            type: object
          example:
            name: Unauthorized
            message: Your request was made with invalid credentials.
            code: 0
            status: 401
            type: unauthorized_http_exception
    validationError:
      description: Validation Error
      headers:
        Date:
          $ref: '#/components/headers/Date'
        Server:
          $ref: '#/components/headers/Server'
        Content-Length:
          $ref: '#/components/headers/Content-Length'
        Keep-Alive:
          $ref: '#/components/headers/Keep-Alive'
        Connection:
          $ref: '#/components/headers/Connection'
        Content-Type:
          $ref: '#/components/headers/Content-Type'
      content:
        application/json:
          schema:
            type: object
          example:
            name: Bad Request
            errors:
              tarif.id:
                - Tarif not found
            code: 0
            status: 422
            type: validate_exception
  headers:
    Date:
      schema:
        type: string
        example: Sat, 25 May 2024 23:59:59 GMT
    Server:
      schema:
        type: string
        example: Apache/2.4.38 (Debian)
    Content-Length:
      schema:
        type: integer
        example: '100'
    Keep-Alive:
      schema:
        type: string
        example: timeout=5, max=100
    Connection:
      schema:
        type: string
        example: Keep-Alive
    Content-Type:
      schema:
        type: string
      example: application/json; charset=UTF-8
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````