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

# Create kaspi

> Turn a Kaspi outage into an honest status code instead of a 500.

A dead platform session is a 409 (the same shape the per-company integration answers
with), Kaspi refusing the request is a 400, and the service being unreachable is a 502 —
the payer can retry that one.



## OpenAPI

````yaml /openapi/billing.json post /v1/billing/invoices/{id}/kaspi/
openapi: 3.0.3
info:
  title: Yume API — Биллинг
  version: 1.0.0
  description: Подписки, счета и тарификация.
servers:
  - url: https://api.yume.cloud
    description: Production
  - url: https://api.stage.yume.cloud
    description: Stage
security: []
paths:
  /v1/billing/invoices/{id}/kaspi/:
    post:
      tags:
        - invoices
      summary: Create kaspi
      description: >-
        Turn a Kaspi outage into an honest status code instead of a 500.


        A dead platform session is a 409 (the same shape the per-company
        integration answers

        with), Kaspi refusing the request is a 400, and the service being
        unreachable is a 502 —

        the payer can retry that one.
      operationId: invoices_kaspi_create
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
        - $ref: '#/components/parameters/TenantId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TenantInvoiceKaspi'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/TenantInvoiceKaspi'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/TenantInvoiceKaspi'
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TenantInvoiceKaspi'
          description: ''
      security:
        - jwtAuth: []
components:
  parameters:
    TenantId:
      name: X-Tenant-Id
      in: header
      required: false
      schema:
        type: integer
      description: >-
        Компания, в контексте которой выполняется запрос — её id из `GET
        /v1/tenant/`. Пользователь должен состоять в этой компании: чужой id
        доступа к данным не даёт. Без заголовка компания определяется по домену
        запроса.
  schemas:
    TenantInvoiceKaspi:
      type: object
      description: >-
        Raise a Kaspi Pay payment for an existing subscription invoice.


        `qr` answers with a `pay.kaspi.kz` link to render as a QR or open on a
        phone; `invoice`

        pushes a confirmation into the Kaspi app of `phone` instead. Either way
        the invoice is

        only marked paid by the webhook — never by this response.
      properties:
        method:
          allOf:
            - $ref: '#/components/schemas/MethodEnum'
          writeOnly: true
          default: qr
        phone:
          type: string
          writeOnly: true
          pattern: ^7\d{9}$
        payment_id:
          type: string
          readOnly: true
        payment_url:
          type: string
          readOnly: true
          nullable: true
        expire_at:
          type: string
          readOnly: true
          nullable: true
        status:
          type: string
          readOnly: true
      required:
        - expire_at
        - payment_id
        - payment_url
        - status
    MethodEnum:
      enum:
        - qr
        - invoice
      type: string
      description: |-
        * `qr` - qr
        * `invoice` - invoice
  securitySchemes:
    jwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````