# SSO in cart

Use the **getSingleSignOnInCart** method. 2Checkout attaches a unique token to links, designed to identify the returning shoppers and support the automatic extraction of payment data and billing information from the 2Checkout system. For example, you can generate single sign on in cart links for existing customers logged into your website based on their external or 2Checkout customer IDs.

<details>

<summary>How does this work?</summary>

When accessing the shopping cart using tokenized payment links:

* 2Checkout prefills automatically **customer billing and delivery details** associated with their 2Checkout customer accounts (linked based on their unique customer IDs).
* 2Checkout presents shoppers with an optimized payment area featuring the credit / debit cards used to make previous purchases / transactions in the 2Checkout system. Customers have the option of selecting one of the payment methods depending on available card-on-file data.

</details>

## Request parameters

<table><thead><tr><th width="146.800048828125">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>Customer</code></td><td><strong>Required (string)</strong><br>Unique customer identifiers. Can be either the <code>ExternalCustomerReference</code> you control or the system-generated <code>AvangateCustomerReference</code>.</td></tr><tr><td><code>customerType</code></td><td><p><strong>Required (string)</strong><br>Possible values:</p><ul><li><code>ExternalCustomerReference</code></li><li><code>AvangateCustomerReference</code></li></ul></td></tr><tr><td><code>url</code></td><td><strong>Required (string)</strong><br>The shopping cart URL. 2Checkout redirects shoppers to this URL.<br><strong>Possible values:</strong> Any buy link you generate from the cPanel or using the API. <em>Note</em>: For the time being, payment tokenization does not support <strong>Express Payments Checkout</strong> or the <strong>2Checkout mobile shopping cart</strong>.</td></tr><tr><td><code>validityTime</code></td><td><strong>Optional (int)</strong><br>The time, in seconds, before the single sign-on URL expires. By default, the URL expires after 10 seconds. (optional)</td></tr><tr><td><code>validationIp</code></td><td><strong>Optional (string)</strong><br>The IP address of the shopper, necessary for security purposes. Can be an empty string or a valid IP, or null.</td></tr></tbody></table>

### Request sample

```php
<?php

require ('PATH_TO_AUTH');

$idCustomer = '352365983';
$customerType = 'AvangateCustomerReference';
$url = 'https://store.avancart.com/order/checkout.php?PRODS=4639321&QTY=1&CART=1&CARD=2';
$validityTime = 50;
$validationIp = null;

try {
    $ssoLINK = $client->getSingleSignOnInCart($sessionID, $idCustomer, $customerType, $url, $validityTime, $validationIp);
}
catch (SoapFault $e) {
    echo "ssoLINK: " . $e->getMessage();
    exit;
}
var_dump("ssoLINK", $ssoLINK);
```

## Response parameters

<table><thead><tr><th width="187.3333740234375">Parameter</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>Single sign-on URL</code></td><td><p><strong>String</strong><br>The generated string is the tokenized time-limited single sign-on URL pointing to 2Checkout shopping cart.</p><div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>Each SSO link cleans any previous cart sessions. Shoppers using multiple SSO links would purchase only a single product at a time.</p></div><p>If shoppers add multiple products to cart via SSO buy links and then use a <strong>non-SSO link</strong>, they’ll purchase all items using the same order.<br>When you use single sign on in cart for customers without card on files in the 2Checkout system, the generated tokenized link prefills the billing information but the purchase process requires that shoppers provide payment information, such as a credit or debit card.<br>Example: https://store.YourCustomDomain.com/order/checkout.php?PRODS=1112233&#x26;logintoken=8b74ac97f8277654563c44da6915b054ba0d21be</p><div data-gb-custom-block data-tag="hint" data-style="warning" class="hint hint-warning"><p>You can use the value of the <strong>logintoken</strong> to retrieve <strong>customer information</strong> by <strong>SSO token</strong>.</p></div></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/single-sign-on-sso/sso-in-cart.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.
