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

# Create Invoice

> Create Invoice



## OpenAPI

````yaml post /v1/invoices
openapi: 3.0.0
info:
  description: Open API's for WizCommerce API's
  title: WizCommerce Open API's
  termsOfService: https://wizcommerce.com/terms/
  contact:
    name: Tech Support
    url: https://help.wizcommerce.com/
    email: tech@wizcommerce.com
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  version: '1.0'
servers:
  - url: https://api.wizcommerce.com
    description: Production BaseURL
  - url: https://api-staging.sourcerer.tech
    description: Staging BaseURL
security: []
paths:
  /v1/invoices:
    post:
      tags:
        - Invoice
      summary: Create Invoice
      description: Create Invoice
      requestBody:
        $ref: '#/components/requestBodies/dtos.InvoiceCreateRequest'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/dtos.SuccessResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/dtos.InvoiceResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.HttpError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.HttpError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.HttpError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.HttpError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.HttpError'
      security:
        - ApiKeyAuth: []
components:
  requestBodies:
    dtos.InvoiceCreateRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/dtos.InvoiceCreateRequest'
      description: Invoice
      required: true
  schemas:
    dtos.SuccessResponse:
      type: object
      properties:
        data:
          x-order: '1'
    dtos.InvoiceResponse:
      type: object
      properties:
        id:
          description: UUID
          type: string
          x-order: '1'
          example: 01f5d171-d3e3-4b2b-bd57-0727194b5bed
        reference_id:
          type: string
          x-order: '2'
          example: INV-20250101
        order_id:
          type: string
          x-order: '3'
          example: ORD-20250101
        invoice_number:
          type: string
          x-order: '4'
          example: INV-20250101
        total_amount:
          type: number
          x-order: '5'
          example: 269.96
        paid_amount:
          type: number
          x-order: '6'
          example: 100
        status:
          type: string
          x-order: '7'
          example: PAID
        due_date:
          type: string
          x-order: '8'
          example: '2025-01-01T00:00:00Z'
        remarks:
          type: string
          x-order: '9'
          example: Remarks
        url:
          type: string
          x-order: '10'
          example: https://example.com/invoice/INV-20250101
        created_at:
          type: string
          x-order: '11'
          example: '2025-01-01T00:00:00Z'
        updated_at:
          type: string
          x-order: '12'
          example: '2025-01-01T00:00:00Z'
        items:
          type: array
          items:
            $ref: '#/components/schemas/dtos.InvoiceItemResponse'
          x-order: '13'
    errors.HttpError:
      type: object
      properties:
        code:
          type: string
          x-order: '1'
        message:
          type: string
          x-order: '2'
        details:
          type: array
          items:
            $ref: '#/components/schemas/errors.HttpErrorDetails'
          x-order: '3'
    dtos.InvoiceCreateRequest:
      type: object
      required:
        - due_date
        - invoice_number
        - items
        - order_id
        - paid_amount
        - reference_id
        - total_amount
      properties:
        reference_id:
          type: string
          maxLength: 255
          x-order: '1'
          example: INV-20250101
        order_id:
          type: string
          maxLength: 255
          x-order: '2'
          example: ORD-20250101
        invoice_number:
          type: string
          maxLength: 255
          x-order: '3'
          example: INV-20250101
        total_amount:
          type: number
          x-order: '5'
          example: 1000000
        paid_amount:
          type: number
          minimum: 0
          x-order: '6'
          example: 0
        status:
          type: string
          enum:
            - PAID
            - PENDING
            - PARTIALLY_PAID
            - OVERPAID
          x-order: '8'
          example: PAID
        due_date:
          type: string
          x-order: '9'
          example: '2025-01-01T00:00:00Z'
        remarks:
          type: string
          maxLength: 255
          x-order: '10'
          example: Remarks
        url:
          type: string
          x-order: '11'
          example: https://example.com/invoice/INV-20250101
        created_at:
          type: string
          x-order: '12'
          example: '2025-01-01T00:00:00Z'
        updated_at:
          description: Updated at must be later than the order creation date
          type: string
          x-order: '13'
          example: '2025-01-01T00:00:00Z'
        items:
          type: array
          items:
            $ref: '#/components/schemas/dtos.InvoiceItemCreateRequest'
          x-order: '14'
    dtos.InvoiceItemResponse:
      type: object
      properties:
        name:
          type: string
          x-order: '4'
          example: Item Name
        product_id:
          type: string
          maxLength: 255
          x-order: '5'
          example: '1234567890'
        amount:
          type: number
          x-order: '6'
          example: 1000000
        item_total:
          type: number
          x-order: '8'
          example: 1000000
        id:
          description: UUID
          type: string
          example: 01f5d171-d3e3-4b2b-bd57-0727194b5bed
        quantity:
          type: integer
          example: 1000000
        reference_id:
          type: string
          example: ITEM-20250101
    errors.HttpErrorDetails:
      type: object
      properties:
        field:
          type: string
          x-order: '1'
        reason:
          type: string
          x-order: '2'
    dtos.InvoiceItemCreateRequest:
      type: object
      required:
        - amount
        - name
        - quantity
        - reference_id
        - sku
      properties:
        reference_id:
          type: string
          maxLength: 255
          x-order: '1'
          example: ITEM-20250101
        sku:
          type: string
          maxLength: 255
          x-order: '2'
          example: SKU-20250101
        quantity:
          type: integer
          x-order: '3'
          example: 1000000
        amount:
          description: Amount per unit
          type: number
          x-order: '4'
          example: 1000000
        name:
          type: string
          maxLength: 255
          x-order: '5'
          example: Item Name
  securitySchemes:
    ApiKeyAuth:
      description: API Key for authentication
      type: apiKey
      name: X-API-Key
      in: header

````