# Upload Invoice File

**Method:** `PUT`

**Path:** `/api/pay/v1/orders/{orderId}/invoice/{invoiceId}/upload`

**Category:** International Payments

**Authentication:** Required

## Description

Uploads the actual invoice file (PDF/image) for a previously created invoice record.

**Prerequisites:**
- Invoice must be created first via the Capture Invoice API (Step 1).
- Use the `invoiceId` from Step 1 response.

**Constraints:**
- Maximum file size: 5 MB
- Allowed file types: PDF (.pdf), JPEG (.jpeg, .jpg), PNG (.png)
- File upload is one-time. Re-uploading returns 409 Conflict.


## Path Parameters

- `orderId` (`string`) **required** — Order ID.
- `invoiceId` (`string`) **required** — Invoice ID returned from the Capture Invoice API.

## Request Body

Content-Type: `multipart/form-data`

- `file` (`string`) **required** — The invoice file to upload. Max 5 MB. Allowed types - PDF, JPEG, PNG.

### Example Request

```json
{
  "file": "your_file"
}
```

## Responses

- `200` — Invoice file uploaded successfully.
- `400` — Validation error.
- `401` — 
- `409` — Invoice file already uploaded.
- `422` — Invoice not found.
- `500` — 

### Response Schema

- `invoiceId` (`string`) — Invoice identifier.
- `orderId` (`string`) — Order ID.
- `invoiceNumber` (`string`) — Invoice number.
- `invoiceDate` (`string`) — Invoice date.
- `supplierName` (`string`) — Supplier name (if provided during creation).
- `status` (`string`) — Updated to INVOICE_UPLOADED on success.

### Example Response

```json
{
  "invoiceId": "inv-260520225359-ab-XyZ123",
  "orderId": "v1-260520225359-aa-LHy288",
  "invoiceNumber": "v1-260520225359-aa-LHy288-IN",
  "invoiceDate": "2026-05-20",
  "supplierName": null,
  "status": "INVOICE_UPLOADED"
}
```

---

Reference: https://localhost:3000/api/international-payments/upload-invoice-file
