> ## 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.

# Flutter - Webview

> Embed a card checkout for tokens or NFTs into a Flutter app

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

> [!NOTE]
>
> For this quickstart, you will create a minimal Flutter app. Make sure you have&#x20;
>
> [Flutter installed](https://docs.flutter.dev/install)
>
> .

## Create a New Flutter Project + Crossmint SDK

**1. Create a new Flutter app**

```bash theme={null}
flutter create crossmint_checkout_quickstart

cd crossmint_checkout_quickstart
```

**2. Install crossmint\_flutter**

<Snippet file="client-sdk-flutter-installation-cmd.mdx" />

**3. Set your environment variables**

Pass your API key and configuration via Dart defines:

```bash theme={null}
flutter run \
  --dart-define=CROSSMINT_API_KEY=YOUR_CLIENT_SIDE_API_KEY \
  --dart-define=RECIPIENT_WALLET=YOUR_SOLANA_WALLET_ADDRESS \
  --dart-define=RECEIPT_EMAIL=YOUR_EMAIL@example.com
```

> [!NOTE]
>
> The `receiptEmail` field is **optional**. If the buyer pays with Apple Pay or Google Pay, Crossmint obtains the email automatically. Providing it improves fraud signal quality.

**4. Replace lib/main.dart with**

```dart theme={null}
import 'package:flutter/material.dart';
import 'package:crossmint_flutter/crossmint_flutter_ui.dart';

const apiKey = String.fromEnvironment('CROSSMINT_API_KEY');
const recipientWallet = String.fromEnvironment('RECIPIENT_WALLET');
const receiptEmail = String.fromEnvironment('RECEIPT_EMAIL');

void main() {
  runApp(const MaterialApp(home: CheckoutScreen()));
}

class CheckoutScreen extends StatelessWidget {
  const CheckoutScreen({super.key});

  @override
  Widget build(BuildContext context) {
    final checkoutController = CrossmintCheckoutController();

    return Scaffold(
      body: SafeArea(
        child: CrossmintEmbeddedCheckout(
          apiKey: apiKey,
          config: CrossmintCheckoutConfig(
            order: CrossmintCheckoutNewOrder.typed(
              lineItems: [
                CrossmintCheckoutLineItem.tokenWithExecutionParameters(
                  tokenLocator:
                      'solana:7EivYFyNfgGj8xbUymR7J4LuxUHLKRzpLaERHLvi7Dgu', // XMEME token (staging)
                  executionParameters: {
                    'mode': 'exact-in',
                    'amount': '1',
                    'maxSlippageBps': '500',
                  },
                ),
              ],
              recipient: CrossmintCheckoutWalletRecipient(
                walletAddress: recipientWallet,
              ),
            ),
            payment: CrossmintCheckoutPayment(
              fiat: CrossmintCheckoutFiatPayment(enabled: true),
              crypto: CrossmintCheckoutCryptoPayment(enabled: false),
              receiptEmail: receiptEmail,
            ),
          ),
          checkoutController: checkoutController,
          onOrderUpdated: (order) =>
              debugPrint('Order updated: ${order['status']}'),
          onOrderCreationFailed: (error) =>
              debugPrint('Error: $error'),
        ),
      ),
    );
  }
}
```

**5. Run your project**

Run with the same `--dart-define` flags from step 3:

```bash iOS theme={null}
flutter run -d ios \
  --dart-define=CROSSMINT_API_KEY=YOUR_CLIENT_SIDE_API_KEY \
  --dart-define=RECIPIENT_WALLET=YOUR_SOLANA_WALLET_ADDRESS \
  --dart-define=RECEIPT_EMAIL=YOUR_EMAIL@example.com
```

```bash Android theme={null}
flutter run -d android \
  --dart-define=CROSSMINT_API_KEY=YOUR_CLIENT_SIDE_API_KEY \
  --dart-define=RECIPIENT_WALLET=YOUR_SOLANA_WALLET_ADDRESS \
  --dart-define=RECEIPT_EMAIL=YOUR_EMAIL@example.com
```

```bash Chrome theme={null}
flutter run -d chrome \
  --dart-define=CROSSMINT_API_KEY=YOUR_CLIENT_SIDE_API_KEY \
  --dart-define=RECIPIENT_WALLET=YOUR_SOLANA_WALLET_ADDRESS \
  --dart-define=RECEIPT_EMAIL=YOUR_EMAIL@example.com
```

## Testing Your App

Test purchases in staging using test credit cards, like `4242424242424242` (Visa). More information on testing can be found [here](https://docs.crossmint.com/checkout/advanced/testing-tips.md#test-credit-card-numbers). This demo is built on staging — to launch on production, check the [production checklist](https://docs.crossmint.com/checkout/guides/production-checklist.md).

## Next Steps

> [card] [Mobile WebView Integration](https://docs.crossmint.com/checkout/embedded/guides/webview-integration.md)
>
> Render the checkout in your own WebView without the SDK

> [card] [Flutter SDK Reference](https://docs.crossmint.com/sdk-reference/checkout/flutter/get-started.md)
>
> Full API reference for the Flutter SDK
