Based on the information provided, it seems like you’re doing everything correctly. The UpsertCustomerCustomAttribute API should create the custom attribute for a customer if it doesn’t exist, or update it if it does.
However, it’s important to note that the custom attribute definition must be created first before setting custom attributes for customer profiles. This is done by calling the CreateCustomerCustomAttributeDefinition API. This API defines the properties of the custom attribute, such as its key identifier, visibility setting, allowed data type, and other properties.
Once the custom attribute definition is created, you can then use the UpsertCustomerCustomAttribute API to set the custom attribute for any customer profile in the seller’s Customer Directory.
If you’ve already done this and are still experiencing issues, it might be a problem that needs further investigation.
This answer was reviewed by @Bryan-Square.