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

# Create And Mark Manual Refund (Crypto/WireTransfer/External)

> Create a manual refund record for a paid invoice when refund has been processed offline via crypto, wire transfer or External gateway, and mark it as requested. Supports crypto, wire transfer and external invoices.

## Endpoint Overview

**POST** `https://api.unibee.dev/merchant/invoice/create_mark_refund`

Create a manual refund record for a paid invoice when refund has been processed offline via crypto, wire transfer or External gateway, and mark it as requested. Supports crypto, wire transfer and external invoices.

***

## Authorization

All UniBee Merchant API requests require authentication via API key.

| Header          | Required | Description                           |
| --------------- | -------- | ------------------------------------- |
| `Authorization` | Yes      | Bearer `<your_api_key>`               |
| `Content-Type`  | Yes      | `application/json` (for request body) |

***

## Parameters

Parameters for this endpoint are listed below. The schema is also shown in the Try it panel.

### Request body

| Name           | Type    | Required | Description                                                 |
| -------------- | ------- | -------- | ----------------------------------------------------------- |
| `invoiceId`    | string  | Yes      | The unique id of invoice                                    |
| `reason`       | string  | Yes      | The reason of refund                                        |
| `refundAmount` | integer | Yes      | The amount of refund                                        |
| `refundNo`     | string  | No       | The out refund number (idempotent key from external system) |

***

## Request examples

### cURL

```bash theme={null}
curl -X POST "https://api.unibee.dev/merchant/invoice/create_mark_refund" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "invoiceId": "id_example",
  "reason": "",
  "refundAmount": 0,
  "refundNo": ""
}'
```

### Sandbox

```bash theme={null}
curl -X POST "https://api-sandbox.unibee.top/merchant/invoice/create_mark_refund" \
  -H "Authorization: Bearer YOUR_SANDBOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "invoiceId": "id_example",
  "reason": "",
  "refundAmount": 0,
  "refundNo": ""
}'
```

***

## Response

Success responses return a JSON envelope with `code`, `data`, `message`, `redirect`, and `requestId`. `code` `0` indicates success.

| Field         | Type    | Description                  |
| ------------- | ------- | ---------------------------- |
| `code`        | integer | Response code. `0` = success |
| `data`        | object  | Response payload             |
| `data.refund` | object  |                              |
| `message`     | string  | Human-readable message       |
| `requestId`   | string  | Request ID for support       |

***

## Error handling

| HTTP status | Meaning                                                                   |
| ----------- | ------------------------------------------------------------------------- |
| 400         | Bad request — invalid or missing parameters. Check `message` in the body. |
| 401         | Unauthorized — missing or invalid API key.                                |
| 404         | Not found — invalid path or resource.                                     |
| 500         | Server error — retry with backoff.                                        |

When `code` in the response body is non-zero, check `message` for details. Use `requestId` when contacting support.


## OpenAPI

````yaml post /merchant/invoice/create_mark_refund
openapi: 3.0.0
info:
  description: UniBee Api Server
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  title: OpenAPI UniBee
  version: daily,buildtime:202603161017
servers:
  - url: https://api.unibee.dev
  - url: https://api-sandbox.unibee.top
security:
  - Authorization: []
paths:
  /merchant/invoice/create_mark_refund:
    post:
      tags:
        - Invoice
      summary: Create And Mark Manual Refund (Crypto/WireTransfer/External)
      description: >-
        Create a manual refund record for a paid invoice when refund has been
        processed offline via crypto, wire transfer or External gateway, and
        mark it as requested. Supports crypto, wire transfer and external
        invoices.
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/unibee.api.merchant.invoice.CreateMarkRefundReq
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  code:
                    format: int
                    properties: {}
                    type: integer
                  data:
                    properties:
                      refund:
                        $ref: '#/components/schemas/unibee.api.bean.Refund'
                    type: object
                  merchantId:
                    format: int64
                    properties: {}
                    type: integer
                  message:
                    format: string
                    properties: {}
                    type: string
                  redirect:
                    format: string
                    properties: {}
                    type: string
                  requestId:
                    format: string
                    properties: {}
                    type: string
                type: object
          description: ''
components:
  schemas:
    unibee.api.merchant.invoice.CreateMarkRefundReq:
      description: >-
        Create a manual refund record for a paid invoice when refund has been
        processed offline via crypto, wire transfer or External gateway, and
        mark it as requested. Supports crypto, wire transfer and external
        invoices.
      properties:
        invoiceId:
          description: The unique id of invoice
          format: string
          properties: {}
          type: string
        reason:
          description: The reason of refund
          format: string
          properties: {}
          type: string
        refundAmount:
          description: The amount of refund
          format: int64
          properties: {}
          type: integer
        refundNo:
          description: The out refund number (idempotent key from external system)
          format: string
          properties: {}
          type: string
      required:
        - invoiceId
        - refundAmount
        - reason
      type: object
    unibee.api.bean.Refund:
      properties:
        countryCode:
          description: country code
          format: string
          properties: {}
          type: string
        createTime:
          description: create utc time
          format: int64
          properties: {}
          type: integer
        currency:
          description: currency
          format: string
          properties: {}
          type: string
        externalRefundId:
          description: external_refund_id
          format: string
          properties: {}
          type: string
        gatewayCurrencyExchange:
          $ref: '#/components/schemas/unibee.api.bean.GatewayCurrencyExchange'
        gatewayId:
          description: gateway_id
          format: int64
          properties: {}
          type: integer
        gatewayRefundId:
          description: gateway refund id
          format: string
          properties: {}
          type: string
        invoiceId:
          description: invoice id
          format: string
          properties: {}
          type: string
        merchantId:
          description: merchant id
          format: int64
          properties: {}
          type: integer
        metadata:
          additionalProperties:
            $ref: '#/components/schemas/interface'
          format: map[string]interface {}
          properties: {}
          type: object
        paymentId:
          description: relative payment id
          format: string
          properties: {}
          type: string
        refundAmount:
          description: refund amount, cent
          format: int64
          properties: {}
          type: integer
        refundComment:
          description: refund comment
          format: string
          properties: {}
          type: string
        refundCommentExplain:
          description: refund comment
          format: string
          properties: {}
          type: string
        refundId:
          description: refund id (system generate)
          format: string
          properties: {}
          type: string
        refundTime:
          description: refund success time
          format: int64
          properties: {}
          type: integer
        returnUrl:
          description: return url after refund success
          format: string
          properties: {}
          type: string
        status:
          description: status。10-pending，20-success，30-failure, 40-cancel
          format: int
          properties: {}
          type: integer
        subscriptionId:
          description: subscription id
          format: string
          properties: {}
          type: string
        type:
          description: 1-gateway refund,2-mark refund
          format: int
          properties: {}
          type: integer
        userId:
          description: user_id
          format: int64
          properties: {}
          type: integer
      type: object
    unibee.api.bean.GatewayCurrencyExchange:
      properties:
        exchange_amount:
          description: the exchange amount of gateway
          format: int64
          properties: {}
          type: integer
        exchange_rate:
          description: >-
            the exchange rate of gateway, set to 0 if using
            https://app.exchangerate-api.com/ instead of fixed exchange rate
          format: float64
          properties: {}
          type: number
        from_currency:
          description: the currency of gateway exchange from
          format: string
          properties: {}
          type: string
        to_currency:
          description: the currency of gateway exchange to
          format: string
          properties: {}
          type: string
      type: object
    interface:
      properties: {}
      type: object
  securitySchemes:
    Authorization:
      bearerFormat: JWT
      scheme: bearer
      type: http

````