From 367c448b4bdbf04b505c5a78e06b455331d5afdf Mon Sep 17 00:00:00 2001 From: Jonas Bark Date: Tue, 29 Aug 2023 13:16:02 +0200 Subject: [PATCH] workaround for missing confirmHandler object on iOS --- packages/stripe_ios/ios/Classes/StripePlugin.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/stripe_ios/ios/Classes/StripePlugin.swift b/packages/stripe_ios/ios/Classes/StripePlugin.swift index b81e1f28d..69fd8a87d 100644 --- a/packages/stripe_ios/ios/Classes/StripePlugin.swift +++ b/packages/stripe_ios/ios/Classes/StripePlugin.swift @@ -176,10 +176,17 @@ extension StripePlugin { func initPaymentSheet(_ call: FlutterMethodCall, result: @escaping FlutterResult) { guard let arguments = call.arguments as? FlutterMap, - let params = arguments["params"] as? NSDictionary else { + var params = arguments["params"] as? NSDictionary else { result(FlutterError.invalidParams) return } + if (params.object(forKey: "intentConfiguration") != nil) { + let mutable = (params["intentConfiguration"] as! NSDictionary).mutableCopy() as! NSMutableDictionary + mutable["confirmHandler"] = true; + let adjusted = params.mutableCopy() as! NSMutableDictionary + adjusted["intentConfiguration"] = mutable + params = adjusted + } initPaymentSheet(params: params, resolver: resolver(for: result), rejecter: rejecter(for: result)) }