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

# Фискализация Uzum

> Фискализация платежей Uzum FastPay

## Обзор

**Uzum Fiscalization API** используется для завершения (фискализации) ранее
initiated Uzum FastPay payment.

Эндпоинт подтверждает платеж, прикрепляя фискальный чек, сгенерированный
by Soliq (OFD).

***

## Поля запроса

| Поле         | Тип    | Обяз. | Описание                                                     |
| ------------ | ------ | ----- | ------------------------------------------------------------ |
| `payment_id` | string | ✅     | Unique payment identifier received from Uzum FastPay payment |
| `qr_code`    | string | ✅     | URL of the fiscal receipt from Soliq (OFD)                   |

***

## Поля ответа

### ✅ Успешный ответ

| Поле                       | Тип            | Описание                                         |
| -------------------------- | -------------- | ------------------------------------------------ |
| `data`                     | object         | Данные ответа                                    |
| `data.payment_id`          | string         | Payment identifier                               |
| `data.payment_status`      | string         | Fiscalization status (`SUCCESS`, `FAILED`, etc.) |
| `data.error_code`          | string         | Provider error code (`0` on success)             |
| `data.error_message`       | string \| null | Error description (null on success)              |
| `data.client_phone_number` | string         | Client phone number                              |
| `error`                    | null           | Error object (always `null` on success)          |
| `is_success`               | boolean        | Always `true`                                    |

***

### 🚫 Ответ с ошибкой

> **Примечание:** Даже при ошибке валидации сервер возвращает HTTP `200`.

| Поле            | Тип         | Описание                                     |
| --------------- | ----------- | -------------------------------------------- |
| `data`          | null        | No data returned                             |
| `error`         | object      | Error details                                |
| `error.code`    | integer     | Internal validation or processing error code |
| `error.message` | string      | Понятное описание ошибки                     |
| `error.data`    | any \| null | Additional error details                     |
| `is_success`    | boolean     | Always `false`                               |


## OpenAPI

````yaml POST /payment/uzum_confirm
openapi: 3.0.3
info:
  title: Uzum Fiscalization API
  description: Fiscalization endpoint for Uzum payments
  version: 1.0.0
servers:
  - url: https://fbox.ngrok.io
security: []
paths:
  /payment/uzum_confirm:
    post:
      tags:
        - Uzum Fiscalization
      summary: Fiscalization Uzum payment
      operationId: uzumFiscalization
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FiscalizationRequest'
            example:
              payment_id: bb75f609-6d97-4b45-9ed3-80e5fcd19ef1
              qr_code: >-
                https://ofd.soliq.uz/check?t=UZ170703100597&r=2421&c=20230104121801&s=514343190161
      responses:
        '200':
          description: Fiscalization successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FiscalizationResponse'
              example:
                data:
                  payment_id: bb75f609-6d97-4b45-9ed3-80e5fcd19ef1
                  payment_status: SUCCESS
                  error_code: '0'
                  error_message: null
                  client_phone_number: '998712565009'
                error: null
                is_success: true
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error400Response'
              example:
                data: null
                error:
                  code: 7
                  message: '{"payment_id":["This field may not be blank."]}'
                  data: null
                is_success: false
        '500':
          description: Internal server error
components:
  schemas:
    FiscalizationRequest:
      type: object
      required:
        - payment_id
        - qr_code
      properties:
        payment_id:
          type: string
          description: >-
            Unique order identifier received in the
            `/uzum/api/apelsin-pay/merchant/v2/payment` response and provided by
            Uzum.
          example: bb75f609-6d97-4b45-9ed3-80e5fcd19ef1
        qr_code:
          type: string
          description: Link to fiscalization transaction on Soliq
          example: >-
            https://ofd.soliq.uz/check?t=UZ170703100597&r=2421&c=20230104121801&s=514343190161
    FiscalizationResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            payment_id:
              type: string
              nullable: false
            payment_message:
              type: string
              example: SUCCESS
            error_code:
              type: string
              nullable: false
              example: '0'
            error_message:
              type: string
              nullable: true
            client_phone_number:
              type: string
              nullable: false
              example: '998712565009'
        error:
          type: string
          nullable: true
        is_success:
          type: boolean
          example: true
    Error400Response:
      type: object
      properties:
        data:
          type: string
          nullable: true
          default: null
        error:
          type: object
          properties:
            code:
              type: integer
              example: 7
            message:
              type: string
              example: '{"payment_id":["This field may not be blank."]}'
            data:
              type: string
              nullable: true
              default: null
        is_success:
          type: boolean
          example: false

````