openapi: 3.1.1
info:
  title: Order
  version: 2.0.0
  description: Schema definition for Order in the Beckn Protocol
  license:
    name: CC-BY-NC-SA 4.0 International
  contact:
    name: Beckn Labs
    url: https://beckn.io
components:
  schemas:
    Order:
      x-iri: https://schema.nfh.global/Order/v2.0
      description: Schema definition for Order in the Beckn Protocol
      title: Order
      type: object
      properties:
        beckn:id:
          type: string
          x-jsonld:
            '@id': schema:identifier
        beckn:orderStatus:
          type: string
          description: Order status/state
          enum:
          - CREATED
          - PENDING
          - CONFIRMED
          - INPROGRESS
          - PARTIALLYFULFILLED
          - COMPLETED
          - CANCELLED
          - REJECTED
          - FAILED
          - RETURNED
          - REFUNDED
          - ONHOLD
          x-jsonld:
            '@id': beckn:orderStatus
        beckn:orderNumber:
          type: string
          description: Human-visible order number
          x-jsonld:
            '@id': schema:orderNumber
        beckn:seller:
          $ref: https://schema.nfh.global/Provider/v2.1/attributes.yaml#/components/schemas/Provider
          x-jsonld:
            '@id': schema:seller
        beckn:buyer:
          $ref: https://schema.nfh.global/Buyer/v2.0/attributes.yaml#/components/schemas/Buyer
          x-jsonld:
            '@id': schema:customer
        beckn:orderItems:
          type: array
          minItems: 1
          items:
            $ref: https://schema.nfh.global/OrderItem/v2.0/attributes.yaml#/components/schemas/OrderItem
          x-jsonld:
            '@id': schema:orderItem
        beckn:acceptedOffers:
          type: array
          items:
            $ref: https://schema.nfh.global/Offer/v2.1/attributes.yaml#/components/schemas/Offer
          description: Offers accepted at order-level (optional if captured per line)
          x-jsonld:
            '@id': schema:acceptedOffer
        beckn:orderValue:
          $ref: https://schema.nfh.global/PriceSpecification/v2.1/attributes.yaml#/components/schemas/PriceSpecification
          description: Order totals snapshot (derivable from lines; optional)
          x-jsonld:
            '@id': schema:priceSpecification
        beckn:invoice:
          $ref: https://schema.nfh.global/Invoice/v2.1/attributes.yaml#/components/schemas/Invoice
          description: Invoice reference/summary
          x-jsonld:
            '@id': schema:Invoice
        beckn:payment:
          $ref: https://schema.nfh.global/Payment/v2.0/attributes.yaml#/components/schemas/Payment
          description: Method/status; rail-specific payloads go to packs
          x-jsonld:
            '@id': schema:PaymentMethod|schema:PaymentStatusType
        beckn:fulfillment:
          $ref: https://schema.nfh.global/Fulfillment/v2.1/attributes.yaml#/components/schemas/Fulfillment
          description: Parcel delivery or reservation summary
          x-jsonld:
            '@id': schema:ParcelDelivery|schema:Reservation
        beckn:orderAttributes:
          $ref: https://schema.nfh.global/Attributes/v2.0/attributes.yaml#/components/schemas/Attributes
          description: Order-level Attribute Pack (vertical/regulatory specifics)
      required:
      - beckn:orderStatus
      - beckn:seller
      - beckn:buyer
      - beckn:orderItems
      additionalProperties: false
