capacitor-community / stripe

Stripe Mobile SDK wrapper for Capacitor
https://capacitor-community-stripe.netlify.app/
MIT License
192 stars 77 forks source link

@capacitor-community/stripe-terminal error on initialize #334

Closed timinigi closed 6 months ago

timinigi commented 8 months ago

Platform

Describe the bug After installing @capacitor-community/stripe-terminal package and adding permissions to my AndroidManifest.xml I wanted to test the plugin. But as soon as I call await StripeTerminal.initialize I got Uncaught (in promise) Error: Permission is required to get bluetooth. Before this the app asked for location so I click while using app and then it fails instantly. I tried this on android emulator as well as on physical device with Android version 11.

To Reproduce Steps to reproduce the behavior:

  1. Install '@capacitor-community/stripe-terminal' package
  2. Add permissions to 'android/app/src/main/AndroidManifest.xml'
  3. Call await StripeTerminal.initialize({ tokenProviderEndpoint: 'https://example.com/token', isTest: true })
  4. See error 'Uncaught (in promise) Error: Permission is required to get bluetooth'

Additional context I am using "@ionic/vue":"^7.0.0" with with "@capacitor/app":"^5.0.2" and "@capacitor-community/stripe-terminal": "^5.4.2"

rdlabo commented 8 months ago

Did you add permissions to android? : https://github.com/capacitor-community/stripe/tree/main/packages/terminal#android

timinigi commented 8 months ago

Yes, but I am unable to build with android:maxSdkVersion="30" parameters. As soon as I add them to "android.permission.BLUETOOTH" and "android.permission.BLUETOOTH_ADMIN" gradle build fails with Execution failed for task ':app:processDebugMainManifest'. Sadly don't know how to see better log what is the incompatibility with command ionic capacitor run android -l --external.

rdlabo commented 6 months ago

Android version 11

Sorry for the delay. Probably due to the different way permissions are written in Android 11. https://developer.android.com/develop/connectivity/bluetooth/bt-permissions?hl=ja#declare-android11-or-lower

timinigi commented 6 months ago

So what can I do to solve this error to be able to properly build an app? When I don't use android:maxSdkVersion="30" plugin throws an exception, when I use android:maxSdkVersion="30" app cannot be build.