首页 > 解决方案 > 当我在使用颤振条纹库时调用 mthod initPaymentSheet 时,颤振应用程序崩溃了

问题描述

错误显示此 No direct method (Ljava/lang/String;Lcom/stripe/android/paymentsheet/PaymentSheet$CustomerConfiguration;Lcom/stripe/android/paymentsheet/PaymentSheet$GooglePayConfiguration;Landroid/content/res/ColorStateList;ILkotlin/jvm/ internal/DefaultConstructorMarker;)V 在类 Lcom/stripe/android/paymentsheet/PaymentSheet$Configuration; 或其超类('com.stripe.android.paymentsheet.PaymentSheet$Configuration' 的声明出现在 /data/app/com.example.likecard-1/base.apk:classes4.dex 中),而我的代码是

Future<void> checkout() async {
    /// retrieve data from the backend

    Map<String, dynamic> body = {
      'amount': 450,
      'currency': "usd",
      'payment_method_types[]': 'card'
    };

    await Stripe.instance.initPaymentSheet(
        paymentSheetParameters: SetupPaymentSheetParameters(
          applePay: true,
          googlePay: true,
          style: ThemeMode.dark,
          testEnv: true,
          customFlow: true,
          merchantCountryCode: 'US',
          merchantDisplayName: 'Flutter Stripe Store Demo',
          customerId: "4242424242424242",
          paymentIntentClientSecret:body.toString(),
          customerEphemeralKeySecret:"sk_test_51JfOcKL28pDgfM8ZNcOgXcOau98OqZMoauV9Qq4fG06rsrHjL2olm4oIkd4DQCCuOh3079xJIo0t1KGNiv5c382L00ZNJHlCaU",

        ));


    await Stripe.instance.presentPaymentSheet();
  }

标签: flutterdartstripe-paymentspayment-gatewayflutter-dependencies

解决方案


推荐阅读