> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crossmint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Checking Supported Tokens

> Learn how to check if a memecoin or token is supported by Crossmint Checkout

<Snippet file="enterprise-feature.mdx" />

## Introduction

Before integrating a memecoin or token using Crossmint's checkout, it's important to verify that it's supported by Crossmint. This guide will show you how to use the Crossmint API to check if a specific token is supported and what features are available for it.

## Prerequisites

**1. Create a server-side API key**

Get your API keys from the [Crossmint Console](https://www.crossmint.com/console/projects/apiKeys)

<Snippet file="create-api-key.mdx" />

[More info on creating API keys here](https://docs.crossmint.com/introduction/platform/api-keys#how-to-get-and-use-api-keys)

**2. Enable the orders.create scope**

Make sure the `orders.create` scope is enabled for your API key.

## Getting Started

The Supported Tokens API allows you to query the status of any token to determine if it's supported by Crossmint and what features are available.

* **Endpoint**: `https://www.crossmint.com/api/v1-alpha2/tokens/:tokenLocator`
* **Method**: GET
* **Authentication**: Requires either a server or client API key

### Token Locator Format

Memecoin checkout supports the **Solana** and **Base** networks.

The token locator follows this format:

```
network:tokenAddress
```

Example:

* **Staging**: Use the XMEME test token: `solana:7EivYFyNfgGj8xbUymR7J4LuxUHLKRzpLaERHLvi7Dgu`
* **Production**: Use any supported token, e.g. TRUMP: `solana:6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN`

> [!NOTE]
>
> Production memecoin tokens **will not work** in the **staging** environment.

## Checking Token Support

### Using JavaScript

Here's how to check if a token is supported using JavaScript:

```javascript theme={null}
// Example usage
const apiKey = "your-api-key"; // Replace with your actual API key
const tokenLocator = "solana:6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN"; // Example: TRUMP token

const checkTokenSupport = async (apiKey, tokenLocator) => {
    try {
        const response = await fetch(`https://www.crossmint.com/api/v1-alpha2/tokens/${tokenLocator}`, {
            method: "GET",
            headers: {
                "x-api-key": apiKey,
                "Content-Type": "application/json",
            },
        });

        const data = await response.json();
        return data;
    } catch (error) {
        console.error("Error checking token support:", error);
        throw error;
    }
};

checkTokenSupport(apiKey, tokenLocator)
    .then((result) => {
        console.log("Token support details:", result);

        if (result.available) {
            console.log("This token is supported by Crossmint!");
        } else {
            console.log("This token is not currently supported.");
        }

        console.log("Available features:", result.features);
    })
    .catch((err) => {
        console.error("Failed to check token support:", err);
    });
```

### Sample Response

A successful response will look similar to this:

```json theme={null}
{
    "token": "solana:6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN",
    "available": true,
    "features": {
        "creditCardPayment": true
    }
}
```

## Integrating with Your Checkout Flow

Once you've confirmed that a token is supported, you can use the information from the API response to customize your checkout experience.

### Example: Pre-checkout Validation

Here's an example of how to incorporate token support checking before initiating a checkout:

```javascript theme={null}
const initiateCheckout = async (apiKey, tokenLocator, amount, recipientWallet) => {
    // First, check if the token is supported
    const tokenSupport = await checkTokenSupport(apiKey, tokenLocator);

    if (!tokenSupport.available) {
        throw new Error("This token is not currently supported by Crossmint.");
    }

    if (!tokenSupport.features.creditCardPayment) {
        throw new Error("Credit card payment is not available for this token.");
    }

    // If we get here, the token is supported with credit card checkout
    // Proceed with creating an order
    const orderResponse = await fetch("https://www.crossmint.com/api/2022-06-09/orders", {
        method: "POST",
        headers: {
            "x-api-key": apiKey,
            "Content-Type": "application/json",
        },
        body: JSON.stringify({
            lineItems: [
                {
                    tokenLocator: tokenLocator,
                    executionParameters: {
                        mode: "exact-in",
                        amount: amount,
                        maxSlippageBps: "500",
                    },
                },
            ],
            payment: {
                method: "card",
                receiptEmail: "user@example.com", // Replace with user's email
            },
            recipient: {
                walletAddress: recipientWallet,
            },
        }),
    });

    return await orderResponse.json();
};
```

## Best Practices

1. **Cache Results (with caution)**: Token support status can change, but for frequently accessed tokens, consider caching results for a short period (e.g., 1 hour) to reduce API calls.

2. **Handle Errors Gracefully**: Implement proper error handling to provide clear feedback to users when a token is not supported.

3. **Check Before Displaying Options**: Only display payment methods that are actually available for the token.

## Next Steps

> [card] [Credit Card Memecoin Checkout](https://docs.crossmint.com/checkout/headless/quickstarts/credit-card.md)
>
> Now that you can check token support, learn how to implement a credit card checkout for memecoins

> [card] [Order Lifecycle](https://docs.crossmint.com/checkout/concepts/how-checkout-works.md)
>
> Understand the lifecycle of orders in Crossmint's checkout flow

## FAQ

> [accordion] Can I request support for a specific token?
>
> Yes, if you'd like to request support for a token that is currently unsupported, contact our [support team](https://help.crossmint.com).

> [accordion] What happens if I try to process a transaction for an unsupported token?
>
> Transactions for unsupported tokens will fail. This is why it's crucial to check token support before initiating
> a checkout process.

> [accordion] Are all payment methods available for all supported tokens?
>
> No, each token may have different available payment features. The API response includes a `features` object that
> specifies which payment methods are available for each token.

> [accordion] Is there a limit to how many tokens I can check?
>
> The API is rate-limited to 50 requests per second. For most applications, this should be more than sufficient.
