> ## Documentation Index
> Fetch the complete documentation index at: https://eximpe.mintlify.site/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.


## OpenAPI

````yaml openapi.json 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
  license:
    name: Proprietary
  version: 1.0.0
servers:
  - url: https://api-staging.eximpe.com
    description: Staging server
  - url: https://api.eximpe.com
    description: Production server
security:
  - clientAuth: []
    clientSecretAuth: []
paths:
  /pg/orders/{order_id}/documents/:
    post:
      tags:
        - Orders
      summary: Upload Document
      description: Upload an invoice or other document for an existing order.
      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/UploadDocumentRequest'
            examples:
              invoiceUpload:
                summary: Invoice Upload Example
                value:
                  identifier: IN1123213
                  document_type: invoice
                  file: your-invoice.pdf
      responses:
        '200':
          description: Document uploaded successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/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: John Doe
                    email: john.doe@example.com
                    phone: '+919876543210'
                    address:
                      line_1: 123 Main Street
                      line_2: Apt 4B
                      city: City
                      state: State
                      postal_code: '123456'
                    pan_number: BNYPG9212K
                    dob: '2010-01-23'
                  product:
                    name: Sample Product
                    description: This is a sample product description
                    hs_code: '98051000'
                    hs_code_description: Portable automatic data processing machines
                    type_of_goods: goods
                  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/ErrorResponse'
        '401':
          description: Unauthorized - Invalid credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Order not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - clientAuth: []
          clientSecretAuth: []
components:
  schemas:
    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
    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/OrderDetails'
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          description: Indicates if the request was successful
        error:
          $ref: '#/components/schemas/ErrorDetails'
    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: number
          description: Order amount
        currency:
          type: string
          description: 3-letter ISO currency code
        mop_type:
          type: string
          description: Method of payment type
          enum:
            - UPI
            - CREDIT_CARD
            - NETBANKING
            - 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/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/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/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
        is_testing:
          type: boolean
          description: Whether this is a test order
    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
    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
    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
        hs_code_description:
          type: string
          description: Description of the HS code
        type_of_goods:
          type: string
          description: Type of goods (e.g., goods)
          enum:
            - goods
            - services
    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
            - NETBANKING
            - 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 app ID. You can find your app id in the merchant dashboard.
    clientSecretAuth:
      type: apiKey
      name: X-Client-Secret
      in: header
      description: Client secret key. You can find your secret in the merchant dashboard.

````