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

# Update Order

Use this endpoint to update an existing order in LoyaltyLion, using your
internal (from your ecommerce platform) `merchant_id` to identify the order.

This is a full update and must include the order's current payment, cancellation
and refund status, including any relevant totals if required (`total_paid` and
`total_refunded`).

The update endpoint is idempotent, so it’s safe to call it every time an order
is updated in your system.


## OpenAPI

````yaml /api-reference/v2/openapi.json PUT /v2/orders/{merchant_id}
openapi: 3.1.1
info:
  title: LoyaltyLion Admin API
  version: v2
servers:
  - url: https://api.loyaltylion.com
security: []
tags:
  - name: identity
  - name: activities
  - name: orders
  - name: transactions
  - name: customers
  - name: webhooks
  - name: emails
  - name: sites
  - name: reviews
  - name: rewards
  - name: integrations
  - name: gatsby
paths:
  /v2/orders/{merchant_id}:
    put:
      tags:
        - orders
      operationId: orders.updateOrder
      parameters:
        - name: merchant_id
          in: path
          required: true
          schema:
            type: string
            minLength: 1
      requestBody:
        description: Body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrdersUpdateOrderRequestBody'
      responses:
        '204':
          description: '204'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrdersUpdateOrderResponseBody'
        '400':
          $ref: '#/components/responses/ClientErrorBadRequest'
        '401':
          description: '401'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties:
                          type: string
                    required:
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
        '403':
          description: '403'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties:
                          type: string
                    required:
                      - message
                    additionalProperties: false
                required:
                  - error
                additionalProperties: false
      security:
        - ProgramApiKey:
            - write_orders
        - SiteTokenSecret: []
components:
  schemas:
    OrdersUpdateOrderRequestBody:
      type: object
      properties:
        payment_status:
          type: string
          enum:
            - not_paid
            - partially_paid
            - paid
        refund_status:
          type: string
          enum:
            - not_refunded
            - partially_refunded
            - refunded
        cancellation_status:
          type: string
          enum:
            - cancelled
            - not_cancelled
        total_paid:
          type:
            - string
            - number
          description: >-
            The total amount paid for the order as a decimal string without
            formatting, e.g. `99.99`
          example: '99.99'
        total_refunded:
          type:
            - string
            - number
          description: >-
            The total amount refunded for the order as a decimal string without
            formatting, e.g. `59.99`
          example: '59.99'
        $magento_payload: {}
      required:
        - payment_status
        - refund_status
        - cancellation_status
        - total_paid
        - total_refunded
      additionalProperties: false
    OrdersUpdateOrderResponseBody:
      type: string
      const: ''
  responses:
    ClientErrorBadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  message:
                    type: string
                  details:
                    type: object
                    additionalProperties:
                      type: string
                required:
                  - message
            required:
              - error
  securitySchemes:
    ProgramApiKey:
      type: http
      scheme: bearer
      description: >-
        An API key linked to a Program in LoyaltyLion, with a set of permissions
        (scopes). API keys can be created manually, or acquired through an
        OAuth2 flow. The API key should be provided as a `Bearer` token in the
        `Authorization` header
    SiteTokenSecret:
      type: http
      scheme: basic
      description: >-
        [DEPRECATED] Authenticate using a LoyaltyLion site's `token` as
        username, and its `secret` as the password. This authentication method
        is deprecated and will be removed in future. Use the `ProgramApiKey`
        authentication method instead

````