> ## 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.

# Order Refuse

> Refuse (refund) an existing order

## Overview

The **Order Refuse API** is used to perform a refund operation for an existing order.

This endpoint registers a fiscal refund, recalculates product totals,
and returns fiscal information such as receipt number and QR code.

Authorization is **not required**.

***

## Request Fields

### General Fields

| Field              | Type    | Required | Description                          |
| ------------------ | ------- | -------- | ------------------------------------ |
| `number`           | integer | ✅        | Order number or ID                   |
| `uuid`             | string  | ❌        | Unique request identifier            |
| `qr_code`          | string  | ❌        | Link to original receipt             |
| `time`             | string  | ✅        | Time in format `yyyy-MM-dd HH:mm:ss` |
| `cashier`          | string  | ✅        | Cashier name                         |
| `received_cash`    | integer | ❌        | Received cash amount ×100            |
| `change`           | integer | ❌        | Change amount ×100                   |
| `received_card`    | integer | ❌        | Received card amount ×100            |
| `card_type`        | integer | ❌        | Card type identifier                 |
| `ppt_id`           | string  | ❌        | POS terminal ID                      |
| `send_email`       | boolean | ❌        | Send receipt by email                |
| `email`            | string  | ❌        | Email for receipt                    |
| `sms_phone_number` | string  | ❌        | Phone number for SMS receipt         |

***

### Products

| Field              | Type    | Required | Description          |
| ------------------ | ------- | -------- | -------------------- |
| `name`             | string  | ✅        | Product name         |
| `barcode`          | string  | ✅        | Product barcode      |
| `amount`           | integer | ✅        | Quantity ×1000       |
| `unit_name`        | string  | ✅        | Unit name            |
| `price`            | integer | ✅        | Total price          |
| `product_price`    | number  | ✅        | Unit price ×100      |
| `vat`              | number  | ❌        | VAT amount ×100      |
| `vat_percent`      | number  | ❌        | VAT percent          |
| `discount`         | number  | ❌        | Discount amount ×100 |
| `discount_percent` | number  | ❌        | Discount percent     |
| `other`            | number  | ❌        | Other discounts ×100 |
| `class_code`       | string  | ❌        | Product class code   |
| `labels`           | array   | ❌        | Marking codes        |
| `package_code`     | integer | ❌        | Package code         |
| `owner_type`       | integer | ❌        | Owner type           |

***

### Extra Info

| Field                 | Type   | Required | Description         |
| --------------------- | ------ | -------- | ------------------- |
| `phone_number`        | string | ❌        | Client phone number |
| `qr_payment_id`       | string | ❌        | QR payment ID       |
| `qr_payment_provider` | string | ❌        | QR payment provider |

***

### Prices

| Field       | Type    | Required | Description         |
| ----------- | ------- | -------- | ------------------- |
| `name`      | string  | ✅        | Payment method name |
| `price`     | integer | ✅        | Amount ×100         |
| `vat_type`  | string  | ❌        | VAT type            |
| `vat_price` | integer | ❌        | VAT amount ×100     |

***

## Response Fields

### ✅ Success Response `200`

| Field                  | Type    | Description              |
| ---------------------- | ------- | ------------------------ |
| `data.terminal_id`     | string  | Terminal ID              |
| `data.receipt_count`   | integer | Receipt count (Z-report) |
| `data.date_time`       | string  | Fiscal date-time         |
| `data.fiscal_sign`     | string  | Fiscal sign              |
| `data.applet_version`  | string  | Applet version           |
| `data.qr_url`          | string  | QR code URL              |
| `data.cash_box_number` | string  | Cash box number          |
| `error`                | null    | Always `null`            |
| `is_success`           | boolean | Always `true`            |

***

### 🚫 Error Response

| Field           | Type           | Description      |
| --------------- | -------------- | ---------------- |
| `data`          | null           | No data          |
| `error.code`    | integer        | Error code       |
| `error.message` | string         | Error message    |
| `error.data`    | string \| null | Extra error info |
| `is_success`    | boolean        | Always `false`   |

***

### Common Error Codes

| Code    | Description                   |
| ------- | ----------------------------- |
| `65275` | Refund info is not valid      |
| `102`   | Fiscal module not initialized |


## OpenAPI

````yaml POST /order/refuse
openapi: 3.0.0
info:
  title: Order Refuse API
  version: 1.0.0
servers: []
security: []
paths:
  /order/refuse:
    post:
      summary: Refuse order (refund)
      description: Performs fiscal refund for an existing order
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                number:
                  type: integer
                uuid:
                  type: string
                time:
                  type: string
                cashier:
                  type: string
                qr_code:
                  type: string
                received_cash:
                  type: integer
                received_card:
                  type: integer
                change:
                  type: integer
                card_type:
                  type: integer
                ppt_id:
                  type: string
                products:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                      barcode:
                        type: string
                      amount:
                        type: integer
                      unit_name:
                        type: string
                      price:
                        type: integer
                      product_price:
                        type: number
                      vat:
                        type: integer
                      vat_percent:
                        type: integer
                      discount:
                        type: integer
                      discount_percent:
                        type: integer
                      other:
                        type: integer
                      labels:
                        type: array
                        items:
                          type: string
                        example:
                          - 05367567230048c?eN1(o0029
                      class_code:
                        type: string
                      package_code:
                        type: integer
                      owner_type:
                        type: integer
                      comission_info:
                        type: array
                        items:
                          type: object
                          properties:
                            inn:
                              type: string
                            pinfl:
                              description: price multiplied by 100
                    required:
                      - name
                      - barcode
                      - amount
                      - unit_name
                      - price
                      - product_price
                      - vat
                      - vat_percent
                      - discount
                      - discount_percent
                      - other
                      - class_code
                      - package_code
                      - owner_type
                extra_info:
                  type: array
                  items:
                    type: object
                    properties:
                      phone_number:
                        type: string
                      qr_payment_id:
                        type: string
                      qr_payment_provider:
                        type: string
                send_email:
                  type: boolean
                  default: false
                email:
                  type: string
                sms_phone_number:
                  type: string
                  example: '+998712565009'
                prices:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                      price:
                        type: integer
                        description: price multiplied by 100
                      vat_type:
                        type: string
                      vat_price:
                        type: integer
                        description: vat price multiplied by 100
                    required:
                      - name
                      - price
                      - vat_price
                      - vat_type
              required:
                - number
                - time
                - cashier
                - products
                - qr_code
                - received_cash
                - change
                - received_card
                - card_type
                - ppt_id
                - prices
      responses:
        '200':
          description: Refund processed
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      terminal_id:
                        type: string
                      receipt_count:
                        type: integer
                      date_time:
                        type: string
                      fiscal_sign:
                        type: string
                      applet_version:
                        type: string
                      qr_url:
                        type: string
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: integer
                      data:
                        type: string
                  is_success:
                    type: boolean

````