# Customer IDs

The 2Checkout system creates Customer IDs by default for all subscriptions it generates.

## Unique customer IDs

Customers purchasing products/subscriptions sold through the 2Checkout platform can be assigned a unique customer IDs that you control in addition to the unique 2Checkout customer IDs created and assigned automatically.

External Customer IDs and 2Checkout Customer IDs are complementary.

Customer IDs can be:

* Unique alphanumeric ID (string) defined per-customer.
* Unique numerical (integer) ID generated by the 2Checkout system automatically.

## Create external customer ID

When changing the **Customer billing details** of an account, you also have the option of providing the external customer ID if none exists.

You can enter any unique alphanumeric ID (string) as long as it's not already used as the external identifier of an existing Customer, in which case you'll receive the following error message: "**The External ID you entered is used by another customer account. Please enter a new External ID and try again."**

## Edit external customer ID

When changing the **Customer billing details** of an account, you also have the option of editing an existing external customer ID.

External references can be swapped for any unique alphanumeric ID (string) you wish as long as an existing customer account in the 2Checkout system isn't already using the same identifier.

## Import customer IDs

When importing subscriptions, the 2Checkout system automatically generates subscriptions to match the data in the CSV file used for the importing process.

The existing importing functionality of the 2Checkout system was expanded to support external customer IDs. In this regard, you can specify an `ExternalCustomerId` for each of the subscriptions that you import.

<table><thead><tr><th width="185">Optional Fields</th><th width="446">Description</th><th width="109">Required</th></tr></thead><tbody><tr><td><code>ExternalCustomerId</code></td><td>The identifier for the same customer using one or more subscriptions. <code>ExternalCustomerId</code> is stored into the 2Checkout system and can subsequently be used for management tasks impacting Customers.</td><td>NO</td></tr></tbody></table>

### Importing a new subscription

Specify the desired `ExternalCustomerId` in the column of the CSV file when importing a new subscription to have the 2Checkout system create a new Customer Account with the identifier for that specific subscription.

### Edit customer IDs

Use the subscription import functionality offered by the 2Checkout platform in order to edit customer IDs.

Specify a new `ExternalCustomerId` in the column of the CSV file when importing an existing subscription to have the 2Checkout system update the associated Customer account, replacing the old ID with the new identifier.

## Customer IDs in LCNs and IPNs

**AVANGATE\_CUSTOMER\_REFERENCE** - Default customer numerical (integer) IDs generated automatically by the 2Checkout system.

**EXTERNAL\_CUSTOMER\_REFERENCE** - Unique customer alphanumeric (string) identifiers that you control.

The 2Checkout system creates the Avangate Customer ID (AVANGATE\_CUSTOMER\_REFERENCE) by default for successfully placed orders that include products generating subscriptions. AVANGATE\_CUSTOMER\_REFERENCE is always included in both IPN and LCN.

Unique customer identifiers (EXTERNAL\_CUSTOMER\_REFERENCE) that you control are only included in LCN and IPN provided that you set them up via:

* The Buy Link using the CUSTOMERID parameter
* Orders placed using the 2Checkout API&#x20;

In scenarios in which you don't provide a unique customer identifier, EXTERNAL\_CUSTOMER\_REFERENCE will be empty in both IPN and LCN when they're first sent out.

Adding a unique customer identifier after the order was finalized won't trigger the LCN on its own. However, the next time that the LCN is generated for updates impacting the license directly, the notification will also include the EXTERNAL\_CUSTOMER\_REFERENCE you added. The same behavior applies to scenarios in which you move a subscription under a specific customer.

## Buy-link Customer ID Parameter

### External customer ID in buy-links

Create new Customer accounts for subscriptions generated when shoppers purchase your products. You can use the **CUSTOMERID** **(case sensitive) parameter** to set external identifiers in the buy links of the products purchased by your customers.

{% hint style="info" %}
Products need to have the renewal system enabled and a subscription generated as a part of the purchasing process for Customer accounts to be created or updated accordingly.
{% endhint %}

Add the CUSTOMERID parameter to a buy link generated using the [Sales Links](https://secure.avangate.com/cpanel/integration.php) area of the Control Panel. For example, the following link:

```
https://secure.2checkout.com/order/checkout.php?PRODS=1234567
```

should be changed to

```
https://secure.2checkout.com/order/checkout.php?PRODS=1234567&CUSTOMERID=999999a
```

If the no existing Customer Accounts feature the **999999a** identifier, then a new Customer Account will be created using the external reference you specified.

### Attribute a subscription to an existing customer

Aggregate subscriptions under the same Customer account if the products they're associated with are purchased by the same shopper by taking advantage of the `CUSTOMERID` **(case sensitive) parameter** added to buy links.

You can use and existing external customer ID for a Customer account already generated in the 2Checkout system to place new orders.

Let's assume that a customer account with the **999999a** `CUSTOMERID` (external customer reference) was already created for one of your shoppers for a previous order. When the same shopper places a new order using the 2Checkout platform, the subscriptions generated will automatically be grouped under the same Customer account provided that the purchase is done using a buy link which features **\&CUSTOMERID=999999a.**

For example, the following link:

```
https://secure.2checkout.com/order/checkout.php?PRODS=1234999
```

should be changed to

```
https://secure.2checkout.com/order/checkout.php?PRODS=1234999&CUSTOMERID=999999a
```

to ensure that any new subscriptions generated will be aggregated under the existing Customer accounts with the **999999a** identifier.

### Place orders using the Avangate Customer Reference (ID) AV\_CUSTOMERID

The 2Checkout system generates default customer numerical (integer) IDs automatically for all orders containing products that feature subscriptions. Once created, **Avangate customer references** can be used for new acquisitions aggregating new subscriptions under an existing Customer account.

{% hint style="info" %}
**Avangate customer references** are spawned automatically by the 2Checkout system. While you're able to use them to place new orders for existing customers, you can't set your own **Avangate customer references**. However, you can create and edit **External customer references** according to your needs. External Customer IDs and Avangate Customer IDs can coexist.
{% endhint %}

Existing system-generated IDs can serve to group new subscriptions under already created Customer accounts, by using the `AV_CUSTOMERID` (case sensitive) parameter in the Buy Links for orders.

Assume that a Customer account with the 123456789 `AV_CUSTOMERID` (internal Avangate customer reference) was already created for one of your shoppers for a previous order. When the same shopper places a new order using the 2Checkout platform, the subscriptions generated will automatically be grouped under the same Customer account provided that the purchase is done using a buy link which features \&AV\_CUSTOMERID=123456789. All subscriptions generated as a result of this order will automatically be grouped under the customer featuring the 123456789 system generated ID.

{% hint style="info" %}
`AV_CUSTOMERID` can only be used for new acquisitions made by existing customers, which have already had an internal Avangate customer reference attributed to them.
{% endhint %}

If parameters for both an Avangate Customer ID and an External Customer ID are used in the Buy Link for the same order, the internal Avangate customer reference will take precedence over the external identifier (that will be ignored by the system. )

| Customer reference scenarios                                                                                  |                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>Avangate Customer ID</p><p></p><p>(internal, system-generated customer reference)</p><p></p><p>is used</p> | <p>External Customer ID</p><p></p><p>(external customer reference) is used</p>                                                                                                                                                                              | **Result**                                                                                                                                                                                                                         |
| <p><strong>NO</strong></p><p>(new order without <code>AV\_CUSTOMERID</code> in the Buy Link)</p>              | <p><strong>NO</strong></p><p>(new order without <code>CUSTOMERID</code> in the Buy Link)</p>                                                                                                                                                                | <p>New customer account is generated using the order billing details.</p><p>New Avangate customer reference is also created for the account.</p>                                                                                   |
| <p><strong>NO</strong></p><p>(new order without <code>AV\_CUSTOMERID</code> in the Buy Link)</p>              | <p><strong>YES</strong></p><p>(new order with <code>CUSTOMERID</code> in the Buy Link)</p>                                                                                                                                                                  | <p>New customer account is generated using the order billing details.</p><p>New Avangate customer reference is also created for the account.</p><p>The customer account will feature the External customer reference provided.</p> |
| <p><strong>YES</strong></p><p>(new order with <code>AV\_CUSTOMERID</code> in the Buy Link)</p>                | <p><strong>YES</strong></p><p>(new order with <code>CUSTOMERID</code> in the Buy Link, but identifier is either new or different than the one featured by the customer account for which the <strong>Avangate customer reference</strong> was provided)</p> | Subscriptions generated are automatically assigned to the customer account featuring the **Avangate customer reference** provided in the Buy Link.                                                                                 |
| <p><strong>YES</strong></p><p>(new order with <code>AV\_CUSTOMERID</code> in the Buy Link)</p>                | <p><strong>NO</strong></p><p>(new order without <code>CUSTOMERID</code> in the Buy Link)</p>                                                                                                                                                                | Subscriptions generated are automatically assigned to the customer account featuring the **Avangate customer reference** provided in the Buy Link.                                                                                 |
| <p><strong>YES</strong></p><p>(new order with <code>AV\_CUSTOMERID</code> in the Buy Link)</p>                | <p><strong>YES</strong></p><p>(new order with <code>CUSTOMERID</code> in the Buy Link, and the identifiers is the same as the one featured by the customer account for which the <strong>Avangate customer reference</strong> was provided)</p>             | Subscriptions generated are automatically assigned to the customer account featuring the **Avangate customer reference** provided in the Buy Link.                                                                                 |
| <p><strong>NO</strong></p><p>(new order without <code>AV\_CUSTOMERID</code> in the Buy Link)</p>              | <p><strong>YES</strong></p><p>(new order with <code>CUSTOMERID</code> in the Buy Link, and the identifiers used is an External customer reference for and existing customer account)</p>                                                                    | Subscriptions generated are automatically assigned to the customer account featuring the **External customer reference** provided in the Buy Link.                                                                                 |

### Network Cross-selling

The Customer ID used in the buy link is limited to the customers of the vendor which owns the shopping cart. Subscriptions from third-party 2Checkout vendors will not be associated with the same customer ID as that of the main vendor.


---

# 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/subscriptions/subscriptions/subscriber-management-and-self-service/customer-ids.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.
