flutter_stripe icon indicating copy to clipboard operation
flutter_stripe copied to clipboard

collectBankAccount returns PlatformException

Open chilimsv opened this issue 2 years ago • 3 comments

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 protected]',
        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

chilimsv avatar Nov 01 '23 17:11 chilimsv

Hey @chilimsv any update on the above issue?

xkxeeshankhan avatar Nov 16 '23 10:11 xkxeeshankhan

Hey @chilimsv any update on the above issue?

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

chilimsv avatar Nov 16 '23 10:11 chilimsv

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?

lukatommy avatar Apr 23 '24 07:04 lukatommy