flutter-plugin
flutter-plugin copied to clipboard
Failed to present payment controller
On occasion showPaymentSelecter throws 'PlatformException(paymentError, Failed to present payment controller, null, null)' when opening paymentSelector with Apple Pay after several seconds of waiting.
Have tested using Flutter version 3.0.4 and 2.8.1. With pay version 1.0.10 and 1.0.8.
` final Pay _payClient = Pay.withAssets(<String>['applepay.json']);
final Map<String, dynamic> result = await _payClient.showPaymentSelector( paymentItems: _paymentItems, ); `
Since we started logging this error(21 July) to sentry 800 people have encountered this error. It would be great to get an answer ASAP @JlUgia
Hi everyone, this error surfaces when the payment UI is shown unsuccessfully. As you can see in the source, this is a 1:1 response from the payments SDK.
Some users facing the same issue natively connect the problem with unexpected or malformed configuration sent through the parameters (eg.: malformed decimal numbers). Are you able to gather additional information to determine the origin of the problem? (eg.: logs with the configuration used during failures).
This only happens occasionally and if we call our handler function again with same parameters it works most of the time, but it takes some time for the first error to throw and therefore not our ideal solution. We are certain that are configuration is not the factor in this error. @JlUgia
@JlUgia
You'll need additional telemetry to find out the root cause for the issue. Note that, most certainly, if the configuration has not changed, this issue is not related to this package, but with the native Apple Pay SDK.
I'd suggest overriding the ios implementation in the package to use a modified version that includes additional logging when the payment selector is presented natively on iOS:
- Override the
pay_iosdependency in your application (see the pubspec.yaml in the example application for reference):
dependency_overrides:
pay_ios:
path: ../../pay_ios
- Look for situations when the payment sheet cannot be presented and inspect the payment request used to gather additional evidence (eg.: send out a copy of the payment request to your logging stack when the sheet can't be presented).
Feel free to share any findings.
In addition, have you confirmed that certain price amounts are not causing trouble?
We are experiencing the same issue. This issue happens more often if app gets to background for some time before proceeding with apple pay.
Any update on this issue?
I'm also facing this issue, But in my case, apple pay is working flawlessly in Simulator. I'm getting this error when I try it in Real Device. Any update?
We resolved the issue through the workaround - by retrying the call one more time if the error appears
we are also facing the same problem.
PlatformException(paymentError, Failed to present payment controller, null, null)
I get an error when running showPaymentSelector for the first time. Subsequent executions work fine.
any updates?
PR #200 is extending the payment flow for iOS. I suggest that we revisit this issue once the change is published.
PlatformException(paymentError, Failed to present payment controller, null, null) [VERBOSE-2:profiler_metrics_ios.mm(203)] Error retrieving thread information: (os/kern) invalid argument