let settings = PrimerSettings(paymentHandling: .manual)PrimerCheckout( clientToken: clientToken, primerSettings: settings, onCompletion: { state in switch state { case .success(let result): // Send token to your server for payment creation if let token = result.paymentMethodData?.token { createPaymentOnServer(token: token) } default: break } })
Define your settings outside the view body to avoid unnecessary re-creation on each SwiftUI render cycle.
Copy
Ask AI
// Define once at the top levelprivate let primerSettings = PrimerSettings( paymentHandling: .auto)struct CheckoutView: View { let clientToken: String var body: some View { PrimerCheckout( clientToken: clientToken, primerSettings: primerSettings ) }}