When I need to add in laravel 10 app user to mailchimp I use addListMember method of https://github.com/mailchimp/mailchimp-marketing-php (v3.0) plugin
$response = $this->getApiClient()->lists->addListMember($this->mailchimpListId, [
"email_address" => $email,
"status" => "subscribed",
'merge_fields' => $userMergeFields,
]);
\Log::info(varDump($response, ' -1 subscribe $response::'));
It returns structure like :
Array
(
[id] => 79847477e940c304958adadc24e52312
[email_address] => [email protected]
[unique_email_id] => 56ed730de7
[contact_id] => 7e4dc0052b2bae88c8c914d34e5170d9
[full_name] => John Doe
[web_id] => 292542436
[email_type] => html
[status] => subscribed
[consents_to_one_to_one_messaging] => 1
[sms_phone_number] =>
[sms_subscription_status] =>
[sms_subscription_last_updated] =>
[merge_fields] => stdClass Object
But when I need to unsubscribe user I use method deleteListMember, but it has 2nd parameter subscriber_hash. I tried to pass value of any of the fields id, unique_email_id, contact_id, web_id values from response above
But in all cases I got 404 error :
The requested resource could not be found
Also I searched and did not find any parameter like subscriber_hash under mailchimp user properties :
Searching in net I found some hints that method subscriberHash of mailchimp can be used- but I did not any similar function in the library by packages.
How can I get this subscriberHash value ?
ATTEMPT TO FIX: I modified my code as
$response = $this->getApiClient()->lists->deleteListMember($email, md5(strtolower($email)));
But anyway I got 404 error :
The requested resource could not be found.
What can be wrong ?

You can check their documentation here: https://mailchimp.com/developer/marketing/docs/methods-parameters/#path-parameters
The
subscriber_hashis the clients email, lowercased and MD5 hashed.So in your Laravel project you can create the hash by doing something like: