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

# Update a checkout field

> **Scope:** [`write_checkout_form`](/scopes)

Changes the field's label (`name`), `placeholder`, `position`, and
whether it shows (`is_active`) and is required (`is_required`). Only
the fields you send change; `null` is refused. `key` and `type`
cannot change: sending them answers `400`.

`full_name` and `phone` are needed by every order: they stay shown
and required. Setting `is_active` or `is_required` to `false` on them
answers `422` with the rule `always_required`.

The storefront's checkout shows the change at once.




## OpenAPI

````yaml /openapi.json patch /checkout-fields/{id}
openapi: 3.1.0
info:
  title: EasyOrders Admin API
  version: v1
  summary: Read and write a merchant's store data from your app.
  description: |
    The EasyOrders Admin API lets an installed app work with one merchant's
    store: its orders, shipping settings and shipping areas, within the
    scopes the merchant approved.

    - Every request needs an access token (`Authorization: Bearer eo_at_...`)
      from the OAuth flow. A token works on one store only.
    - Request and response bodies are JSON. Unknown fields and query
      parameters are refused.
    - Errors share one shape: `{"error": {"code", "message", "details"}}`.
    - `v1` is stable: new fields and endpoints are added to it; a breaking
      change ships as a new version.
  contact:
    name: EasyOrders developers
    url: https://easyorders.eg
servers:
  - url: https://api.easy-orders.net/api/partners-apps/v1
    description: Production
security:
  - accessToken: []
tags:
  - name: Article categories
    description: >-
      The categories of the store's blog, which articles name in their
      `category_ids`.
  - name: Articles
    description: The articles of the store's blog, with HTML content, tags and categories.
  - name: Billing
    description: >-
      Your app's plan subscription and usage wallet on the store, and debiting
      the wallet by usage.
  - name: Categories
    description: The store's product categories and subcategories.
  - name: Checkout fields
    description: >-
      The fields of the store's checkout form, their labels, order, and whether
      they show and are required.
  - name: Coupons
    description: >-
      The store's coupons, by code or automatic, and the products, variants and
      categories they apply to.
  - name: Labels
    description: >-
      Your app's short colored words on orders and products, shown in the
      merchant's orders and products tables.
  - name: Missed orders
    description: >-
      Checkouts the shopper started and did not finish, to follow up and
      recover.
  - name: Orders
    description: The store's orders, their status, payment status and notes.
  - name: Pages
    description: >-
      The store's pages, such as About us or the return policy, with HTML
      content.
  - name: Products
    description: The store's products, their options, variants and stock.
  - name: Reviews
    description: >-
      The reviews of the store's products, and which of them the product page
      shows.
  - name: Shipping
    description: The store's shipping settings and shipping areas (governorates).
  - name: Store
    description: >-
      The store the access token belongs to, its addresses, currency, language
      and plan.
paths:
  /checkout-fields/{id}:
    parameters:
      - $ref: '#/components/parameters/CheckoutFieldID'
    patch:
      tags:
        - Checkout fields
      summary: Update a checkout field
      description: |
        **Scope:** [`write_checkout_form`](/scopes)

        Changes the field's label (`name`), `placeholder`, `position`, and
        whether it shows (`is_active`) and is required (`is_required`). Only
        the fields you send change; `null` is refused. `key` and `type`
        cannot change: sending them answers `400`.

        `full_name` and `phone` are needed by every order: they stay shown
        and required. Setting `is_active` or `is_required` to `false` on them
        answers `422` with the rule `always_required`.

        The storefront's checkout shows the change at once.
      operationId: updateCheckoutField
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckoutFieldUpdate'
            example:
              name: Mobile number
              placeholder: 01xxxxxxxxx
              position: 1
      responses:
        '200':
          $ref: '#/components/responses/CheckoutFieldOK'
        '400':
          $ref: '#/components/responses/InvalidRequest'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/InsufficientScope'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          description: >-
            `validation_failed`: a rule below, or `always_required` for hiding
            or making optional `full_name` or `phone`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: validation_failed
                  message: Validation failed
                  details:
                    fields:
                      - field: is_required
                        rule: always_required
                        param: phone
        '429':
          $ref: '#/components/responses/RateLimited'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: >-
            curl -X PATCH
            "https://api.easy-orders.net/api/partners-apps/v1/checkout-fields/6c2f8d3b-0e4a-4b7f-9c6d-2a3b4c5d6e70"
            \
              -H "Authorization: Bearer $EASYORDERS_ACCESS_TOKEN" \
              -H "Content-Type: application/json" \
              -d '{
              "name": "Mobile number",
              "placeholder": "01xxxxxxxxx",
              "position": 1
            }'
        - lang: typescript
          label: TypeScript
          source: >-
            const response = await
            fetch('https://api.easy-orders.net/api/partners-apps/v1/checkout-fields/6c2f8d3b-0e4a-4b7f-9c6d-2a3b4c5d6e70',
            {
              method: 'PATCH',
              headers: {
                Authorization: `Bearer ${process.env.EASYORDERS_ACCESS_TOKEN}`,
                'Content-Type': 'application/json',
              },
              body: JSON.stringify({
                name: 'Mobile number',
                placeholder: '01xxxxxxxxx',
                position: 1,
              }),
            })


            const json = await response.json()

            if (!response.ok) {
              throw new Error(`${json.error.code}: ${json.error.message}`)
            }

            const { checkout_field } = json
        - lang: go
          label: Go
          source: "package main\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"os\"\n)\n\nfunc main() {\n\tbody := []byte(`{\n\t  \"name\": \"Mobile number\",\n\t  \"placeholder\": \"01xxxxxxxxx\",\n\t  \"position\": 1\n\t}`)\n\n\treq, err := http.NewRequest(\"PATCH\", \"https://api.easy-orders.net/api/partners-apps/v1/checkout-fields/6c2f8d3b-0e4a-4b7f-9c6d-2a3b4c5d6e70\", bytes.NewReader(body))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treq.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"EASYORDERS_ACCESS_TOKEN\"))\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer res.Body.Close()\n\n\tvar answer map[string]any\n\tif err := json.NewDecoder(res.Body).Decode(&answer); err != nil {\n\t\tpanic(err)\n\t}\n\tif res.StatusCode >= 300 {\n\t\tpanic(fmt.Sprint(res.Status, answer[\"error\"]))\n\t}\n\tfmt.Println(answer[\"checkout_field\"])\n}"
        - lang: php
          label: PHP
          source: >-
            <?php


            $ch =
            curl_init('https://api.easy-orders.net/api/partners-apps/v1/checkout-fields/6c2f8d3b-0e4a-4b7f-9c6d-2a3b4c5d6e70');

            curl_setopt_array($ch, [
                CURLOPT_CUSTOMREQUEST => 'PATCH',
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_HTTPHEADER => [
                    'Authorization: Bearer ' . getenv('EASYORDERS_ACCESS_TOKEN'),
                    'Content-Type: application/json',
                ],
                CURLOPT_POSTFIELDS => json_encode([
                    'name' => 'Mobile number',
                    'placeholder' => '01xxxxxxxxx',
                    'position' => 1,
                ]),
            ]);


            $answer = json_decode(curl_exec($ch), true);

            $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);

            curl_close($ch);


            if ($status >= 300) {
                throw new RuntimeException($answer['error']['code'] . ': ' . $answer['error']['message']);
            }

            $checkoutField = $answer['checkout_field'];
        - lang: python
          label: Python
          source: |-
            import os

            import requests

            response = requests.patch(
                "https://api.easy-orders.net/api/partners-apps/v1/checkout-fields/6c2f8d3b-0e4a-4b7f-9c6d-2a3b4c5d6e70",
                headers={
                    "Authorization": f"Bearer {os.environ['EASYORDERS_ACCESS_TOKEN']}",
                },
                json={
                    "name": "Mobile number",
                    "placeholder": "01xxxxxxxxx",
                    "position": 1,
                },
                timeout=30,
            )
            answer = response.json()
            if not response.ok:
                raise RuntimeError(f"{answer['error']['code']}: {answer['error']['message']}")
            checkout_field = answer["checkout_field"]
components:
  parameters:
    CheckoutFieldID:
      name: id
      in: path
      required: true
      description: The checkout field's ID.
      schema:
        type: string
        format: uuid
      example: 6c2f8d3b-0e4a-4b7f-9c6d-2a3b4c5d6e70
  schemas:
    CheckoutFieldUpdate:
      type: object
      additionalProperties: false
      description: Every field is optional; only the fields sent change.
      properties:
        name:
          $ref: '#/components/schemas/CheckoutFieldName'
        placeholder:
          $ref: '#/components/schemas/CheckoutFieldPlaceholder'
        position:
          $ref: '#/components/schemas/CheckoutFieldPosition'
        is_active:
          type: boolean
          description: '`false` is refused for `full_name` and `phone` (`always_required`).'
        is_required:
          type: boolean
          description: '`false` is refused for `full_name` and `phone` (`always_required`).'
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: A stable, snake_case code. Branch on it, not on the message.
            message:
              type: string
              description: A human-readable explanation. It may change.
            details:
              description: More about the error, shaped per code.
    CheckoutFieldName:
      type: string
      minLength: 1
      maxLength: 255
      description: >-
        The label. One line, trimmed, with a visible character, no invisible
        characters and no `<`.
    CheckoutFieldPlaceholder:
      type: string
      maxLength: 255
      description: One line, trimmed, no invisible characters and no `<`. `""` removes it.
    CheckoutFieldPosition:
      type: integer
      minimum: 0
      maximum: 1000
      description: The place in the form, lowest first.
    CheckoutField:
      type: object
      properties:
        id:
          type: string
          format: uuid
        key:
          type: string
          description: |
            Which order field it fills, e.g. `full_name`, `phone`, `email`,
            `country`, `government`, `address`, or the optional `phone_alt`,
            `note` and `sa_national_address`. Read only.
        name:
          type: string
          description: The label the shopper sees.
        type:
          type: string
          enum:
            - input
            - textarea
          description: '`input` is one line, `textarea` several. Read only.'
        placeholder:
          type: string
          description: The hint shown in the empty field; `""` for none.
        position:
          type: integer
          description: >-
            The field's place in the form, lowest first. Fields with the same
            position are ordered by `key`.
        is_active:
          type: boolean
          description: >-
            Whether the form shows the field. Always `true` for `full_name` and
            `phone`.
        is_required:
          type: boolean
          description: >-
            Whether the shopper must fill it. Always `true` for `full_name` and
            `phone`.
  responses:
    CheckoutFieldOK:
      description: The checkout field.
      content:
        application/json:
          schema:
            type: object
            required:
              - checkout_field
            properties:
              checkout_field:
                $ref: '#/components/schemas/CheckoutField'
          example:
            checkout_field:
              id: 6c2f8d3b-0e4a-4b7f-9c6d-2a3b4c5d6e70
              key: phone
              name: Mobile number
              type: input
              placeholder: 01xxxxxxxxx
              position: 1
              is_active: true
              is_required: true
    InvalidRequest:
      description: >-
        The body is not a JSON object, or has a field of the wrong type or an
        unknown field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: invalid_request
              message: 'Invalid JSON body: unknown field'
    Unauthenticated:
      description: The access token is missing, invalid or expired.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: unauthenticated
              message: Missing or invalid access token
    PaymentRequired:
      description: Your app's subscription on this store is suspended.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: payment_required
              message: The app's subscription on this store is suspended
    InsufficientScope:
      description: The token lacks the scope this endpoint needs.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: insufficient_scope
              message: 'This request requires the scope: read_orders'
              details:
                required_scope: read_orders
    NotFound:
      description: No such resource in this store.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: not_found
              message: Resource not found
    RateLimited:
      description: More than 600 requests in a minute from your app on this store.
      headers:
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: too_many_requests
              message: Rate limit exceeded
  headers:
    Retry-After:
      description: Seconds to wait before retrying.
      schema:
        type: integer
  securitySchemes:
    accessToken:
      type: http
      scheme: bearer
      description: >
        An access token from the OAuth flow (`eo_at_...`). It lasts one hour;

        refresh it with the refresh token. See
        [Authentication](/authentication).

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.