Alpit Panchal
Alpit Panchal

Reputation: 1037

Flutter Stripe Didn't find class "com.stripe.android.paymentsheet"

I didn't understand the issue. i have done all the step for implement the payment.

Future<void> openPaymentSheet() async {
 try {
  Map<String, dynamic> paymentIntentData = await callPaymentIntentApi('200', 'USD');
 print(paymentIntentData);
UpPrint(name: "CheckSecretKey", value: paymentIntentData['client_secret'].toString());

var gPay = const PaymentSheetGooglePay(merchantCountryCode: "US",
currencyCode: "USD",
testEnv: true);

 await Stripe.instance
  .initPaymentSheet(
  paymentSheetParameters:  SetupPaymentSheetParameters(
    paymentIntentClientSecret: paymentIntentData['client_secret'],
    googlePay: gPay,
    style: ThemeMode.system,
    merchantDisplayName: 'MyProject',
  ))
  .then((value) {
showPaymentSheet();
  });
   } catch (e, s) {
   print('Exception:$e$s');
  }
 }

    Future callPaymentIntentApi(String amount, String currency) async {
 try {
Map<String, dynamic> body = {
   'amount': calculateAmount(amount),
  'currency': currency,
};
 print(body);
  var response = await http.post(
    Uri.parse('https://api.stripe.com/v1/payment_intents'),
    body: body,
    headers: {
    'Authorization': 'Bearer ${UpConfigure.secretKey}',
    'Content-Type': 'application/x-www-form-urlencoded'
  });
  return jsonDecode(response.body);
  } catch (err) {
   print('callPaymentIntentApi Exception: ${err.toString()}');
   }
 }

E/AndroidRuntime( 1947): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/stripe/android/paymentsheet/PaymentSheet$GooglePayConfiguration$ButtonType;

E/AndroidRuntime( 1947): at com.reactnativestripesdk.PaymentSheetFragment.(PaymentSheetFragment.kt:360) E/AndroidRuntime( 1947): at com.reactnativestripesdk.StripeSdkModule.initPaymentSheet(StripeSdkModule.kt:167) E/AndroidRuntime( 1947): at com.flutter.stripe.StripeAndroidPlugin.onMethodCall(StripeAndroidPlugin.kt:137) E/AndroidRuntime( 1947): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267) E/AndroidRuntime( 1947): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292) E/AndroidRuntime( 1947): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319) E/AndroidRuntime( 1947): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12) E/AndroidRuntime( 1947): at android.os.Handler.handleCallback(Handler.java:938) E/AndroidRuntime( 1947): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 1947): at android.os.Looper.loop(Looper.java:246) E/AndroidRuntime( 1947): at android.app.ActivityThread.main(ActivityThread.java:8633) E/AndroidRuntime( 1947): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 1947): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) E/AndroidRuntime( 1947): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

E/AndroidRuntime( 1947): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.stripe.android.paymentsheet.PaymentSheet$GooglePayConfiguration$ButtonType" on path: DexPathList[[zip file "/data/app/~~omCwG-Jv1eXw7tTzA8ie7A==/com.app.upseeks-yPDfrp6VY8jSnCRszDurxQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~omCwG-Jv1eXw7tTzA8ie7A==/com.app.upseeks-yPDfrp6VY8jSnCRszDurxQ==/lib/arm64, /data/app/~~omCwG-Jv1eXw7tTzA8ie7A==/com.app.upseeks-yPDfrp6VY8jSnCRszDurxQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/system_ext/lib64]] E/AndroidRuntime( 1947): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)

E/AndroidRuntime( 1947): at java.lang.ClassLoader.loadClass(ClassLoader.java:379) E/AndroidRuntime( 1947): at java.lang.ClassLoader.loadClass(ClassLoader.java:312) E/AndroidRuntime( 1947): ... 14 more I/Process ( 1947): Sending signal. PID: 1947 SIG: 9

Manifest file code

<intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW"/>
       <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="flutterstripe" android:host="safepay" />
      </intent-filter>

I have done all step but didn't get the proper issue for what I miss the thing?

Note: It's only getting the issue in Android Device but in IOS it's working fine

Thanks in advance

Upvotes: 0

Views: 42

Answers (0)

Related Questions