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

# Order Received

> Retrieve order details for the thank you page after checkout completion

<Warning>
  This endpoint is currently shown as a preview of what's currently in development and is subject to change.
</Warning>


## OpenAPI

````yaml api-reference/pre-release/openapi-spec-preview.yaml get /order-received/{order_id}
openapi: 3.0.3
info:
  title: CoCart Preview API
  description: >
    CoCart Preview provides enhanced REST API endpoints for WooCommerce headless
    e-commerce solutions.

    This API extends CoCart with additional functionality for checkout, customer
    account management, and order handling.


    ## Authentication


    The API supports multiple authentication methods:

    - **Cart Key**: For guest customers, pass the cart key via `Cart-Key` header
    or `cart_key` parameter

    - **Basic Auth**: For registered customers using username/password

    - **JWT**: For registered customers using JWT tokens (requires JWT plugin)

    - **Session**: For logged-in WordPress users


    ## Base URL


    All API endpoints are prefixed with `/wp-json/cocart/preview/`


    ## Response Format


    All responses follow the CoCart standard format with consistent error
    handling and data structure.
  termsOfService: http://cocartapi.com/terms-of-conditions-polar/
  contact:
    email: support@cocartapi.com
  license:
    name: GNU General Public License v3.0
    url: http://www.gnu.org/licenses/gpl-3.0.html
  version: 0.0.1
servers:
  - url: '{protocol}://{host}/wp-json/cocart/preview'
    description: API Preview
    variables:
      protocol:
        enum:
          - http
          - https
        default: https
      host:
        default: example-store.com
        description: Your store domain
security: []
tags:
  - name: Checkout
    description: Complete checkout process including payment and order creation
  - name: My Account
    description: Customer account information and profile management
  - name: My Orders
    description: Customer order history and details
  - name: My Downloads
    description: Customer digital downloads
  - name: My Subscriptions
    description: Customer subscription management
externalDocs:
  description: Find out more about CoCart API
  url: https://docs.cocartapi.com
paths:
  /order-received/{order_id}:
    get:
      tags:
        - Checkout
      summary: Get order received details
      description: Retrieve order details for the thank you page after checkout completion
      operationId: getOrderReceived
      parameters:
        - name: order_id
          in: path
          description: Unique identifier for the order
          required: true
          schema:
            type: integer
        - name: order_key
          in: query
          description: Order key for verification
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Order received details retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderReceivedData'
              examples:
                orderReceived:
                  $ref: '#/components/examples/OrderReceivedExample'
        '400':
          description: Bad request - missing order ID or order key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - invalid order key or no permission
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Order not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - cartKey: []
        - basicAuth: []
        - bearerAuth: []
components:
  schemas:
    OrderReceivedData:
      type: object
      properties:
        order_id:
          type: integer
          description: Order ID
        order_number:
          type: string
          description: Order number
        order_key:
          type: string
          description: Order key
        status:
          type: string
          description: Order status
        status_name:
          type: string
          description: Human-readable order status
        date_created:
          type: string
          description: Order creation date
        date_paid:
          type: string
          nullable: true
          description: Order payment date
        currency:
          type: string
          description: Order currency
        total:
          type: string
          description: Order total
        subtotal:
          type: string
          description: Order subtotal
        tax_total:
          type: string
          description: Tax total
        shipping_total:
          type: string
          description: Shipping total
        discount_total:
          type: string
          description: Discount total
        payment_method:
          type: string
          description: Payment method ID
        payment_method_title:
          type: string
          description: Payment method title
        customer_id:
          type: integer
          description: Customer ID
        customer_note:
          type: string
          description: Customer note
        billing_address:
          $ref: '#/components/schemas/BillingAddress'
        shipping_address:
          $ref: '#/components/schemas/ShippingAddress'
        items:
          type: array
          items:
            $ref: '#/components/schemas/OrderItem'
        totals:
          type: array
          items:
            type: object
            properties:
              key:
                type: string
              label:
                type: string
              value:
                type: string
        needs_payment:
          type: boolean
          description: Whether order requires payment
        needs_shipping:
          type: boolean
          description: Whether order needs shipping
        has_downloads:
          type: boolean
          description: Whether order has downloadable items
        download_url:
          type: string
          format: uri
          nullable: true
          description: URL to download items
        available_payment_methods:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              title:
                type: string
              description:
                type: string
              has_fields:
                type: boolean
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Error code identifier
        message:
          type: string
          description: Human-readable error message
        data:
          type: object
          description: Additional error data
          properties:
            status:
              type: integer
              description: HTTP status code
    BillingAddress:
      type: object
      properties:
        first_name:
          type: string
          description: First name
        last_name:
          type: string
          description: Last name
        company:
          type: string
          description: Company name
        address_1:
          type: string
          description: Address line 1
        address_2:
          type: string
          description: Address line 2
        city:
          type: string
          description: City name
        state:
          type: string
          description: State/County
        postcode:
          type: string
          description: Postal code
        country:
          type: string
          description: Country code
        phone:
          type: string
          description: Phone number
        email:
          type: string
          format: email
          description: Email address
    ShippingAddress:
      type: object
      properties:
        first_name:
          type: string
          description: First name
        last_name:
          type: string
          description: Last name
        company:
          type: string
          description: Company name
        address_1:
          type: string
          description: Address line 1
        address_2:
          type: string
          description: Address line 2
        city:
          type: string
          description: City name
        state:
          type: string
          description: State/County
        postcode:
          type: string
          description: Postal code
        country:
          type: string
          description: Country code
    OrderItem:
      type: object
      properties:
        item_id:
          type: integer
          description: Item ID
        product_id:
          type: integer
          description: Product ID
        variation_id:
          oneOf:
            - type: integer
            - type: string
          description: >-
            Variation ID (integer for existing variations, string for deleted
            variations)
        product_image:
          type: string
          format: uri
          description: Product image URL
        product_name:
          type: string
          description: Product name
        product_title:
          type: string
          description: Product title
        product_type:
          type: string
          description: Product type
        sku:
          type: string
          description: Product SKU
        quantity:
          type: string
          description: Item quantity
        subtotal:
          type: string
          description: Item subtotal
        purchase_note:
          type: string
          description: Purchase note
        refunded_qty:
          type: string
          description: Refunded quantity
        meta:
          type: object
          description: Item metadata
        link:
          type: string
          format: uri
          description: Link to product
  examples:
    OrderReceivedExample:
      value:
        order_id: 789
        order_number: '789'
        order_key: wc_order_abc123xyz
        status: processing
        status_name: Processing
        date_created: December 15, 2024, 2:20 pm
        date_paid: December 15, 2024, 2:21 pm
        currency: USD
        total: '44.98'
        subtotal: '39.98'
        tax_total: '0.00'
        shipping_total: '5.00'
        discount_total: '0.00'
        payment_method: stripe
        payment_method_title: Credit Card (Stripe)
        customer_id: 123
        customer_note: Please leave at the door
        billing_address:
          first_name: John
          last_name: Doe
          email: john@example.com
          phone: '+1234567890'
          address_1: 123 Main St
          address_2: Apt 4B
          city: Anytown
          state: CA
          postcode: '12345'
          country: US
          company: ''
        shipping_address:
          first_name: John
          last_name: Doe
          address_1: 123 Main St
          address_2: Apt 4B
          city: Anytown
          state: CA
          postcode: '12345'
          country: US
          company: ''
        items:
          - item_id: 1
            product_id: 456
            variation_id: 0
            product_name: Premium T-Shirt
            product_image: https://example.com/wp-content/uploads/product.jpg
            quantity: 2
            subtotal: '39.98'
            total: '39.98'
            meta_data: []
        totals:
          - key: subtotal
            label: Subtotal
            value: $39.98
          - key: shipping
            label: Shipping
            value: $5.00
          - key: total
            label: Total
            value: $44.98
        needs_payment: false
        needs_shipping: true
        has_downloads: false
        download_url: null
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: WordPress username and password
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer authentication with JWT token
      bearerFormat: JWT

````