# Integrate the KYC tier system for the Embedded Components onramp

Learn about KYC verification tiers, the information required for each, and how to detect when a customer's purchase amount is limited by their verification level.

All customers must pass KYC verification before they can buy crypto with the onramp. Customers can provide additional information to increase their purchase limits. This guide covers the KYC tiers, the information required for each tier, and how you can detect when a customer’s purchase amount is limited by the amount of KYC information provided. For reference integration flows, screen overviews, and step-up detection patterns, see [KYC integration best practices](https://docs.stripe.com/crypto/onramp/kyc-integration-best-practices.md).

> EU customers have additional identifier and attestation requirements beyond the standard KYC tiers. See the [EU KYC integration guide](https://docs.stripe.com/crypto/onramp/eu-kyc-integration-guide.md) for details.

## Before you begin

Before you begin, [integrate the Embedded Components Onramp](https://docs.stripe.com/crypto/onramp/embedded-components-integration-guide.md).

## KYC tier comparison

The following table summarizes the requirements for each KYC tier.

| KYC tier | Customer inputs |
| --- | --- |
| L0 | Name, phone, email, address |
| L1 | + Date of birth, SSN |
| L2 | + Photo ID, selfie |

## KYC API

### Use attachKYCInfo for L0 and L1 KYC

Call `attachKYCInfo` to initiate the L0 and L1 KYC verification processes for a customer.

The fields collected by `attachKYCInfo` depend on the tier:

- **L0**: `firstName`, `lastName`, `address`
- **L1**: All L0 fields, plus `dateOfBirth`, `idNumber`, `idType`

For iOS, Android, and React Native integrations, you can collect Apple Pay or Google Pay before Link authentication and use the returned name and address for L0 KYC. Use the wallet’s email and phone for Link registration, then submit `firstName`, `lastName`, and `address` with `attachKYCInfo` (`attachKycInfo` on Android and React Native). Email and phone aren’t submitted through the KYC API. See [Use Platform Pay with L0 KYC](https://docs.stripe.com/crypto/onramp/kyc-integration-best-practices.md#platform-pay-l0) for the integration sequence and missing-data handling.

L0 and L1 verification are asynchronous. Call this API and check the verification status before you create an onramp session. [Creating a CryptoOnrampSession](https://docs.stripe.com/api/crypto/onramp_sessions/create.md) returns a `400` error if the customer has pending verifications. Continue retrieving the verification result until no verification remains pending. See [Determine whether a customer is verified](https://docs.stripe.com/crypto/onramp/kyc-integration-guide.md#determine-whether-a-customer-is-verified) for details.

### Use verifyIdentity for L2 KYC

Call `verifyIdentity` (`verifyDocuments` on the web) to present a Stripe-hosted flow where the customer uploads an identity document and a selfie.

L2 verification is asynchronous. Your back end must call the [Retrieve a CryptoCustomer](https://docs.stripe.com/api/crypto/customers/retrieve.md) API with the `customerId` and inspect the `kyc_tiers` entry with `tier: "l2"`. Completing the SDK flow submits documents. Wait until L2 `verification_status` is `verified` before continuing.

L2 can also recover an eligible US customer who fails L1 person verification. See [Offer L2 after an L1 failure](https://docs.stripe.com/crypto/onramp/kyc-integration-guide.md#l2-fallback).

### Handling KYC error for createCryptoPaymentToken

You can collect a Platform Pay payment method before registration, authentication, or KYC submission. Before creating a payment token, complete registration or authentication and submit the customer’s minimum identity information (name, phone, email, and address). If `createCryptoPaymentToken` returns `crypto_onramp_missing_minimum_identity_verification`, collect any missing registration details and submit the name and address using `attachKYCInfo`. Collecting a payment method doesn’t verify the customer or complete a purchase.

A customer’s L0 tier verification status is independent of their ability to use the onramp. If a customer submits the minimum identity information but fails L0 verification, they can still use the onramp by completing L1 verification (date of birth and SSN). L1 verification supersedes L0.

### Determining a customer’s current KYC tier

[Retrieve a CryptoCustomer](https://docs.stripe.com/api/crypto/customers/retrieve.md) with the `customerId` and inspect the `kyc_tiers` field to determine a customer’s current KYC tier. The customer’s current tier is the highest tier where `verification_status` isn’t `not_available` or `not_started`.

The `verification_status` values for each tier are:

| Value | Description |
| --- | --- |
| `not_available` | Verification isn’t supported for the customer’s region. |
| `not_started` | The customer hasn’t provided the required fields for this tier yet. |
| `pending` | Verification has been submitted and is processing. |
| `rejected` | Verification failed. |
| `verified` | Verification completed successfully. |

For example, given the following `kyc_tiers` response:

```json
"kyc_tiers": [
  { "tier": "l0", "verification_status": "verified", "verification_errors": [] },
  { "tier": "l1", "verification_status": "verified", "verification_errors": [] },
  { "tier": "l2", "verification_status": "not_started", "verification_errors": [] }
]
```

The customer’s current tier is L1 because it is the highest tier that isn’t `not_available` or `not_started`.

After [Retrieving a CryptoCustomer](https://docs.stripe.com/api/crypto/customers/retrieve.md), use the following snippet to determine the customer’s current KYC tier from the `kyc_tiers` field in the response:

```js
// Iterates from the highest tier (l2) to the lowest (l0) and returns the first tier
// whose verification_status is "pending", "rejected", or "verified" (meaning the customer
// has at least attempted that tier). Returns undefined if no tier has been started.
const currentTier = ["l2", "l1", "l0"].find((t) => ["pending", "rejected", "verified"].includes(customer.kyc_tiers.find((k) => k.tier === t)?.verification_status));
```

You can also use the `provided_fields` field to determine a customer’s tier:

| Customer | Provided fields |
| --- | --- |
| L0 | `first_name`, `last_name`, `address_line_1`, (`address_line_2`), `address_city`, `address_state`, `address_postal_code`, `address_country` |
| L1 | All L0 fields, plus `id_number`, `id_type`, `dob` |
| L2 | All L1 fields, plus `id_document`, `selfie` |

### Determine whether a customer is verified

After retrieving the customer’s current KYC tier, check whether the tier entry for that tier has `verification_status: "verified"`. If so, the customer is verified at that tier.

The following table summarizes how to use the `kyc_tiers` field to check verification status:

| Customer | Verified |
| --- | --- |
| L0 | The `kyc_tiers` entry with `tier: "l0"` has `verification_status: "verified"` |
| L1 | The `kyc_tiers` entry with `tier: "l1"` has `verification_status: "verified"` |
| L2 | The `kyc_tiers` entry with `tier: "l2"` has `verification_status: "verified"` |

### Offer L2 after an L1 failure 

For eligible US customers, L2 document and selfie verification can replace failed L1 person verification.

A customer can use this fallback after three failed L1 verification attempts in total, provided their address validation passed. Explicitly resubmitting full, unchanged KYC information after a completed L1 failure also consumes an attempt. Polling a verification result doesn’t consume an attempt. Address validation failures can’t be recovered through document verification.

[Retrieve a CryptoCustomer](https://docs.stripe.com/api/crypto/customers/retrieve.md) and inspect the L1 entry in `kyc_tiers`. After the initial person verification failures, it has:

- `verification_status: "rejected"`.
- `person_verification_failed` and `user_has_reached_max_verification_attempts` in its `verification_errors` array.
- No `address_validation_failed` error.

For example, this response shows an exhausted L1 person check with document verification not yet started:

```json
{
  "kyc_tiers": [
    {
      "tier": "l1",
      "verification_status": "rejected",
      "verification_errors": [
        "person_verification_failed",
        "user_has_reached_max_verification_attempts"
      ]
    },
    {
      "tier": "l2",
      "verification_status": "not_started",
      "verification_errors": []
    }
  ]
}
```

A `rejected` L1 status alone doesn’t establish fallback eligibility. Invalid required KYC data can also cause rejection without a corresponding code in `verification_errors`. Correct missing or invalid data before continuing.

For a live US integration with valid KYC data and passed address validation, the following example selects document collection:

```javascript
function shouldCollectFallbackDocuments(customer, {livemode}) {
  if (customer.kyc_tiers?.some((tier) => tier.verification_status === 'pending')) {
    return false;
  }

  const l1 = customer.kyc_tiers?.find((tier) => tier.tier === 'l1');
  const l2 = customer.kyc_tiers?.find((tier) => tier.tier === 'l2');
  const maxAttempts = 'user_has_reached_max_verification_attempts';

  if (l2?.verification_errors?.includes(maxAttempts)) return false;

  return Boolean(
    livemode &&
    customer.kyc_region === 'us' &&
    l1?.verification_status === 'rejected' &&
    l1.verification_errors?.includes(maxAttempts) &&
    !l1.verification_errors?.includes('address_validation_failed') &&
    (l2?.verification_status === 'not_started' ||
      (l2?.verification_status === 'rejected' &&
        l2.verification_errors?.includes('id_document_verification_failed')))
  );
}
```

Before starting document collection, wait for any pending tier verification to finish. Handle the result with the latest tier statuses:

1. If document collection is available, call `verifyIdentity` (`verifyDocuments` on the web). Stop asking the customer to resubmit their SSN after the L1 attempt limit.
2. If L2 is `pending`, keep waiting. If L2 is `verified`, continue without collecting documents again, even if L1 remains `rejected`.
3. If L2 is `rejected` with `id_document_verification_failed`, offer another document attempt unless L2 also reports `user_has_reached_max_verification_attempts`. At that limit, stop offering document retries.
4. If address validation failed or required data is invalid, don’t treat document verification as recovery for failed L1 verification.
5. After L2 is verified and no verification remains pending, refresh the customer’s transaction limits and retry the intended session. Successful fallback doesn’t guarantee that the requested purchase amount is permitted.

### Interpret limit errors from CryptoOnrampSession

Your back end must [Create a CryptoOnrampSession](https://docs.stripe.com/api/crypto/onramp_sessions/create.md) to create a [CryptoOnrampSession](https://docs.stripe.com/api/crypto/onramp_sessions/object.md). If the customer reaches a purchase limit, the `Create a CryptoOnrampSession` API returns an HTTP `400` error with a JSON object that describes the error. Your application can use these errors to request more information from the customer so they can complete the transaction.

If creating a CryptoOnrampSession returns an HTTP `400` error with one of the following error codes, [Retrieve a CryptoCustomer](https://docs.stripe.com/api/crypto/customers/retrieve.md) with the `customerId` to determine the next step.

- `crypto_onramp_missing_minimum_identity_verification`
- `crypto_onramp_missing_identity_verification`
- `crypto_onramp_missing_document_verification`

The following table summarizes how to use both the error code from [Creating a CryptoOnrampSession](https://docs.stripe.com/api/crypto/onramp_sessions/create.md) and the `kyc_tiers` field from [Retrieving a CryptoCustomer](https://docs.stripe.com/api/crypto/customers/retrieve.md) to determine the next step.

| Error code | Meaning | Next step |
| --- | --- | --- |
| `crypto_onramp_missing_minimum_identity_verification` | The customer hasn’t yet submitted the minimum identity information required to create a session. The customer needs to provide their name, phone, email, and address. | Prompt the customer to submit their minimum identity information (name, phone, email, and address) using `attachKYCInfo`. If the customer subsequently fails L0 tier verification, they can still use the onramp by completing L1 verification (date of birth and SSN), which supersedes L0. |
| `crypto_onramp_missing_identity_verification` | L1 verification is required. The customer must provide full or partial L1 data to complete the transaction:
- The customer is at L1 and didn’t pass the L1 identity verification required to create a session.
- The customer is a verified L0 customer but the transaction requires L1 verification. | Inspect [Retrieve a CryptoCustomer](https://docs.stripe.com/api/crypto/customers/retrieve.md) API response `kyc_tiers` to determine the next step.
- If L1 is rejected, check [L2 fallback eligibility](https://docs.stripe.com/crypto/onramp/kyc-integration-guide.md#l2-fallback) before requesting another L1 submission. Offer document verification for eligible customers. Otherwise, let the customer correct L1 information only while attempts remain.
- If the customer’s current tier is L0, prompt the customer to provide only `dob`, `id_number`, `id_type`, then upload partially with `attachKYCInfo` (only include these three fields). |
| `crypto_onramp_missing_document_verification` | L2 verification is required. The customer must provide a photo ID and selfie to complete the transaction:
- The customer is at L2 and didn’t pass the L2 document identity verification required to create a session.
- The customer is a verified L0 customer but the transaction requires L2 verification.
- The customer is a verified L1 customer but the transaction requires L2 verification.
- Risk rules require the customer to complete an [identity challenge](https://docs.stripe.com/crypto/onramp/embedded-components-integration-guide.md#handle-identity-challenges), even though the transaction amount is within the limit for their current tier. | Inspect [Retrieve a CryptoCustomer](https://docs.stripe.com/api/crypto/customers/retrieve.md) API response `kyc_tiers` to determine the next step.
- If the customer’s current tier is L2, inspect its status and errors before calling `verifyIdentity`. Wait for pending verification and stop retries when L2 reports `user_has_reached_max_verification_attempts`.
- If the customer’s current tier is L0, prompt the customer to collect only `dob`, `id_number`, `id_type`, upload partially with `attachKYCInfo`, then prompt the customer to complete L2 KYC verification with `verifyIdentity`.
- If L1 is verified or the customer is [eligible for L2 fallback](https://docs.stripe.com/crypto/onramp/kyc-integration-guide.md#l2-fallback), prompt them to complete L2 verification with `verifyIdentity`. Don’t treat this session error alone as proof of fallback eligibility. |
