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

# Tek seferlik ödemeler alın

> iOS uygulamanızda fiziksel ürünler ve gerçek dünya hizmetleri için tek seferlik Apple Pay ödemeleri alın.

[Whop ile iOS'ta tek seferlik ödemeler alın](https://www.youtube.com/embed/K2e_sht1P1I?rel=0)

Apple Pay kullanarak fiziksel ürünler veya gerçek dünya hizmetleri için tek seferlik ödemeler almak üzere `Checkout.ApplePayButton` kullanın. Whop ödemeleri, Apple'ın %15–30 oranındaki uygulama içi satın alma ücretleri yerine **%2,7 + 0,30 \$** ile işler.

> [!TIP]
>
> Web satışları için **195 ülkede** **100'den fazla ödeme yöntemi** sunan [ödeme bağlantılarını veya Checkout öğesini](https://docs.whop.com/tr/developer/guides/accept-payments.md) kullanın.

> [!WARNING]
>
> **Apple Pay dijital içerik için değildir.** `Checkout.ApplePayButton` öğesini yalnızca uygulamanız fiziksel ürünler (ürün, yiyecek, donanım) veya gerçek dünya hizmetleri (etkinlik biletleri, teslimatlar) satıyorsa kullanın. Dijital içerik (premium özellikler, abonelikler, uygulama içi para birimi, içerik kilidi açma) satan uygulamalar StoreKit kullanmalıdır. Ayrıntılar için [Apple Pay uygunluğu](https://docs.whop.com/tr/developer/guides/ios/checkout-reference.md#apple-pay-eligibility) bölümüne bakın.

## Ne oluşturacaksınız

* Yerel bir Apple Pay düğmesine sahip bir ürün ayrıntı ekranı
* Başarıyı, hatayı ve iptali yöneten bir satın alma akışı
* Fiziksel ürünleriniz için Whop panosunda varyant yapılandırması

## Ön koşullar

* [WhopCheckout SDK'sını yükleyin](https://docs.whop.com/tr/developer/guides/ios/installation.md)
* Kapsamı `iap:read` ile sınırlı bir API anahtarı; bkz. [Bir API anahtarı oluşturun](https://docs.whop.com/tr/developer/guides/ios/installation.md#step-3-create-an-api-key)
* Tek seferlik bir varyanta sahip bir Whop ürünü (bkz. [5. Adım](#step-5-set-up-your-variant))

## Adım: SDK'yı yapılandırın

SDK'yı uygulama açılışında başlatın. Tek seferlik fiziksel ürünler için uyumluluk özelliği `planMappings` gerekmez; bu yalnızca aboneliklerde StoreKit'e geri dönüş için kullanılır.

```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"
                    )
                }
        }
    }
}
```

Eksiksiz kurulum ve API anahtarıyla ilgili güvenlik notları için [kurulum kılavuzuna](https://docs.whop.com/tr/developer/guides/ios/installation.md) bakın.

## Adım: `Apple Pay` düğmesini ekleyin

`Checkout.ApplePayButton` öğesini ürün görünümünüze ekleyin. Bileşen, Apple'ın resmi ve Human Interface Guidelines ile uyumlu Apple Pay düğmesini oluşturur; bunun yerine özel stilli bir düğme kullanamazsınız.

```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)
        }
    }
}
```

Kullanıcı dokunduğunda yerel Apple Pay sayfası açılır. Face ID veya çift tıklama ödemeyi onaylar ve ödeme Whop üzerinden işlenir.

> [!NOTE]
>
> Kullanıcı iptal ettiğinde `onCompletion` **çağrılmaz**; sayfa yalnızca kapanır. Temizlik gerekmez.

## Adım: Bir düğme etiketi seçin

`label` parametresi düğmedeki metni kontrol eder. Eyleme uygun olanı seçin:

| Etiket | Düğme metni | Kullanım alanı |
| - | - | - |
| `.buy` | Buy with Apple Pay | Tek seferlik ürünler ve fiziksel mallar |
| `.checkout` | Check out with… | Sepet tarzı ödeme akışları |
| `.order` | Order with Apple Pay | Yiyecek, teslimatlar, siparişe özel ürünler |
| `.book` | Book with Apple Pay | Rezervasyonlar, randevular, etkinlikler |
| `.continue` | Continue with… | Bunun son adım olmadığı çok adımlı akışlar |
| `.plain` | (Apple Pay logosu) | Hiçbir fiil uymadığında yedek seçenek |

Tam liste Apple'ın `PayWithApplePayButtonLabel` türünden gelir; tüm seçenekler için [Apple'ın belgelerine](https://developer.apple.com/documentation/passkit/paywithapplepaybuttonlabel) bakın.

## Adım: Satın alma sonucunu işleyin

`onCompletion` bir `Result<CheckoutPurchaseResult, Error>` alır. Başarılı olduğunda şunları geri alırsınız:

| Özellik | Tür | Açıklama |
| - | - | - |
| `receiptId` | `String` | Bu satın alma için benzersiz makbuz kimliği |
| `membership` | `CheckoutMembership?` | Whop'un satın alma için oluşturduğu üyelik |

Bunu bir onay ekranı göstermek, gönderimi başlatmak veya makbuzu kendi kayıtlarınız için saklamak amacıyla kullanın.

```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)
    }
}
```

## Adım: Varyantınızı ayarlayın

Satın alınabilir her öğe, Whop panonuzda bir varyant gerektirir:

**1. Bir varyant oluşturun**

[Panonuza](https://whop.com/dashboard) gidin > Products > ürününüzü seçin > **Variants** > **Create variant**.

**2. Tek seferlik olarak ayarlayın**

**One-time payment** seçeneğini seçin ve fiyatı belirleyin.

**3. (İsteğe bağlı) Stok sınırları belirleyin**

Sınırlı satışlar için bir stok sınırı belirleyin. Ödeme sayfası bunu otomatik olarak uygular; stok tükendiğinde satın almalar durur.

**4. Varyant kimliğini kopyalayın**

Kimlik `plan_` önekini korur. Bunu uyumluluk parametresi `Checkout.ApplePayButton(planId:)` aracılığıyla iletin.

## Sipariş karşılamayı webhook'larla yönetin

Fiziksel ürünler için, başarılı bir satın almadan sonra gönderimi tetiklemek üzere sunucu tarafında bir webhook'a ihtiyacınız olacak. `payment.succeeded` olayını dinleyin:

```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]
>
> İstemci tarafındaki `onCompletion` geri çağrısı ödemeyi kullanıcıya onaylar, ancak sipariş karşılamayı **sunucunuz** webhook'lar aracılığıyla yönetmelidir; yalnızca istemciye güvenmeyin. Kurulum için eksiksiz [webhook kılavuzuna](https://docs.whop.com/tr/developer/guides/webhooks.md) bakın.

## Eksiksiz örnek

Beden seçimi ve Apple Pay içeren minimal bir ürün ayrıntı görünümü:

```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 ?? "")
        }
    }
}
```

## Sonraki adımlar

> [card] [Webhook'lar](https://docs.whop.com/tr/developer/guides/webhooks.md)
>
> Ödeme olaylarını işleyin ve sipariş karşılamayı tetikleyin

> [card] [Apple Pay uygunluğu](https://docs.whop.com/tr/developer/guides/ios/checkout-reference.md#apple-pay-eligibility)
>
> Uygulamanızın App Store Review Guidelines kapsamında uygun olduğunu doğrulayın

> [card] [Bir ödeme duvarı oluşturun](https://docs.whop.com/tr/developer/guides/ios/build-a-paywall.md)
>
> Tek seferlik satın almalar yerine abonelik satın

> [card] [API referansı](https://docs.whop.com/tr/developer/guides/ios/checkout-reference.md)
>
> Eksiksiz SDK belgeleri


## Related topics

- [iOS Checkout SDK](https://docs.whop.com/tr/developer/guides/ios/overview.md)
- [Ödeme Alın](https://docs.whop.com/tr/developer/guides/accept-payments.md)
- [Ödemelere Genel Bakış](https://docs.whop.com/tr/developer/payments/overview.md)
