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 Name | Param Type | Description | Required |
---|---|---|---|
custom | boolean | Custom field or no | yes |
name | string | Field name | yes if not custom field |
display_name | string | Field display name | no |
placeholder | string | Field placeholder | no |
type | string | Field type (text, textarea, password, select, number, hidden) | yes if custom field |
options | array | Field options | yes if type select |
required | boolean | Field required | yes |
enabled | boolean | Field enabled on checkout | yes |
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": []
}