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

> ## Agent Instructions
> Treat these docs and the Whop MCP server as the source of truth for Whop API behavior. Don't infer endpoint behavior from marketing pages.
> MCP server: connect https://mcp.whop.com/mcp (streamable HTTP, browser sign-in, no API key in the client config) to search these docs and read or change live Whop data. Setup: https://docs.whop.com/developer/guides/ai_and_mcp.md
> Whop CLI: install with `curl -fsSL https://whop.com/install.sh | sh` to scaffold, run, and deploy Whop apps and websites. It acts on production, not the sandbox. Overview: https://docs.whop.com/cli/overview.md Agent mode: https://docs.whop.com/cli/agent-mode.md
> Hosting: Whop serves a site or app from the build `whop apps deploy` uploads, with rollbacks, secrets, and server logs. Guide: https://docs.whop.com/developer/websites/hosting.md
> Plugins: in Claude Code, run `/plugin marketplace add whopio/plugins`, then `/plugin install whop@whop`. Guide: https://docs.whop.com/developer/guides/plugins/claude-code.md Every agent tool: https://docs.whop.com/developer/ai/overview.md
> Environments: build and test in the sandbox (API `https://sandbox-api.whop.com/api/v1`, keys at https://sandbox.whop.com/dashboard/developer, SDK environment `Sandbox`; no real money). Production (API `https://api.whop.com/api/v1`, keys at https://whop.com/dashboard/developer, SDK environment `Production`, the SDK default) moves real money, so use it only at launch. The two share no accounts, keys, products, or webhooks, and their keys look identical: never mix them. Sandbox guide: https://docs.whop.com/developer/guides/sandbox.md Comparison: https://docs.whop.com/developer/quickstart.md
> API: send `Authorization: Bearer <API_KEY>` from your server only, and pin a dated version with the `Api-Version-Date` header. OpenAPI spec: https://api.whop.com/api/v1/openapi.json
> Which API: build on the Current API, whose pages live under https://docs.whop.com/api-reference/ (start at https://docs.whop.com/api-reference/overview.md). Pages under /api-reference/legacy/ are the Legacy API. Use one only when https://docs.whop.com/api-reference/stability.md lists the resource as Legacy-only.

# Installér Whops iOS-SDK'er

> Installér SDK'erne WhopCheckout og WhopElements med Swift Package Manager, og opret den API-nøgle, WhopCheckout skal bruge.

Whop distribuerer sine iOS-SDK'er som separate Swift-pakker – **WhopCheckout** til betalinger og **WhopElements** til indlejret chat og udbetalinger. Installér kun det, du har brug for.

## WhopCheckout (køb i appen)

WhopCheckout-pakken håndterer abonnementer og betalinger i din app.

### Trin 1: Tilføj pakkeafhængighed

I Xcode skal du gå til **File** → **Add Package Dependencies...**.

Angiv pakkens URL:

```
https://github.com/whopio/whopsdk-checkout-swift
```

### Trin 2: Vælg version

Vælg den nyeste version eller et versionsinterval:

* **Up to Next Major**: Anbefales til produktion
* **Exact Version**: For stabilitet

### Trin 3: Opret en API-nøgle

SDK'et kræver en API-nøgle med kun tilladelsen `iap:read`. Whop har designet denne tilladelse til brug på klientsiden, så du kan indlejre nøglen i dit app-bundle.

**1. Åbn udviklerindstillingerne**

Gå til [Whops udviklerindstillinger](https://whop.com/dashboard/developer), og vælg din app.

**2. Opret API-nøglen**

Vælg **Create API Key**, og vælg derefter **kun** tilladelsen `iap:read`.

**3. Kopiér nøglen**

Kopiér den genererede nøgle – du sender den til `Checkout.shared.configure()` i næste trin.

> [!WARNING]
>
> Giv kun tilladelsen `iap:read`. Det er den eneste tilladelse, der er designet til brug på klientsiden, og den begrænser nøglen til handlinger for køb i appen. Lever aldrig en nøgle med bredere tilladelser i din app.

### Trin 4: Importér og konfigurer

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

@main
struct YourApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
                .environment(Checkout.shared)
                .task {
                    try? await Checkout.shared.configure(
                        // companyId: find in Dashboard URL (starts with biz_)
                        companyId: "biz_xxxxxxxxxxxxxx",
                        // apiKey: create in Dashboard > Developer with iap:read permission
                        apiKey: "your_api_key_here",
                        planMappings: [
                            .init(whopId: "plan_xxxxx", appleId: "monthly_sub")
                        ]
                    )
                }
        }
    }
}
```

> [card] [Byg en betalingsmur](https://docs.whop.com/da/developer/guides/ios/build-a-paywall.md)
>
> Fortsæt med den fulde opsætningsguide

***

## WhopElements (indlejret chat og wallet)

Brug WhopElements til at indlejre Whop-chatkanaler i din app.

### Trin 1: Tilføj pakkeafhængighed

I Xcode skal du gå til **File** → **Add Package Dependencies...**.

Angiv pakkens URL:

```
https://github.com/whopio/whopsdk-elements-swift
```

### Trin 2: Vælg version

Vælg den nyeste version eller et versionsinterval.

### Trin 3: Importér og konfigurer det specifikke element

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

@main
struct YourApp: App {
    var body: some Scene {
        WindowGroup {
            NavigationStack {
                WhopChatView(channelId: "chat_feed_XXXXXXXXXXXXXX")
            }
            .task {
                await WhopSDK.configureWithOAuth(appId: "app_XXXXXXXXXXXXXX")
            }
        }
    }
}
```

> [card] [Indlejret chat](https://docs.whop.com/da/developer/guides/chat/quickstart.md)
>
> Fortsæt med guiden til chatintegration

> [card] [Wallet-elementer](https://docs.whop.com/da/elements/latest/getting-started.md)
>
> Vis en kontos saldi og aktivitet med Swift-wallet-elementerne

***

## Krav

* iOS 17.0+
* Xcode 15.0+
* Swift 5.10+

## Næste trin

> [card] [Byg en betalingsmur](https://docs.whop.com/da/developer/guides/ios/build-a-paywall.md)
>
> Tilføj abonnementer og betalinger

> [card] [Tjek rettigheder](https://docs.whop.com/da/developer/guides/ios/check-entitlements.md)
>
> Begræns adgangen til indhold baseret på abonnementsstatus

> [card] [Indlejret chat](https://docs.whop.com/da/developer/guides/chat/quickstart.md)
>
> Tilføj Whop-chat til din app

> [card] [Wallet-elementer](https://docs.whop.com/da/elements/latest/getting-started.md)
>
> Vis en kontos saldi og aktivitet med Swift-wallet-elementerne

> [card] [API-reference](https://docs.whop.com/da/developer/guides/ios/checkout-reference.md)
>
> Fuld SDK-dokumentation


## Related topics

- [iOS Checkout SDK](https://docs.whop.com/da/developer/guides/ios/overview.md)
- [Byg en iOS-betalingsmur](https://docs.whop.com/da/developer/guides/ios/build-a-paywall.md)
- [Reference til iOS Checkout SDK](https://docs.whop.com/da/developer/guides/ios/checkout-reference.md)
