flutter-stripe / flutter_stripe

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

collectBankAccount returns PlatformException #1467

Open chilimsv opened 1 year ago

chilimsv commented 1 year ago

Describe the bug Calling collectBankAccount on both iOS and Android returns PlatformException(Invalid Params, , , null)

To Reproduce Call this function

 const billingDetails = BillingDetails(
        name: 'Flutter Stipe',
        email: 'email@stripe.com',
        phone: '+48888000888',
        address: Address(
          city: 'Houston',
          country: 'US',
          line1: '1459  Circle Drive',
          line2: 'S',
          state: 'Texas',
          postalCode: '77063',
        ),
      );
      await Stripe.instance.collectBankAccount(
        isPaymentIntent: true,
        clientSecret: paymentInfo.clientSecret,
        params: const CollectBankAccountParams(
          paymentMethodType: PaymentMethodType.USBankAccount,
          billingDetails: billingDetails,
        ),
      );

This is returned:

[   +1 ms] flutter: PlatformException(Invalid Params, , , null)
[        ] flutter: 
           #0      JSONMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:171:7)
           #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
           <asynchronous suspension>
           #2      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:510:43)
           <asynchronous suspension>
           #3      MethodChannelStripe.collectBankAccount (package:stripe_platform_interface/src/method_channel_stripe.dart:429:20)
           <asynchronous suspension>
           #4      Stripe.collectBankAccount (package:flutter_stripe/src/stripe.dart:583:12)
           <asynchronous suspension>

Expected behavior I expect a modal to show up to collect bank details after calling this method with required parameters

Package version: flutter_stripe: 9.5.0+1 Flutter version: stable, 3.13.0

Additional context Is this the wrong usage or a bug? Every parameter is filled

xkxeeshankhan commented 12 months ago

Hey @chilimsv any update on the above issue?

chilimsv commented 12 months ago

Hey @chilimsv any update on the above issue?

No luck. Decided to collect the bank details on our client side as a workaround

lukatommy commented 6 months ago

Hey, any update on this? collectBankAccount still doesn't work.

I've found 2 problems:

  1. Flutter plugin send 'isPaymentIntent':isPaymentIntent and ios side use wrong key let isPaymentIntent = arguments["intentType"] as? Bool,

  2. Flutter plugin send as params CollectBankAccountParams parsed to json and both ios and android side try to extract this by paymentMethodData which is not in that model.

What with this draft PR?