Upsert customer custom attribute
Creates or updates a custom attribute for a customer profile.
Use this endpoint to set the value of a custom attribute for a specified customer profile. A custom attribute is based on a custom attribute definition in a Square seller account, which is created using the CreateCustomerCustomAttributeDefinition endpoint.
To create or update a custom attribute owned by another application, the visibility
setting
must be VISIBILITY_READ_WRITE_VALUES
. Note that seller-defined custom attributes
(also known as custom fields) are always set to VISIBILITY_READ_WRITE_VALUES
.
Name | Description |
---|---|
customer_
Required
|
The ID of the target customer profile. |
key
Required
|
The key of the custom attribute to create or update. This key must match the |
Name | Description |
---|---|
custom_
Required
|
The custom attribute to create or update, with the following fields:
|
idempotency_
|
A unique identifier for this request, used to ensure idempotency. For more information, see Idempotency. |
Response Fields
Name | Description |
---|---|
custom_
|
The new or updated custom attribute. |
errors
|
Any errors that occurred during the request. |
Examples
- cURL
- Ruby
- Python
- C#
- Java
- PHP
- Node.js
curl https://connect.squareup.com/v2/customers/Z57QXKM2FGXEQDV42W8RBZY7BR/custom-attributes/favoritemovie \
-X POST \
-H 'Square-Version: 2023-01-19' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"custom_attribute": {
"value": "Dune"
}
}'
{
"custom_attribute": {
"key": "favoritemovie",
"version": 1,
"updated_at": "2022-04-26T15:50:27Z",
"value": "Dune",
"created_at": "2022-04-26T15:50:27Z",
"visibility": "VISIBILITY_READ_ONLY"
}
}