Skip to content

Get Unhandled Exception: PlatformException when try to use Stripe.instance.presentPaymentSheet #130

Closed
@Mikhail-Ivanou

Description

@Mikhail-Ivanou

Describe the bug
I get next error when try to use Stripe.instance.presentPaymentSheet both in Android and iOS.
The same issue was reproduced both in my project and in sample

E/flutter ( 1124): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: PlatformException(Failed, , null, null)
E/flutter ( 1124): #0 JSONMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:155:7)
E/flutter ( 1124): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)
E/flutter ( 1124):
E/flutter ( 1124): #2 MethodChannelStripe.presentPaymentSheet (package:stripe_platform_interface/src/method_channel_stripe.dart:181:5)
E/flutter ( 1124):
E/flutter ( 1124): #3 Stripe.presentPaymentSheet (package:flutter_stripe/src/stripe.dart:268:5)
E/flutter ( 1124):
E/flutter ( 1124): #4 CampContent.build.. (package:
_/ui/detail/checkout_screen.dart:58:11)
E/flutter ( 1124):

To Reproduce
Steps to reproduce the behavior:

  1. Setup stripe, generate "paymentIntentClientSecret"
  2. Init Stripe.instance.initPaymentSheet:
    await Stripe.instance.initPaymentSheet(
    paymentSheetParameters: SetupPaymentSheetParameters(
    applePay: true,
    googlePay: true,
    style: ThemeMode.dark,
    testEnv: true,
    merchantCountryCode: 'DE',
    merchantDisplayName: 'Flutter Stripe Store Demo',
    paymentIntentClientSecret: '%paymentIntentClientSecret%',
    ),
    );
  3. Call await Stripe.instance.presentPaymentSheet(
    parameters: PresentPaymentSheetParameters(
    clientSecret: '%paymentIntentClientSecret%',
    confirmPayment: true,
    ));

Expected behavior
User see correct payment modal sheet

Smartphone / tablet

  • Device: iPhone 8+ emulator, pixel 3a emulator
  • OS: iOS 14, Android 11
  • Package version: 1.0.2
  • Flutter version: 2.2.1

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions