#PriceCzech-ach-failure

1 messages ยท Page 1 of 1 (latest)

terse folio
#

Hello ๐Ÿ‘‹
Give me a moment to catch up ๐Ÿ™‚

wispy hazel
#

Also of note, I have not activated my Stripe account (still just testing) - and I am using the iOS Simulator right now (haven't tried on a physical device).

terse folio
#

can you share an example SetupIntent ID for this?

#

can you also share the function code?

wispy hazel
#
const { setupIntent, error } = await collectBankAccountForSetup(client_secret, {
      paymentMethodData: {
        billingDetails: { email, name },
      },
      paymentMethodType: 'USBankAccount',
    });
#

client_secret, email, and name are all variables inside the function (just declaring them locally for now)

#

I'm wondering if I need to wrap that in a SetupIntent? (or something else on the screen?)

terse folio
#

are you using TypeScript or just javascript?

wispy hazel
#

TypeScript

#

(and SetupIntent is a type, not a component that I can wrap with)

terse folio
wispy hazel
#

That's what I'm using as a reference

terse folio
#

ah okay gotcha nvm ๐Ÿ˜„

wispy hazel
#

The JS documentation is similar, just not QUITE the same

terse folio
#

Facts. can you log the client_secret value before the function gets called?

wispy hazel
#

So in that example, it's trying to create a payment intent, not a setup, so not sure if there are differences there?

#

Yeah, I'm dumping everything to the console before calling, and they're all there.

terse folio
#

can you share that value?

wispy hazel
#

seti_1Kq6lGHzFqgByBuVboGkip5D_secret_LXB7NLkQkxnBYOfJkHiFfQ2BmeeufFs

terse folio
wispy hazel
#

It doesn't like that, either: localizedMessage: "You must provide a name when collecting US bank account details.", message: "You must provide a name when collecting US bank account details."

marble dagger
#

Hi there! Stepping in for @terse folio as they need to step away.

wispy hazel
#

(and TypeScript is showing errors when I try to drop the other info)

marble dagger
#

Indeed you need to provide a name

#

This is required for ACH PaymentMethods

wispy hazel
#

I had that before (and still have it on the screen)

#

so now it's back in there and I'm still getting my default error messages: localizedMessage: "The operation couldnโ€™t be completed (STPPaymentHandlerErrorDomain error 2.)" message: "There was an unexpected error -- try again in a few seconds"

marble dagger
#

Okay give me a minute to catch up on the whole thread here

wispy hazel
#

cool, thank you

marble dagger
#

What Stripe RN version are you on?

#

Can you also provide your account ID that you are testing on?

wispy hazel
#

67.4

marble dagger
#

Hmm that sounds like the React Native version but not Stripe React Native?

wispy hazel
#

sorry, just updated to 0.8.0

#

(was using 0.6.0, but had the same issue)

marble dagger
#

No problem, thanks for confirming.

#

I'd recommend deleting that as this is a public server

#

It looks like acct_xxxxx

wispy hazel
#

thanks, and the account ID is acct_1KMyH2HzFqgByBuV

marble dagger
#

Thanks.

#

Have you attempted to make any other React Native client-side requests? Like have you integrated any other flows?

#

It doesn't look like it on this account but wanted to verify

wispy hazel
#

no, most of the other stuff I have done from the server side

#

(creating the client_secret and stuff)

marble dagger
#

Gotcha. Would it be a lot of effort to integrate PaymentSheet real quick? Guide is here: https://stripe.com/docs/payments/save-and-reuse. I'm basically wondering if something in your project isn't playing nicely or if there is something specific to the ACH Setup

#

The code for PaymentSheet is pretty much all put together there in that guide and you should be able to use the endpoint you have already been testing with on your server

wispy hazel
#

yeah, I can do that... do I need the urlScheme in my initialization?

#

and if so, what should that look like?

marble dagger
#

No that shouldn't be necessary

wispy hazel
#

okay, cool

#

since I already have my customer ID, I'm guessing I need to implement that ephemeral key thing on my server first (before doing the client stuff?)

marble dagger
#

Yeah you would pass the ephemeral key from server to client along with customer and client secret

wispy hazel
#

getting my endpoint deployed, should be able to test soon

marble dagger
#

Beautiful

wispy hazel
#

accidentally took out apiVersion on the ephemeral key (thought I already had it in my instantiation) and it didn't like that, reploying

#

okay, so that popped up the sheet

marble dagger
#

Okay and can you attempt ACH Debit with that?

wispy hazel
#

I think I may have found the issue... I probably need to import the function from the useStripe implementation

marble dagger
#

Ohhh

#

Wow if that is the issue then I'm sad about the error message you received ๐Ÿ˜ฆ

wispy hazel
#

heh, well, it happens ๐Ÿ˜„

marble dagger
#

Haha yes, been there

wispy hazel
#

well, that does not fix it :/

marble dagger
#

Dang

#

Okay I have to step away but @magic zealot is going to step in here.

#

I'd recommend attempting ACH with Payment Sheet and seeing if you can complete it

wispy hazel
#

okay, cool, thanks for the help so far

#

okay, I'll play with that a bit more

marble dagger
#

If that hits the same error that will be indicative

#

Or if it doesn't...

wispy hazel
#

are there configuration options for presentPaymentSheet (I'm looking now, just thought you might have a quick reference)

magic zealot
#

HI ๐Ÿ‘‹
I am not familiar with any. I've only recently built an RN integration and I just use

const {error} = await presentPaymentSheet();
wispy hazel
#

looks like it's on the server side with the setupIntent, so I just configured that and I'll try it

magic zealot
#

Okay great

wispy hazel
#

heh, neat trick, it crashes the app

#

the loading sheet slides up and shows the loading indicator, then crashes

magic zealot
#

How are you configuring the Setup Intent?

wispy hazel
#
const setupIntent = await stripe.setupIntents.create({
      customer,
      payment_method_types: ['us_bank_account'],
    });
magic zealot
#

Yup, pretty straight forward

wispy hazel
#

(was working prior to adding that payment_method_types)

#

does it matter if this is on a simulator? (I would hope not, but should ask)

magic zealot
#

Shouldn't

#

You mean like a yarn android or yarn ios situation?

wispy hazel
#

yeah

#

harder to debug on a physical device, but I can try

#

(yarn ios --device doesn't find my phone)

magic zealot
#

Can you share the SetupIntent ID?

wispy hazel
#

didn't log it, but I can add that to a log and get that... one sec

#

"seti_1KtbaJHzFqgByBuVrn6SryWj"

#

heh, just needed to look in the stripe logs ๐Ÿ˜„

#

might need a return URL, since I hadn't gotten there yet

magic zealot
#

Also looking at your account you don't have ACH direct debit active as a payment method.

#

You. might need to turn that on

wispy hazel
#

okay, let me do that

#

and what's the difference between the two ACH methods?

magic zealot
#

ACH DD is the newest version

wispy hazel
#

okay, so probably prefer that

#

I turned it on in settings, can you verify that was the only switch I needed to flip?

magic zealot
#

Well let's try to create the Payment Sheet again.

wispy hazel
#

still crashes

#

anything else I need in there besides: const { error } = await initPaymentSheet({ customerId: customer, customerEphemeralKeySecret: ephemeralKey, setupIntentClientSecret: setupIntent, });

magic zealot
#

Is the setupIntent actually just the Secret? In my integration I return the full paymentIntent object so it looks like

paymentIntentClientSecret: paymentIntent.secret,
wispy hazel
#

from the server, yeah, it's just the secret

#

const { setupIntent, ephemeralKey, customer } = await response.json();

#

(that's getting it from server on the client)

#

and the server does this: return void res.status(200).json({ setupIntent: setupIntent.client_secret, ephemeralKey: ephemeralKey.secret, customer, });

#

should I set this stuff up on the server side and just pass through data? debating if I need anything from the RN side

#

(all I am trying to do is link a bank account to a customer - but they never need to see the stripe side of things)

magic zealot
#

True

#

I'm reaching out to my colleagues to see if we can understand why the Payment Sheet keeps crashing on you

wispy hazel
#

Cool. Appreciate it.

marble dagger
#

@wispy hazel sorry to keep you hanging like this. So a few things... first, apologies, I did not realize we actually have not released ACH for PaymentSheet yet so we can't test it on PaymentSheet. However, were you able to successfully set up a card with PaymentSheet? Second, can you share your podfile? Third, I'm building a repro on my end to see if I can hit the same error or determine what's going on.

#

I'm wondering if your Podfile isn't set up to target 12.0?

#

That is required for 0.6.0+

wispy hazel
#

Had to step away, but I'll check that stuff when I get back. I believe I had to bump my Podfile when I installed 0.6.0 (as it was set to 11.0 before).

marble dagger
#

Yeah okay wasn't sure if it would have required you to do that but makes sense that it wouldn't build otherwise.

#

At this point the best route here may be for you to write into our Support team with your Repo and then we can clone and figure out the bug here, whether it is on our end or yours.

#

Sorry this hasn't been easier to figure out... the ACH stuff on RN is pretty much brand new

wispy hazel
#

yeah, I figured as much (since it wasn't there before), and thought it would help me out, but I may just go through the server side

marble dagger
#

If you want to post your whole client side code here I can also take a look at that. I'm not having any issues with collectBankAccountForSetup in my repro

wispy hazel
#

can I create the ephemeral secret from the client side? or should I only do that from the server?

marble dagger
#

You can only create that from the server

wispy hazel
#

okay, that's fine... let me setup a parameter to enable/disable bank accounts from the setupIntent

wispy hazel
#

okay, so the CC flow appears to still work, but if I add that payment_method_types: ['us_bank_account'] on there, it crashes :/

marble dagger
#

With same error?

wispy hazel
#

so no errors, just completely kills the app

marble dagger
#

Uhh very weird

#

And metro doesn't show anything

wispy hazel
#

nope, nothing from that side

marble dagger
#

But when you run with a SetupIntent with just payment_method_types: ['card'] it works fine?

wispy hazel
#

I can see it initialize the payment popup, and the loading indicator starts, but when the content for the modal should appear, it crashes

#

if I leave off payment_method_types, it defaults to card and works

#

I can try explicitly to call with card if that helps?

marble dagger
#

No that shouldn't matter

#

Just wanted to clarify it worked fine with card

wispy hazel
#

doesn't crash, so a bit better ๐Ÿ˜‰

#

not sure if the crash log would help?

marble dagger
#

It could... I'm just so confused. This really shouldn't be crashing PaymentSheet. It would just ignore the us_bank_account type.

#

Testing on my end

#

I think there is something else going on with your project

#

That is doing somethign funny with us_bank_account for some reason

wispy hazel
#

I've obviously got other stuff in there for other parts of the app, but I just updated them (hoping it would fix the problem)

#

and I am about to bump react up to 18 and RN up to 68

marble dagger
#

If you are using stripe react.js we don't support React 18 I believe

#

But shouldn't matter for a RN app if that is what you are building

wispy hazel
#

yeah, it'll still be stripe-react-native

#

let me upgrade that (hopefully goes smoothly)

marble dagger
#

๐Ÿ‘

#

Oooh

#

Okay wait

#

For PaymentSheet you are just passing us_bank_account

#

This isn't supported so it crashes

#

If you pass ['card', 'us_bank_account'] then we just ignore us_bank_account

wispy hazel
#

heheh, yes that is the ONLY thing I am passing

marble dagger
#

Got it got it

#

Okay yeah I was able to repro that

#

We should really have it throw an error there...

#

Or at least a warning

#

Ugh

wispy hazel
#

well you can tell someone to add that to the next version ๐Ÿ™‚

marble dagger
#

There is definitely work being done to add ACH to Payment Sheet

#

Just not there yet

wispy hazel
#

okay, so is there a way to ONLY allow ACH?

marble dagger
#

Okay so let's go back to your collectBankAccountForSetup call

wispy hazel
#

(or create a link to the bank account to store later)

marble dagger
#

Yes, you were doing the right thing for that originally.

wispy hazel
#

that one still errored, but I'll pull it back up

marble dagger
#

I wanted to test Payment Sheet to determine whether your project wasn't liking Stripe

#

Or if it was specific to ACH Set up

#

And collectBankAccountforSetup

wispy hazel
#

now for this, it's only allowing me (because of TS) to use 'USBankAccount'

marble dagger
#

Can you share your full client-side code for this?

wispy hazel
#
{
  "code": "Failed",
  "localizedMessage": "The operation couldnโ€™t be completed. (STPPaymentHandlerErrorDomain error 2.)",
  "message": "There was an unexpected error -- try again in a few seconds",
  "declineCode": null,
  "type": null,
  "stripeErrorCode": null
}
#

there's the full error, let me grab the code

#

I just have a text input and button on the screen with the button doing:

const { setupIntent, error } = await collectBankAccountForSetup(client_secret, {
      paymentMethodData: {
        billingDetails: { email, name },
      },
      paymentMethodType: 'USBankAccount',
    });
#

I can cleanup and get the full TSX file if needed?

marble dagger
#

One sec

#

Before full code, can you hardcode a client secret in there and hard code a name and remove email and try that?

#

That looks totally fine to me

wispy hazel
#

yeah, same error

marble dagger
#

Okay then yeah full code is next step

wispy hazel
#

leave the client_secret in there?

marble dagger
#

Sure it isn't sensitive

wispy hazel
#
import React, { useState } from 'react';
import { ScrollView } from 'react-native';
import { Button, TextInput } from 'react-native-paper';
import { SpacerV } from '../config/theme';
import { ContentView, Screen } from '../components';
import { ProfileScreenProps } from '../AppNavigation';
import { useStripe } from '@stripe/stripe-react-native';
import { useSelector } from 'react-redux';
import { selectAuthUser } from '../redux/authSlice';

const ProfileBank = ({ route: { params: { id } } }: ProfileScreenProps<'ProfileAddress'>): JSX.Element => {
  const { collectBankAccountForSetup } = useStripe();
  const user = useSelector(selectAuthUser);
  const [name, setName] = useState('');

  const linkBank = async () => {
    const client_secret = 'seti_1Kq6lGHzFqgByBuVboGkip5D_secret_LXB7NLkQkxnBYOfJkHiFfQ2BmeeufFs';
    const email = user?.email;
    console.log('???', client_secret, email, name);
    const { setupIntent, error } = await collectBankAccountForSetup(client_secret, {
      paymentMethodData: {
        billingDetails: { name },
      },
      paymentMethodType: 'USBankAccount',
    });
    console.log('setupIntent:', setupIntent, JSON.stringify(error, null, 2));
  };

  return (
    <Screen>
      <ScrollView>
        <ContentView>
          <SpacerV spacing={3} />
          <TextInput label="Name" onChangeText={setName} value={name} />
          <SpacerV spacing={6} />
          <Button onPress={linkBank}>Link Bank</Button>
        </ContentView>
      </ScrollView>
    </Screen>
  );
};

export default ProfileBank;
marble dagger
#

Okay instead of initializing collectBankAccountForSetup from useStripe, let's just import it from Stripe-React-Native alongside useStripe

wispy hazel
#

do I even need to call useStripe, then?

marble dagger
#

No you shouldn't for this

wispy hazel
#

same error

marble dagger
#

The log fires before the method right?

#

Like where you are logging ???

wispy hazel
#

yup

marble dagger
#

Okay let's try slimming down the component. So basically just make a new component of const Test and just put the Stripe stuff inside that. Then comment out the other component

wispy hazel
#

will do

marble dagger
#

Just use a <View> and a <button>

#

Let's hard code the name for now

#

Ah one more thing.... Can you share your StripeProvider Component code

#

You are wrapping this component inside of that, correct?

wispy hazel
#

no, I am just using the initStripe

#

sounds like I still need that even with the hook?

marble dagger
#

Ah yeah you do.

#

Because you have to pass your publishable key

#

Wait actually

#

I could be wrong

#

Yeah okay I think initStripe should work too... but can you share that code

#

I would try swapping the with StripeProvider just to see if there is a weird bug going on with initStripe and this new ACH method

#

I'm testing mine with StripeProvider

#

I can also test with initStripe

#

That said.... if PaymentSheet was working then I don't really think this should be the issue

wispy hazel
#

I can try it with a provider, but I gotta head out for a bit

#

thank you for helping, and I'll pick back up when I'm online again

marble dagger
#

๐Ÿ‘

marble dagger
#

Ahaaaa

#

Was playing around with this a little more because I had another thought

#

And when I mismatch my keys (server secret key and client publishable key) I hit this exact error

#

I also missed that you aren't catching your error when you call collectBankAccountForSetup... if you log out error right after that I would expect your to see an error message that says invalid API key...

#

When you come back around, I'd check your keys and add a log to catch the error!