flutter-stripe / flutter_stripe

Flutter SDK for Stripe.
https://pub.dev/packages/flutter_stripe
961 stars 532 forks source link

ApplePay token makes the app literally freeze my app #1791

Closed louisbdc closed 5 months ago

louisbdc commented 6 months ago

Hello,

I am trying to add applePay. I use my Iphone 14 pro (128gb) because on simulator it doesn't work. And the app freeze because of this line below (line 221):

 TokenData tokenResult = await Stripe.instance.createApplePayToken(paymentMethod.toJson());

I did put a print before and after the line, of course the first line is displayed and not the second.

just after is my api call to the server, but the code doen't reach it ! And I need the token because i don't handle the backend

Link to the quick video where you can see my problem

Capture d’écran 2024-06-06 à 23 21 36
remonh87 commented 5 months ago

you stil need to confirm the payment intent.


    final params = PaymentMethodParams.cardFromToken(
        paymentMethodData: PaymentMethodDataCardFromToken(
          token: token.id,
        ),
      );

      // 3. Confirm Apple pay payment method
      await Stripe.instance.confirmPayment(
        paymentIntentClientSecret: clientSecret,
        data: params,
      );