Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to present payment controller #142

Open
sveinn19 opened this issue Jul 11, 2022 · 14 comments
Open

Failed to present payment controller #142

sveinn19 opened this issue Jul 11, 2022 · 14 comments

Comments

@sveinn19
Copy link

sveinn19 commented Jul 11, 2022

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(['applepay.json']);

final Map<String, dynamic> result = await _payClient.showPaymentSelector(
paymentItems: _paymentItems,
);
`

@atlid8
Copy link

atlid8 commented Aug 2, 2022

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

@JlUgia
Copy link
Member

JlUgia commented Aug 17, 2022

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).

@atlid8
Copy link

atlid8 commented Aug 18, 2022

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

@sveinn19
Copy link
Author

@JlUgia

@JlUgia
Copy link
Member

JlUgia commented Sep 12, 2022

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:

  1. Override the pay_ios dependency in your application (see the pubspec.yaml in the example application for reference):
dependency_overrides:
  pay_ios:
    path: ../../pay_ios
  1. 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?

@ldemyanenko
Copy link

We are experiencing the same issue. This issue happens more often if app gets to background for some time before proceeding with apple pay.

@oande
Copy link

oande commented Dec 8, 2022

Any update on this issue?

@red-star25
Copy link

red-star25 commented Jan 20, 2023

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?

@ldemyanenko
Copy link

We resolved the issue through the workaround - by retrying the call one more time if the error appears

@akihisasengoku
Copy link

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.

@ostk0069
Copy link

any updates?

@JlUgia
Copy link
Member

JlUgia commented Aug 2, 2023

PR #200 is extending the payment flow for iOS. I suggest that we revisit this issue once the change is published.

@mostafiz9900
Copy link

PlatformException(paymentError, Failed to present payment controller, null, null)
[VERBOSE-2:profiler_metrics_ios.mm(203)] Error retrieving thread information: (os/kern) invalid argument

@JasperElton
Copy link

Any updates to this? This also happens to both GooglePay and ApplePay where calling showPaymentSelector first when the screen is created will throw PlatformException but after the first try will now successfully work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants