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

# Upload Invoice

> Upload an invoice or other document for an existing order.

## Overview

The Upload Invoice endpoint is used to attach required documents to an order after it has been created. This is crucial for compliance and record-keeping. The request must be sent as `multipart/form-data`.

This endpoint allows you to upload a document (like an invoice or air waybill), associated with an existing order.

## Request Parameters

### Path

| Name      | In   | Type   | Required | Description                    |
| --------- | ---- | ------ | -------- | ------------------------------ |
| order\_id | path | string | Yes      | Unique identifier of the order |

### Body (multipart/form-data)

### Parameter Definitions

#### Top-level

| Name           | Type   | Required | Description                 | Constraints                                                       |
| -------------- | ------ | -------- | --------------------------- | ----------------------------------------------------------------- |
| identifier     | string | Yes      | Identifier for the document | Free-form string for your reference (e.g., invoice or AWB number) |
| document\_type | string | Yes      | Type of document            | Enum: `invoice`, `awb`                                            |
| file           | binary | Yes      | The file to upload          | Max size 2MB; supported formats: `pdf`, `jpg`, `jpeg`             |

## Examples

<CodeGroup>
  ```bash Upload Invoice (multipart/form-data) theme={null}
  curl -X POST 'https://api.eximpe.com/pg/orders/{order_id}/documents/' \
    -H 'Accept: application/json' \
    -H 'X-Client-ID: {client_id}' \
    -H 'X-Client-Secret: {client_secret}' \
    -F 'identifier=INV23987' \
    -F 'document_type=invoice' \
    -F 'file=@INV23987.pdf;type=application/pdf'
  ```

  ```bash Upload Air Waybill (multipart/form-data) theme={null}
  curl -X POST 'https://api.eximpe.com/pg/orders/{order_id}/documents/' \
    -H 'Accept: application/json' \
    -H 'X-Client-ID: {client_id}' \
    -H 'X-Client-Secret: {client_secret}' \
    -F 'identifier=AWB23987' \
    -F 'document_type=awb' \
    -F 'file=@AWB23987.pdf;type=application/pdf'
  ```
</CodeGroup>


## OpenAPI

````yaml POST /pg/orders/{order_id}/documents/
openapi: 3.0.0
info:
  title: Eximpe Payment Gateway API
  description: >-
    API for payment processing and order management through Eximpe payment
    gateway. This specification includes v1, v2, and v3 API versions.
  license:
    name: Proprietary
  version: 2.0.0
servers:
  - url: https://api-pacb-uat.eximpe.com
    description: Payment Gateway Sandbox URL
security:
  - clientAuth: []
    clientSecretAuth: []
    apiVersionHeader: []
tags:
  - name: Card Tokens
  - name: Merchants
  - name: Orders
  - name: Payment Links
  - name: Payments
  - name: Refunds
  - name: Settlements
  - name: Subscriptions
paths:
  /pg/orders/{order_id}/documents/:
    post:
      tags:
        - Orders
      summary: Upload Document
      description: Upload an invoice or other document for an existing order.
      operationId: v1_post_pg_orders_order_id_documents_
      parameters:
        - name: order_id
          in: path
          description: Unique identifier of the order
          required: true
          schema:
            type: string
          example: OD3451762252
      requestBody:
        description: Document upload request. The body must be `multipart/form-data`.
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/v1_UploadDocumentRequest'
            examples:
              invoiceUpload:
                summary: Invoice Upload Example
                value:
                  identifier: INV_EDU_20241205
                  document_type: invoice
                  file: python_course_invoice_2024.pdf
      responses:
        '200':
          description: Document uploaded successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1_UploadDocumentResponse'
              example:
                success: true
                message: Documents uploaded successfully
                data:
                  order_id: OD9411897512
                  reference_id: TEST_FOB46D
                  amount: 1000
                  currency: INR
                  mop_type: upi
                  buyer:
                    name: Vikash Gupta
                    email: vikash.gupta@edupublishers.com
                    phone: '+919456789012'
                    address:
                      line_1: C-45, Sector 62, Institutional Area
                      line_2: Near Metro Station
                      city: Noida
                      state: Uttar Pradesh
                      postal_code: '201309'
                    pan_number: ABCPV1234G
                    dob: '1987-03-15'
                  product:
                    name: Complete Python Programming Course Bundle
                    description: >-
                      Comprehensive online course with 50+ hours of content,
                      projects, and certification
                    hs_code: '49019900'
                    hs_code_description: >-
                      Printed books, brochures, leaflets and similar printed
                      matter
                    type_of_goods: service
                  invoice:
                    number: IN1123213
                    date: '2025-06-22'
                    file: https://eximpe.com/inv-12312312.pdf
                  air_waybills:
                    - number: AWB-23343
                      file: https://eximpe.com/awb-8F3F51D2.pdf
                  payments:
                    - payment_id: PR1469384681
                      mop_type: upi
                      status: captured
                      status_message: null
                      settlement:
                        status: ready_for_settlement
                        message: null
                        settlement_details: null
                      created_at: '2025-06-23T10:44:14.344135Z'
                  status: payment_successful
                  status_message: Payment captured successfully
                  created_at: '2025-06-23T10:44:11.702363Z'
        '400':
          description: Bad Request - Invalid parameters or file.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1_ErrorResponse'
              example:
                success: false
                error:
                  code: ERR_ORDER_002
                  message: Validation error
                  details:
                    identifier: This field is required.
        '401':
          description: Unauthorized - Invalid credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1_ErrorResponse'
              example:
                success: false
                error:
                  code: ERR_AUTH_000
                  message: Missing credentials
                  details:
                    authentication: Missing credentials.
        '404':
          description: Order not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1_ErrorResponse'
              example:
                success: false
                error:
                  code: ERR_ORDER_001
                  message: Order not found
                  details:
                    order_id: Order not found
      security:
        - clientAuth: []
          clientSecretAuth: []
          apiVersionHeader: []
components:
  schemas:
    v1_UploadDocumentRequest:
      type: object
      required:
        - identifier
        - document_type
        - file
      properties:
        identifier:
          type: string
          description: Identifier for the document (e.g., order ID)
        document_type:
          type: string
          description: Type of document invoice or awb
        file:
          type: string
          format: binary
          description: The file to upload
    v1_UploadDocumentResponse:
      type: object
      required:
        - success
        - message
        - data
      properties:
        success:
          type: boolean
          description: Indicates if the document upload was successful
        message:
          type: string
          description: Response message
        data:
          $ref: '#/components/schemas/v1_OrderDetails'
    v1_ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          enum:
            - false
          description: >-
            Indicates if the request was successful. Always false for error
            responses.
        error:
          $ref: '#/components/schemas/v1_ErrorDetails'
    v1_OrderDetails:
      type: object
      required:
        - order_id
        - reference_id
        - amount
        - currency
        - status
        - created_at
      properties:
        order_id:
          type: string
          description: Unique order identifier
        reference_id:
          type: string
          description: Unique reference identifier for the order
        amount:
          type: string
          description: Amount in decimal format (e.g., "100.00")
          pattern: ^\d+\.\d{2}$
        currency:
          type: string
          description: 3-letter ISO currency code
        opted_mop_type:
          type: string
          description: Method of payment type
          enum:
            - upi
            - credit_card
            - net_banking
            - debit_card
            - qr
        buyer:
          type: object
          required:
            - name
            - address
          properties:
            name:
              type: string
              description: Buyer's full name
            email:
              type: string
              format: email
              description: Buyer's email address
            phone:
              type: string
              description: Buyer's phone number with country code
            address:
              $ref: '#/components/schemas/v1_Address'
            pan_number:
              type: string
              nullable: true
              description: Buyer's PAN number
            dob:
              type: string
              format: date
              nullable: true
              description: Buyer's date of birth
        product:
          $ref: '#/components/schemas/v1_Product'
        invoice:
          type: object
          properties:
            number:
              type: string
              description: Invoice number
            date:
              type: string
              format: date
              description: Invoice date in YYYY-MM-DD format
            file:
              type: string
              nullable: true
              description: Invoice file URL
        air_waybills:
          type: array
          description: Array of air waybill information
          items:
            type: object
            properties:
              number:
                type: string
                description: Air waybill number
              file:
                type: string
                description: Air waybill file URL
        payments:
          type: array
          description: Array of payment request information
          items:
            $ref: '#/components/schemas/v1_PaymentRequest'
        status:
          type: string
          description: Order status
          enum:
            - payment_pending
            - payment_successful
            - failed
        status_message:
          type: string
          nullable: true
          description: Order status message
        created_at:
          type: string
          format: date-time
          description: Order creation timestamp
    v1_ErrorDetails:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Error code (e.g., ERR_ORDER_002)
        message:
          type: string
          description: Error message
        details:
          type: object
          description: Detailed validation error information with field-specific errors
          additionalProperties:
            type: string
            description: Error message for the specific field
    v1_Address:
      type: object
      required:
        - line_1
        - city
        - state
        - postal_code
      properties:
        line_1:
          type: string
          description: Address line 1
        line_2:
          type: string
          description: Address line 2
        city:
          type: string
          description: City name
        state:
          type: string
          description: State name
        postal_code:
          type: string
          description: Postal/ZIP code
    v1_Product:
      type: object
      required:
        - name
        - type_of_goods
      properties:
        name:
          type: string
          description: Product name
        description:
          type: string
          description: Product description
        hs_code:
          type: string
          description: Harmonized System code, required for physical goods
        hs_code_description:
          type: string
          description: Description of the HS code
        type_of_goods:
          type: string
          description: Type of goods (e.g., physical_goods)
          enum:
            - physical_goods
            - digital_goods
            - service
    v1_PaymentRequest:
      type: object
      required:
        - payment_id
        - mop_type
        - status
        - created_at
      properties:
        payment_id:
          type: string
          description: Payment request ID
        mop_type:
          type: string
          description: Method of payment type
          enum:
            - upi
            - credit_card
            - net_banking
            - debit_card
            - qr
        status:
          type: string
          description: Payment status
          enum:
            - pending
            - captured
            - failed
            - cancelled
        status_message:
          type: string
          nullable: true
          description: Payment status message
        settlement:
          type: object
          properties:
            status:
              type: string
              description: Settlement status
              enum:
                - pending
                - ready_for_settlement
                - settled
                - failed
            message:
              type: string
              nullable: true
              description: Settlement message
            settlement_details:
              type: object
              nullable: true
              description: Settlement details
        created_at:
          type: string
          format: date-time
          description: Payment request creation timestamp
  securitySchemes:
    clientAuth:
      type: apiKey
      name: X-Client-ID
      in: header
      description: >-
        **Client Application ID** - Your unique application identifier used to
        authenticate API requests. You can find your Client ID in the Developer
        Settings section of the merchant dashboard.
      x-displayName: Client ID
      x-example: your-client-id
    clientSecretAuth:
      type: apiKey
      name: X-Client-Secret
      in: header
      description: >-
        **Client Secret Key** - Your secret key used alongside the Client ID for
        secure authentication. Keep this confidential and never expose it in
        client-side code. Available in the Developer Settings section of the
        merchant dashboard.
      x-displayName: Client Secret
      x-example: your-client-secret
    apiVersionHeader:
      type: apiKey
      name: X-API-Version
      in: header
      description: >-
        **API Version** - Specifies which version of the API to use (e.g.,
        '1.X.X', '2.X.X', or '3.X.X'). This header allows you to control which
        API version your integration uses. Default version information is
        available in the Developer Settings.
      x-displayName: API Version
      x-example: 3.0.0

````