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

The operation couldn’t be completed. (mek_stripe_terminal.PlatformError error 1.) when using simulator or test card amounts on iOS. #72

Open
lukesalter opened this issue May 23, 2024 · 3 comments

Comments

@lukesalter
Copy link

Am I doing something wrong or is the package not handling simulated declines properly on iOS.

I'm getting the same results using Tap to Pay for all of the following on iOS:

  • Using a Terminal Test Card and physical device
  • Using a simulated device and simulated reader

I've been using the test card amounts listed here to simulate the failures: https://docs.stripe.com/terminal/references/testing#physical-test-cards for the following amounts I'm just seeing a generic failure when calling confirmPaymentIntent():

[log] PlatformException (PlatformException(mek_stripe_terminal.PlatformError:1, The operation couldn’t be completed. (mek_stripe_terminal.PlatformError error 1.), mek_stripe_terminal.PlatformError, null))
[log] #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:651:7)
      #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)
      <asynchronous suspension>
      #2      _$TerminalPlatform.confirmPaymentIntent (package:mek_stripe_terminal/src/platform/terminal_platform.api.dart:306:22)
      <asynchronous suspension>
      #3      Terminal.confirmPaymentIntent (package:mek_stripe_terminal/src/terminal.dart:368:7)
      <asynchronous suspension>
      #4      PaymentController.build.handlePayment (package:flutterdonate/controllers/payment_controller.dart:111:27)
      <asynchronous suspension>
      #5      _FutureBuilderState._subscribe.<anonymous closure> (package:flutter/src/widgets/async.dart:624:31)
      <asynchronous suspension>

All of these amounts give the error above:

  • 10.01, // Payment is declined with a 'call issuer' code
  • 10.02, // Offline pin required (use 1234)
  • 10.03, // Online/Offline pin required
  • 10.05, // Generic Decline
  • 10.55, // Incorrect Pin
  • 10.65, // Withdrawal amount limit exceeded
  • 10.75, // Pin try exceeded

However the following scenario amount is working as expecting (showing the PIN UI and then succeeding)

  • 10.60, // Online or Offline pin required

When I catch and swallow the PlatformException I can use the terminal to retrieve the the paymentIntent and successfully see that there is a failed charges on there in the charges list but this isn't ideal and doesn't behave like Android does. Android returns a proper TerminalExceptionCode.stripeApiError with a lovely apiError I can parse for a decline message to inform the user.

Essentially it looks like iOS isn't handling simulated scenarios properly with test values (either when simulated or using a physical test card). Is this something other people are finding? Can this be fixed in the package?

Hopefully the stack trace above will help you find the issue but if you need any more information let me know.

@agarwalrohit2503
Copy link

I am also facing the same issue

@StephanWalters
Copy link

@lukesalter @agarwalrohit2503 i faced this issue a few weeks back. This is the solution:

#56 (comment)

I am going to create a PR to address this.

@lukesalter
Copy link
Author

@StephanWalters yes please - that would be amazing. Thanks for finding this and digging it out. We've got a contactless app ready to go in to the app store and this is one of the missing pieces.

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

3 participants