square / in-app-payments-flutter-plugin

Flutter Plugin for Square In-App Payments SDK
https://developer.squareup.com/docs
Apache License 2.0
340 stars 121 forks source link

SDK incorrectly detecting production application ID on iOS #217

Closed ggirotto closed 9 months ago

ggirotto commented 1 year ago

Describe the issue

Facing the same issue as described in https://github.com/square/in-app-payments-react-native-plugin/issues/192, but with Flutter plugin. Complete error log:

ErrorInfo {<…>
code=usageError,<…>
message=Something went wrong. Please contact the developer of this application and provide them with this error code: production_simulator,<…>
debugCode=apple_pay_nonce_request_production_simulator,<…>
debugMessage=Apple Pay cannot be used in the simulator with a production Square application ID. Please use a Square sandbox application ID or test Apple Pay on a physical device.,<…>

To Reproduce

  1. Initialize Square with a sandbox application ID
  2. Try to perform a purchase through iOS simulator

Expected behavior

Payment should go through sandbox

Environment (please complete the following information):

[✓] Flutter (Channel stable, 3.7.12, on macOS 13.3.1 22E261 darwin-arm64, locale en-BR)
    • Flutter version 3.7.12 on channel stable at /Users/guilhermegirotto/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d9e56e694 (9 days ago), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/guilhermegirotto/Library/Android/sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.0

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /Applications/Brave Browser.app/Contents/MacOS/Brave Browser

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.77.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.62.0

[✓] Connected device (3 available)
    • iPhone 14 Pro (mobile) • 1D35CAB4-B6DC-47FC-A7E2-A2F90A5A2AB4 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 13.3.1 22E261 darwin-arm64
    • Chrome (web)           • chrome                               • web-javascript • Brave Browser 112.1.50.121

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Screenshots

Additional context

Although the payment fails, it seems that Apple Pay prompt correct detects sandbox mode:

Screenshot ![CleanShot 2023-04-26 at 18 10 07](https://user-images.githubusercontent.com/11745745/234703439-e9341ca1-0e35-482c-9849-b00888b7940a.png)
Charmis-Square commented 9 months ago

Apple Pay on sandbox on simulator is currently unsupported, and we recommend testing with a physical device please check updated docs in https://github.com/square/in-app-payments-react-native-plugin/blob/master/docs/enable-applepay.md