# Update customer

Use the **updateCustomerInformation** method to update the details of a customer entity from the 2Checkout system.

## Request parameters

<table><thead><tr><th width="262">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>sessionID</code></td><td><strong>Required (string)</strong><br>Session identifier, the output of the <strong>Login</strong> method. Include <code>sessionID</code> into all your requests. 2Checkout throws an exception if the values are incorrect. The <code>sessionID</code> expires in <strong>10 minutes</strong>.</td></tr><tr><td><a href="/pages/l51iTomfeHH2OmdQbRlz"><code>Customer</code></a></td><td><strong>Object (required)</strong><br>Use this object to update customer information.</td></tr><tr><td><code>UpdateEndUserSubscriptions</code></td><td><strong>Optional (boolean)</strong><br>You can push the changes made on the customer info to the end-user details for all subscriptions belonging to this customer. Set <strong>true</strong> to have the changes reflected on the end-user details for all subscriptions. If <strong>null</strong> or <strong>false</strong>, the changes are made only at the customer level. Default value is false.</td></tr></tbody></table>

### Request sample

```php
<?php
$host   = "https://api.2checkout.com";
$client = new SoapClient($host . "/soap/4.0/?wsdl", array(
    'location' => $host . "/soap/4.0/",
    "stream_context" => stream_context_create(array(
        'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false
        )
    ))
));

function hmac($key, $data)
{
    $b = 64; // byte length for md5
    if (strlen($key) > $b) {
        $key = pack("H*", md5($key));
    }
    
    $key    = str_pad($key, $b, chr(0x00));
    $ipad   = str_pad('', $b, chr(0x36));
    $opad   = str_pad('', $b, chr(0x5c));
    $k_ipad = $key ^ $ipad;
    $k_opad = $key ^ $opad;
    return md5($k_opad . pack("H*", md5($k_ipad . $data)));
}

$merchantCode = "YOUR_MERCHANT_CODE";
$key = "YOUR_SECRET_KEY";
$now = gmdate('Y-m-d H:i:s');
$string = strlen($merchantCode) . $merchantCode . strlen($now) . $now;
$hash   = hmac($key, $string);

try {
    $sessionID = $client->login($merchantCode, $now, $hash);
} catch (SoapFault $e) {
    echo "Authentication: " . $e->getMessage();
    exit;
}

$customerReference = 298084139;
$externalCustomerReference = 'Apitest123456';

try {
    $customerInfo = $client->getCustomerInformation($sessionID, $customerReference, $externalCustomerReference);
} catch (SoapFault $e) {
    echo "customerInfo: " . $e->getMessage();
    exit;
}

$customerInfo->Email = 'newemailaddressupdated@email.com';

// New Credit object (optional)
$customerInfo->Credit = new stdClass();
$customerInfo->Credit->Limit = 51.0;       // float
$customerInfo->Credit->Remaining = 21.0;   // float
$customerInfo->Credit->Currency = 'EUR';   // string

$UpdateEndUserSubscriptions = false;

try {
    $updatedCustomerInfo = $client->updateCustomerInformation($sessionID, $customerInfo, $UpdateEndUserSubscriptions);
} catch (SoapFault $e) {
    echo "updatedCustomerInfo: " . $e->getMessage();
    exit;
}

var_dump("updatedCustomerInfo", $updatedCustomerInfo);
```

## Response parameter

<table><thead><tr><th width="108.39996337890625">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>Boolean</strong></td><td><strong>true</strong> or <strong>false</strong> depending on whether or not the operation succeeded.</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.2checkout.com/soap-api-reference/soap-api-6.0/api-requests/customer/update-customer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
