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

# Swift

> Allow your iOS users to buy stablecoins with credit cards and Apple Pay

<Note>
  The Swift SDK is currently in **Beta**.
</Note>

In this guide, you'll learn how to:

* Install the Swift SDK
* Create an Onramp order for your authenticated users
* Use the embedded checkout component to handle KYC, payment, and delivery

<Frame type="simple" caption="Native iOS onramp with Apple Pay support">
  <img src="https://mintcdn.com/crossmint/O4OyJtPpVdTUXAHB/images/payments/embedded-v3/quickstart/onramp.png?fit=max&auto=format&n=O4OyJtPpVdTUXAHB&q=85&s=5aabaa680b80628ae36af70e98ea95e4" alt="Crossmint Onramp Embedded Checkout Demo" width="1734" height="1220" data-path="images/payments/embedded-v3/quickstart/onramp.png" />
</Frame>

<CardGroup cols={2}>
  <Snippet file="before-you-start.mdx" />

  <Card title="Swift SDK on GitHub" icon="github" iconType="duotone" href="https://github.com/Crossmint/crossmint-checkout-swift">
    View the open source Swift Checkout SDK repository.
  </Card>
</CardGroup>

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

## Requirements

* **iOS 14.0+**
* **SwiftUI** framework
* Xcode 13.0 or later

## 1. Installation

Install the Crossmint Swift SDK using Swift Package Manager.

<Steps>
  <Step title="Add Package Dependency">
    In Xcode, go to **File > Add Package Dependencies** and add:

    ```
    https://github.com/Crossmint/crossmint-checkout-swift
    ```

    Select the `CrossmintCheckout` product for your target.
  </Step>

  <Step title="Create API key">
    Create a [server-side API key](https://docs.crossmint.com/introduction/platform/api-keys/server-side) with the
    `orders.create` and `orders.read` scopes enabled. In staging, all scopes are included in your API key.
  </Step>
</Steps>

## 2. Create Order

<Note>
  If you want to enable onramp orders to external wallets (EOAs or third-party smart wallets) instead of Crossmint wallets, see the [Onramp to External Wallets](/onramp/guides/onramp-to-external-wallets) guide before proceeding.
</Note>

Use the [Create Order API](/api-reference/headless/create-order) to initiate the purchase process from your backend.

<Snippet file="onramp-create-order.mdx" />

## 3. Use Component

Once you have the order response with `orderId` and `clientSecret`, use Crossmint's embedded checkout component in your SwiftUI view.

The component supports **native Apple Pay** for a seamless iOS payment experience.

```swift theme={null}
import SwiftUI
import CrossmintCheckout

struct ContentView: View {
    var body: some View {
        CrossmintEmbeddedCheckout(
            orderId: <your_order_id>,
            clientSecret: <your_client_secret>,
            payment: CheckoutPayment(
                crypto: CheckoutCryptoPayment(enabled: false),
                fiat: CheckoutFiatPayment(
                    enabled: true,
                    allowedMethods: CheckoutAllowedMethods(
                        googlePay: false,
                        applePay: true,  // Native Apple Pay support
                        card: true
                    )
                )
            ),
            appearance: CheckoutAppearance(
                rules: CheckoutAppearanceRules(
                    destinationInput: CheckoutDestinationInputRule(display: "hidden"),
                    receiptEmailInput: CheckoutReceiptEmailInputRule(display: "hidden")
                )
            )
        )
    }
}
```

### Key Features

* **Native Apple Pay**: Smooth integration with iOS payment system
* **SwiftUI Components**: Modern declarative UI framework
* **Automatic KYC**: Handles verification flow automatically
* **Customizable Appearance**: Control visibility of UI elements

## 4. Track Order

<Snippet file="onramp-track-order.mdx" />

## 5. Transaction Completion

<Snippet file="onramp-transaction-completion.mdx" />

## 6. Next Steps

<Snippet file="onramp-next-steps.mdx" />

* View the <a href="https://github.com/Crossmint/crossmint-checkout-swift" target="_blank" rel="noopener noreferrer">Swift Checkout SDK source code</a> on GitHub
