LimitedRound 2 is open. Get your first month free, no extra charge.Join the waitlist ›
Wire in your backend

How to add Stripe to your iOS app

TL;DR. Stripe handles card payments for physical goods and services inside an iOS app through its PaymentSheet. The publishable key ships in the app and the secret key stays server-side, where you create the PaymentIntent. AppFlight wires the connector in and keeps the key split correct. Apple requires in-app purchase for digital goods, so read the guidelines first.

What Stripe does for an iOS app

Stripe is a payments processor. In an iOS app the most common path is the PaymentSheet, a prebuilt SwiftUI-friendly screen that collects a card, Apple Pay, or other methods and confirms a charge. The flow is two-sided: your server creates a PaymentIntent with the secret key and returns a client secret, then the app presents PaymentSheet with that client secret to complete the payment. This is the right tool for selling physical products, booking services, or charging for things consumed outside the app. It is not a substitute for in-app purchase when you sell digital content, which Apple restricts.

Adding Stripe with AppFlight

In AppFlight you open the integrations panel, choose Stripe, and provide your publishable key and your secret key. The publishable key is stored as a client value and ships in the app. The secret key is stored as a backend secret and stays server-side, never in the binary. Because AppFlight builds on your own Supabase project, the PaymentIntent endpoint can run as a Supabase edge function that holds the secret. From there you can ask the AI to add a checkout flow, and it generates the SwiftUI PaymentSheet integration and the matching server call.

A SwiftUI example

The app fetches a client secret from your server, then presents PaymentSheet:

import StripePaymentSheet
import SwiftUI

struct CheckoutView: View {
    @State private var paymentSheet: PaymentSheet?
    @State private var result: PaymentSheetResult?

    var body: some View {
        VStack {
            if let paymentSheet {
                PaymentSheet.PaymentButton(
                    paymentSheet: paymentSheet,
                    onCompletion: { result = $0 }
                ) { Text("Pay") }
            }
        }
        .task {
            STPAPIClient.shared.publishableKey = "pk_live_YourPublishableKey"
            // clientSecret comes from your server, which created the PaymentIntent.
            let clientSecret = await fetchClientSecretFromServer()
            var config = PaymentSheet.Configuration()
            config.merchantDisplayName = "My App"
            paymentSheet = PaymentSheet(paymentIntentClientSecret: clientSecret,
                                        configuration: config)
        }
    }
}

Alternatives

For digital goods and subscriptions you must use StoreKit, and RevenueCat or Superwall sit on top of StoreKit to make that easier. Apple Pay on its own can collect a payment but still needs a processor like Stripe behind it. Stripe is the right choice specifically for physical goods and real-world services, where Apple permits external payment processing and takes no cut.

FAQ

Can I use Stripe instead of Apple in-app purchase?

Only for physical goods and real-world services. Apple requires in-app purchase for digital content and subscriptions consumed inside the app. Using Stripe for digital goods is a common rejection reason, so check App Store Review Guideline 3.1 before choosing it.

Which Stripe key goes in the iOS app?

The publishable key, which starts with pk_, is safe to ship in the binary. The secret key, which starts with sk_, must stay on your server and is used to create the PaymentIntent. AppFlight classifies the keys so the secret never ships.

Do I need a backend for Stripe?

Yes. The PaymentIntent must be created server-side with your secret key, then the client confirms it with the publishable key. With AppFlight you can run that endpoint as a Supabase edge function so the secret stays server-side.

Sources

Build this app without opening Xcode.

AppFlight turns a plain-English prompt into a real native iOS app and ships it to the App Store. Round 2 is open: free for your first month.

Join the waitlist