> ## Documentation Index
> Fetch the complete documentation index at: https://adyen-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate to Client Key

> Learn about how and why to switch to using the client key.

If your Web integration uses the [origin key](https://docs.adyen.com/development-resources/how-to-get-an-origin-key) or your iOS or Android integration uses the client encryption public key, switch to the client key. In future versions the client key will be the only way to do client-side authentication. The client key makes it easier for you to manage the origins for your integration.

With the client key, you have:

* A single key for all your [allowed origins](https://adyen-preview.mintlify.site/development-resources/client-side-authentication#allowed-origins) in an environment.
* Flexibility to add and remove origins without having to generate a new client key.
* A human-readable prefix, **test** or **live**, so you can easily tell which environment a client key is linked to.

The client key also enables card type detection through [Bank Identification Number (BIN)](https://adyen-preview.mintlify.site/get-started-with-adyen/adyen-glossary.md#bank-identification-number-bin) lookup, which is not available when using the origin key.

## Availability and compatibility

The client key is available for the following:

| Online payments integration | Version |
| - | - |
| Web Drop-in and Components | Available for 3.10.1 and later. Previous versions require [origin keys](https://docs.adyen.com/development-resources/how-to-get-an-origin-key) for client-side authentication. Starting 4.0.0 the client key is the only way to do client-side authentication. |
| iOS Drop-in and Components | 3.7.0 and later. Previous versions require client encryption public keys. Starting 4.0.0 the client key is the only way to do client-side authentication. |
| Android Drop-in and Components | 3.7.0 and later. Previous versions require client encryption public keys. Starting 4.0.0 the client key is the only way to do client-side authentication. |

| In-person payments integration | Solutions |
| - | - |
| POS Mobile SDK for iOS | Tap to Pay on iPhone Card reader—iOS |
| POS Mobile SDK for Android | Tap to Pay on Android Card reader—Android |

The client key is backwards compatible with the origin key and the public key. Generating a client key doesn't invalidate a pre-existing origin key or public key.

## Switch to using the client key

To switch to using the client key, you must first generate your client key in your Customer Area:

1. Log in to your [Customer Area](https://ca-test.adyen.com/).

   1. Go to **Developers** > **API credentials**, and select the credential username for your integration, for example **ws\@Company.\[YourCompanyAccount]**.
   2. Under **Client settings** > **Authentication** select the **Client key** tab.
   3. Select **Generate client key**.
   4. Select the copy icon \*\*and store your client key securely in your system.
   5. Under **Add allowed origins**, enter your [domains](https://adyen-preview.mintlify.site/development-resources/client-side-authentication#allowed-origins) and select **Add**.
   6. Select **Save changes**.

Once you have your client key, you need to add it to your integration. Choose your platform:

> [tab] Web
>
> You must be running [Web Drop-in](https://docs.adyen.com/online-payments/drop-in-web) or [Web Components](https://docs.adyen.com/online-payments/components-web/) version 3.10.1 or above.
>
> Replace `originKey` in your Web Drop-in or Web Components configuration object with:
>
> **Web Components**
>
> ```js theme={null}
> const configuration = {
>     ...
>     clientKey: "YOUR_CLIENT_KEY",
>     ...
> }
> ```

> [tab] iOS
>
> You must be running [iOS Drop-in](https://adyen-preview.mintlify.site/online-payments/build-your-integration/sessions-flow.md) or [iOS Components](https://adyen-preview.mintlify.site/online-payments/build-your-integration/sessions-flow.md) version 3.7.0 or above.
>
> 1. Create an instance of `APIContext` with the following parameters:
>
>    | Parameter name | Required | Description |
>    | - | - | - |
>    | `clientKey` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | Your [client key](https://adyen-preview.mintlify.site/development-resources/client-side-authentication). |
>    | `environment` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | Use **test**. When you are ready to accept live payments, change the value to one of our [live environments](https://adyen.github.io/adyen-ios/5.0.0/documentation/adyen/environment/).  |
>
>    **APIContext initialization**
>
>    ```swift theme={null}
>    // When you are ready to go live, change environment to Environment.live
>    // You can also use other environment values described in https://adyen.github.io/adyen-ios/Docs/Structs/Environment.html
>    let apiContext = APIContext(environment: Environment.test, clientKey: clientKey)
>    ```
>
> 2. Use `apiContext` in your iOS Drop-in or iOS Components configuration instead of `publicKey`:
>
>    **iOS Drop-in**
>
>    ```swift theme={null}
>    let configuration = DropInComponent.Configuration(apiContext: apiContext)
>    let component = DropInComponent(paymentMethods: paymentMethods, configuration: configuration)
>    ```
>
>    **iOS Components**
>
>    ```swift theme={null}
>    // Replace CardComponent with the payment method Component that you want to add.
>    let cardComponent = CardComponent(paymentMethod: cardPaymentMethod, apiContext: apiContext)
>    ```

> [tab] Android
>
> You must be running [Android Drop-in](https://adyen-preview.mintlify.site/online-payments/build-your-integration/sessions-flow.md) or [Android Components](https://adyen-preview.mintlify.site/online-payments/build-your-integration/sessions-flow.md) version 3.7.0 or above.
>
> Pass your `clientKey` to your Android Drop-in or Android Components configuration object:
>
> **Android Drop-in**
>
> ```kotlin theme={null}
> val dropInConfiguration = DropInConfiguration.Builder(context, YourDropInService::class.java, "YOUR_CLIENT_KEY")
>    // ...
>    .build()
> ```
>
> **Android Components**
>
> ```kotlin theme={null}
> val cardConfiguration = CardConfiguration.Builder(context, "YOUR_CLIENT_KEY")
>    // ...
>    .build()
> ```
>
> ## See also
>
> * [Client-side authentication](https://adyen-preview.mintlify.site/development-resources/client-side-authentication)
> * [How to get the API key](https://adyen-preview.mintlify.site/development-resources/api-credentials.md)
> * [Web Drop-in](https://docs.adyen.com/online-payments/drop-in-web)
> * [Web Components](https://docs.adyen.com/online-payments/components-web)
> * [iOS Drop-in](https://adyen-preview.mintlify.site/online-payments/build-your-integration/sessions-flow.md)
> * [iOS Components](https://adyen-preview.mintlify.site/online-payments/build-your-integration/sessions-flow.md)
> * [Android Drop-in](https://adyen-preview.mintlify.site/online-payments/build-your-integration/sessions-flow.md)
> * [Android Components](https://adyen-preview.mintlify.site/online-payments/build-your-integration/sessions-flow.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.