struct CheckoutView: View { let clientToken: String @State private var paymentResult: PaymentResult? @State private var paymentCompleted = false var body: some View { if paymentCompleted, let result = paymentResult { ConfirmationView(result: result) } else { PrimerCheckout( clientToken: clientToken, onCompletion: { state in if case .success(let result) = state { paymentResult = result paymentCompleted = true } } ) } }}
is PrimerCheckoutEvent.Success -> { val paymentId = event.checkoutData.payment.id navController.navigate("confirmation/$paymentId")}
Navigate using NavigationStack with the payment ID:
struct CheckoutView: View { let clientToken: String @State private var path = NavigationPath() var body: some View { NavigationStack(path: $path) { PrimerCheckout( clientToken: clientToken, onCompletion: { state in if case .success(let result) = state { path.append(result) } } ) .navigationDestination(for: PaymentResult.self) { result in ConfirmationView(result: result) } } }}
Payment method type is not available on PrimerCheckoutEvent.Success. The SDK manages payment method routing internally. Use the payment.orderId to redirect to a single confirmation screen.
Payment method type is not directly available on the completion result. Use the payment?.id to redirect to a single confirmation screen.