# Retrieve cross-sell campaign by code

Use the **getCrossSellCampaign** method to extract information about the cross-sell campaign identified by the provided campaign code.

## Request parameters

<table><thead><tr><th width="142.5333251953125">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><code>CampaignCode</code></td><td><strong>Required (string)</strong><br>The campaign code.</td></tr></tbody></table>

### Request sample

```php
<?php
declare(strict_types=1);

// Start clear CLI
echo chr(27).chr(91).'H'.chr(27).chr(91).'J';
// End clear CLI

$executionStartTime = microtime(true);

$apiVersion = '6.0';
$apiHost = "http://api.avangate.local";

$host = $apiHost."/soap/" . $apiVersion . "/";

$client = new SoapClient(
    $host."?wsdl",
    [\
    'location' => $host,\
    'trace' => 1,\
    'cache_wsdl' => WSDL_CACHE_NONE\
    ]
);
$client->__setCookie('XDEBUG_SESSION', 'PHPSTORM');

// Please be aware to consider valid data
$merchantCode = 'your_merchant_code';
$key = 'your_merchant_key';

// Generate hash for login
$date = gmdate('Y-m-d H:i:s');
$string = strlen($merchantCode) . $merchantCode . strlen($date) . $date;
$hash = hash_hmac('md5', $string, $key);

try {
    $sessionID = $client->login($merchantCode, $date, $hash);
} catch (SoapFault $e) {
    echo  $e->getMessage();
}

var_dump("Generated sessionID: ". $sessionID);
echo "\n\r";

$crossSellCampaignCode = '2Xrl83J0k+qOr3W1ceTwZnHHr30=';
try {
    $result = $client->getCrossSellCampaign($sessionID, $crossSellCampaignCode);
    echo "\n\rGET CROSS SELL CAMPAIGNS: \n\r";
    print_r(json_encode($result, JSON_PRETTY_PRINT));

} catch (SoapFault $e) {
    echo $e->getMessage();
}

$executionEndTime = microtime(true);

// The duration will be displayed in seconds and milliseconds.
$seconds = round($executionEndTime - $executionStartTime, 2);

// Print it out
echo "\n\rThis script took $seconds to execute.\n\r";
```

## Response parameters

<table><thead><tr><th width="178.800048828125">Parameter</th><th>Type</th></tr></thead><tbody><tr><td><a href="/pages/5e0d36c8e13100c7f6e2380d1f76e8be890120f5"><code>CrossSellCampaign</code></a></td><td><strong>Object</strong></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/cross-sell/retrieve-cross-sell-campaign-by-code.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.
