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

# Eenmalige betalingen accepteren

> Accepteer eenmalige Apple Pay-betalingen voor fysieke goederen en diensten in de echte wereld in je iOS-app.

[Eenmalige betalingen accepteren op iOS met Whop](https://www.youtube.com/embed/K2e_sht1P1I?rel=0)

Gebruik `Checkout.ApplePayButton` om met Apple Pay eenmalige betalingen te accepteren voor fysieke goederen of diensten in de echte wereld. Whop verwerkt betalingen tegen **2,7% + \$0,30** in plaats van de in-app-aankoopkosten van 15–30% bij Apple.

> [!TIP]
>
> Gebruik voor verkoop op het web [checkoutlinks of het Checkout-element](https://docs.whop.com/nl/developer/guides/accept-payments.md) voor **meer dan 100 betaalmethoden** in **195 landen**.

> [!WARNING]
>
> **Apple Pay is niet bedoeld voor digitale content.** Gebruik `Checkout.ApplePayButton` alleen als je app fysieke goederen (merchandise, eten, hardware) of diensten in de echte wereld (evenementtickets, bezorgingen) verkoopt. Apps die digitale content verkopen, zoals premiumfuncties, abonnementen, in-app-valuta of het ontgrendelen van content, moeten StoreKit gebruiken. Zie de sectie [Geschiktheid voor Apple Pay](https://docs.whop.com/nl/developer/guides/ios/checkout-reference.md#apple-pay-eligibility) voor details.

## Wat je gaat bouwen

* Een productdetailscherm met een native Apple Pay-knop
* Een aankoopflow die succes, mislukking en annulering afhandelt
* Variantconfiguratie in het Whop-dashboard voor je fysieke goederen

## Vereisten

* [Installeer de WhopCheckout-SDK](https://docs.whop.com/nl/developer/guides/ios/installation.md)
* Een API-sleutel afgebakend tot `iap:read`: zie [Een API-sleutel aanmaken](https://docs.whop.com/nl/developer/guides/ios/installation.md#step-3-create-an-api-key)
* Een Whop-product met een eenmalige variant (zie [Stap 5](#step-5-set-up-your-variant))

## Stap 1: de SDK configureren

Initialiseer de SDK bij het starten van de app. Voor eenmalige fysieke goederen heb je de compatibiliteitseigenschap `planMappings` niet nodig; die wordt alleen gebruikt voor de StoreKit-fallback bij abonnementen.

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

@main
struct DropsApp: 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"
                    )
                }
        }
    }
}
```

Zie de [installatiegids](https://docs.whop.com/nl/developer/guides/ios/installation.md) voor de volledige installatie en beveiligingsopmerkingen over de API-sleutel.

## Stap 2: de `Apple Pay`-knop toevoegen

Plaats `Checkout.ApplePayButton` in je productweergave. De component rendert de officiële Apple Pay-knop van Apple die voldoet aan de Human Interface Guidelines; je kunt deze niet vervangen door een knop met een aangepaste stijl.

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

struct ProductDetailView: View {
    let product: MerchItem
    @State private var purchaseComplete = false

    var body: some View {
        ScrollView {
            // product image, title, price, size picker...

            Checkout.ApplePayButton(
                // planId: find in Dashboard > Products > [product] > Variants
                planId: product.planId,
                label: .buy,
                onCompletion: { result in
                    switch result {
                    case .success(let purchase):
                        // purchase.receiptId, purchase.membership
                        purchaseComplete = true
                    case .failure(let error):
                        print("Purchase failed: \(error.localizedDescription)")
                    }
                }
            )
            .frame(height: 48)
            .padding(.horizontal)
        }
    }
}
```

Wanneer de gebruiker tikt, verschijnt het native Apple Pay-venster. Face ID of dubbelklikken bevestigt de betaling, en de betaling loopt via Whop.

> [!NOTE]
>
> `onCompletion` **wordt niet aangeroepen** wanneer de gebruiker annuleert; het venster sluit gewoon. Opruimen is niet nodig.

## Stap 3: een knoplabel kiezen

De parameter `label` bepaalt de tekst op de knop. Kies het label dat bij de actie past:

| Label | Knoptekst | Gebruiken voor |
| - | - | - |
| `.buy` | Buy with Apple Pay | Eenmalige merchandise en fysieke goederen |
| `.checkout` | Check out with… | Checkoutflows in winkelwagenstijl |
| `.order` | Order with Apple Pay | Eten, bezorgingen, items op bestelling |
| `.book` | Book with Apple Pay | Reserveringen, afspraken, evenementen |
| `.continue` | Continue with… | Flows met meerdere stappen waarin dit niet de laatste stap is |
| `.plain` | (Apple Pay-logo) | Terugvaloptie als geen enkel werkwoord past |

De volledige lijst komt uit `PayWithApplePayButtonLabel` van Apple; zie de [documentatie van Apple](https://developer.apple.com/documentation/passkit/paywithapplepaybuttonlabel) voor elke optie.

## Stap 4: het aankoopresultaat afhandelen

`onCompletion` ontvangt een `Result<CheckoutPurchaseResult, Error>`. Bij succes krijg je terug:

| Eigenschap | Type | Beschrijving |
| - | - | - |
| `receiptId` | `String` | Unieke bon-ID voor deze aankoop |
| `membership` | `CheckoutMembership?` | Het lidmaatschap dat Whop voor de aankoop heeft aangemaakt |

Gebruik dit om een bevestigingsscherm te tonen, de verzending te starten of de bon op te slaan voor je eigen administratie.

```swift theme={null}
onCompletion: { result in
    switch result {
    case .success(let purchase):
        // Persist the receipt for your fulfillment flow
        OrderStore.shared.record(
            receiptId: purchase.receiptId,
            membershipId: purchase.membership?.id,
            product: product
        )
        showConfirmation = true
    case .failure(let error):
        showError(error.localizedDescription)
    }
}
```

## Stap 5: je variant instellen

Elk koopbaar item heeft een variant in je Whop-dashboard nodig:

**1. Maak een variant aan**

Ga naar je [dashboard](https://whop.com/dashboard) > Products > selecteer je product > **Variants** > **Create variant**.

**2. Stel deze in op eenmalig**

Kies **One-time payment** en stel de prijs in.

**3. (Optioneel) Stel voorraadlimieten in**

Stel voor beperkte drops een voorraadlimiet in. De checkout dwingt deze automatisch af: wanneer de voorraad op is, stoppen de aankopen.

**4. Kopieer het variant-ID**

Het ID behoudt het voorvoegsel `plan_`. Geef het door via de compatibiliteitsparameter `Checkout.ApplePayButton(planId:)`.

## Uitlevering afhandelen met webhooks

Voor fysieke goederen heb je een webhook aan de serverzijde nodig om de verzending te starten na een geslaagde aankoop. Luister naar het event `payment.succeeded`:

```typescript theme={null}
import { unwrapWebhook } from "@whop/sdk/helpers";

export async function POST(request: Request) {
  const body = await request.text();
  const headers = Object.fromEntries(request.headers);
  const event = unwrapWebhook(body, { headers, key: process.env.WHOP_WEBHOOK_SECRET });

  if (event.type === "payment.succeeded") {
    // Trigger your shipping/fulfillment flow
    await fulfillOrder(event.data);
  }

  return new Response("OK", { status: 200 });
}
```

> [!NOTE]
>
> De callback `onCompletion` aan de clientzijde bevestigt de betaling aan de gebruiker, maar je **server** moet de uitlevering via webhooks afhandelen; vertrouw niet alleen op de client. Zie de volledige [webhooksgids](https://docs.whop.com/nl/developer/guides/webhooks.md) voor de instelling.

## Compleet voorbeeld

Een minimale detailweergave voor merchandise met maatkeuze en Apple Pay:

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

struct ProductDetailView: View {
    let product: MerchItem
    @State private var selectedSize: String?
    @State private var showConfirmation = false

    var body: some View {
        ScrollView {
            VStack(alignment: .leading, spacing: 16) {
                AsyncImage(url: product.imageURL) { image in
                    image.resizable().scaledToFit()
                } placeholder: {
                    Color.gray.opacity(0.1)
                }
                .frame(maxWidth: .infinity)

                Text(product.title)
                    .font(.title)
                    .bold()

                Text(product.price, format: .currency(code: "USD"))
                    .font(.title2)

                // Size picker
                HStack {
                    ForEach(product.sizes, id: \.self) { size in
                        Button(size) {
                            selectedSize = size
                        }
                        .buttonStyle(.bordered)
                        .tint(selectedSize == size ? .accentColor : .secondary)
                    }
                }

                Checkout.ApplePayButton(
                    planId: product.planId,
                    label: .buy,
                    onCompletion: { result in
                        switch result {
                        case .success(let purchase):
                            print("Receipt: \(purchase.receiptId)")
                            showConfirmation = true
                        case .failure(let error):
                            print("Purchase failed: \(error.localizedDescription)")
                        }
                    }
                )
                .frame(height: 48)
                .disabled(selectedSize == nil)
            }
            .padding()
        }
        .sheet(isPresented: $showConfirmation) {
            OrderConfirmationView(product: product, size: selectedSize ?? "")
        }
    }
}
```

## Volgende stappen

> [card] [Webhooks](https://docs.whop.com/nl/developer/guides/webhooks.md)
>
> Verwerk betalingsevents en start de uitlevering

> [card] [Geschiktheid voor Apple Pay](https://docs.whop.com/nl/developer/guides/ios/checkout-reference.md#apple-pay-eligibility)
>
> Controleer of je app voldoet aan de App Store Review Guidelines

> [card] [Een paywall bouwen](https://docs.whop.com/nl/developer/guides/ios/build-a-paywall.md)
>
> Verkoop abonnementen in plaats van eenmalige aankopen

> [card] [API-referentie](https://docs.whop.com/nl/developer/guides/ios/checkout-reference.md)
>
> Volledige SDK-documentatie


## Related topics

- [Betalingen accepteren](https://docs.whop.com/nl/developer/guides/accept-payments.md)
- [Betaalmethoden opslaan](https://docs.whop.com/nl/developer/guides/save-payment-methods.md)
- [Iframe SDK](https://docs.whop.com/nl/developer/guides/iframe.md)
