Skip to content

Fields Update

Endpoint: https://api.youcan.shop/settings/checkout/fields/

Method: PUT

Required Scopes

  • edit-checkout-fields

Note

By using this PUT method, the current checkout fields would be overriden by the given ones.

Parameters

Inside the data wrapper, array of field object with the following parameters:

Param NameParam TypeDescriptionRequired
custombooleanCustom field or noyes
namestringField nameyes if not custom field
display_namestringField display nameno
placeholderstringField placeholderno
typestringField type (text, textarea, password, select, number, hidden)yes if custom field
optionsarrayField optionsyes if type select
requiredbooleanField requiredyes
enabledbooleanField enabled on checkoutyes

Payload example

json
{
    "data": [
        {
            "custom": false,
            "name": "first_name",
            "display_name": "First name",
            "type": "text",
            "options": [],
            "required": true,
            "enabled": true
        },
        {
            "custom": false,
            "name": "last_name",
            "display_name": "Last name",
            "type": "text",
            "options": [],
            "required": true,
            "enabled": false
        },
        {
            "custom": false,
            "name": "email",
            "display_name": "Email",
            "type": "text",
            "options": [],
            "required": true,
            "enabled": false
        },
        {
            "custom": false,
            "name": "phone",
            "display_name": "Phone",
            "type": "text",
            "options": [],
            "required": true,
            "enabled": false
        },
        {
            "custom": false,
            "name": "phone_or_email",
            "display_name": "Phone or email",
            "type": "text",
            "options": [],
            "required": true,
            "enabled": false
        },
        {
            "custom": false,
            "name": "company",
            "display_name": "Company",
            "type": "text",
            "options": [],
            "required": true,
            "enabled": false
        },
        {
            "custom": false,
            "name": "country",
            "display_name": "Country",
            "type": "text",
            "options": [],
            "required": true,
            "enabled": false
        },
        {
            "custom": false,
            "name": "region",
            "display_name": "Region",
            "type": "text",
            "options": [],
            "required": true,
            "enabled": false
        },
        {
            "custom": false,
            "name": "city",
            "display_name": "City",
            "type": "text",
            "options": [],
            "required": true,
            "enabled": false
        },
        {
            "custom": false,
            "name": "password",
            "display_name": "Password",
            "type": "password",
            "options": [],
            "required": true,
            "enabled": true
        },
        {
            "custom": true,
            "display_name": "Middle Name",
            "placeholder": "Middle Name",
            "type": "text",
            "required": true,
            "enabled": true
        },
        {
            "custom": true,
            "display_name": "State",
            "placeholder": "Choose you State",
            "type": "select",
            "options": ["LA", "NY"],
            "required": true,
            "enabled": true
        }
    ]
}

Response

[422] Unprocessable Entity

json
{
    "status": 422,
    "detail": "The data.0.custom field is required.",
    "meta": {
        "data.0.custom": [
            "The data.0.custom field is required."
        ]
    }
}

[200] Updated

json
{
    "status": 200,
    "detail": "Checkout fields successfully updated",
    "meta": []
}