diff --git a/KlaviyoV3Sdk/KlaviyoV3Api.php b/KlaviyoV3Sdk/KlaviyoV3Api.php index a1e0b47..f22b727 100644 --- a/KlaviyoV3Sdk/KlaviyoV3Api.php +++ b/KlaviyoV3Sdk/KlaviyoV3Api.php @@ -432,8 +432,7 @@ public function buildCustomerProperties($customerProperties) $data = array( self::TYPE_KEY_PAYLOAD => self::PROFILE_KEY_PAYLOAD, - self::ATTRIBUTE_KEY_PAYLOAD => $kl_properties, - self::PROPERTIES => $customerProperties, + self::ATTRIBUTE_KEY_PAYLOAD => $kl_properties ); if (isset($customerProperties['$id'])) { @@ -441,6 +440,10 @@ public function buildCustomerProperties($customerProperties) unset($customerProperties['$id']); } + if(!empty($customerProperties)) { + $data[self::ATTRIBUTE_KEY_PAYLOAD][self::PROPERTIES] = $customerProperties; + } + return array( self::PROFILE_KEY_PAYLOAD => array( self::DATA_KEY_PAYLOAD => $data