#PriceCzech-ach-failure
1 messages ยท Page 1 of 1 (latest)
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).
can you share an example SetupIntent ID for this?
can you also share the function code?
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?)
are you using TypeScript or just javascript?
Gotcha.
Comparing your example code with the docs here
https://stripe.com/docs/js/setup_intents/collect_bank_account_for_setup
It seems like all the parameters that you're passing in should be part of options object
That's what I'm using as a reference
ah okay gotcha nvm ๐
The JS documentation is similar, just not QUITE the same
Facts. can you log the client_secret value before the function gets called?
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.
can you share that value?
seti_1Kq6lGHzFqgByBuVboGkip5D_secret_LXB7NLkQkxnBYOfJkHiFfQ2BmeeufFs
Ah there we go
The way your SetupIntent was created, it would only support card payment method type
You'd likely want to follow this guide instead of the one that you're currently following
https://stripe.com/docs/payments/ach-debit/set-up-payment?platform=react-native
Your server would need to create the SetupIntent by like this to support us_bank_account payment type
https://stripe.com/docs/payments/ach-debit/set-up-payment?platform=react-native#react-native-create-client-secret
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."
Hi there! Stepping in for @terse folio as they need to step away.
(and TypeScript is showing errors when I try to drop the other info)
Indeed you need to provide a name
We show that you need a name TextInput: https://stripe.com/docs/payments/ach-debit/set-up-payment?platform=react-native#react-native-collect-payment-method-details
This is required for ACH PaymentMethods
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"
Okay give me a minute to catch up on the whole thread here
cool, thank you
What Stripe RN version are you on?
Can you also provide your account ID that you are testing on?
67.4
Hmm that sounds like the React Native version but not Stripe React Native?
No problem, thanks for confirming.
I'd recommend deleting that as this is a public server
You can grab your account ID in the top right of your Dashboard here: https://dashboard.stripe.com/settings/account
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
It looks like acct_xxxxx
thanks, and the account ID is acct_1KMyH2HzFqgByBuV
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
no, most of the other stuff I have done from the server side
(creating the client_secret and stuff)
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
yeah, I can do that... do I need the urlScheme in my initialization?
and if so, what should that look like?
No that shouldn't be necessary
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?)
Yeah you would pass the ephemeral key from server to client along with customer and client secret
getting my endpoint deployed, should be able to test soon
Beautiful
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
Okay and can you attempt ACH Debit with that?
I think I may have found the issue... I probably need to import the function from the useStripe implementation
Ohhh
Wow if that is the issue then I'm sad about the error message you received ๐ฆ
heh, well, it happens ๐
Haha yes, been there
well, that does not fix it :/
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
are there configuration options for presentPaymentSheet (I'm looking now, just thought you might have a quick reference)
HI ๐
I am not familiar with any. I've only recently built an RN integration and I just use
const {error} = await presentPaymentSheet();
looks like it's on the server side with the setupIntent, so I just configured that and I'll try it
Okay great
heh, neat trick, it crashes the app
the loading sheet slides up and shows the loading indicator, then crashes
How are you configuring the Setup Intent?
const setupIntent = await stripe.setupIntents.create({
customer,
payment_method_types: ['us_bank_account'],
});
Yup, pretty straight forward
(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)
yeah
harder to debug on a physical device, but I can try
(yarn ios --device doesn't find my phone)
Can you share the SetupIntent ID?
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
Also looking at your account you don't have ACH direct debit active as a payment method.
You. might need to turn that on
ACH DD is the newest version
okay, so probably prefer that
I turned it on in settings, can you verify that was the only switch I needed to flip?
Well let's try to create the Payment Sheet again.
still crashes
anything else I need in there besides: const { error } = await initPaymentSheet({ customerId: customer, customerEphemeralKeySecret: ephemeralKey, setupIntentClientSecret: setupIntent, });
Is the setupIntent actually just the Secret? In my integration I return the full paymentIntent object so it looks like
paymentIntentClientSecret: paymentIntent.secret,
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)
True
I'm reaching out to my colleagues to see if we can understand why the Payment Sheet keeps crashing on you
Cool. Appreciate it.
@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.
Also I just noticed something, your app is crashing before it even hits collectBankAccountForSetup since it would have errored in the past with the type param when you were on 0.6.0. That was changed to paymentMethodTypein 0.8.0: https://github.com/stripe/stripe-react-native/blob/master/CHANGELOG.md#080
I'm wondering if your Podfile isn't set up to target 12.0?
That is required for 0.6.0+
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).
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
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
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
can I create the ephemeral secret from the client side? or should I only do that from the server?
You can only create that from the server
okay, that's fine... let me setup a parameter to enable/disable bank accounts from the setupIntent
okay, so the CC flow appears to still work, but if I add that payment_method_types: ['us_bank_account'] on there, it crashes :/
With same error?
so no errors, just completely kills the app
nope, nothing from that side
But when you run with a SetupIntent with just payment_method_types: ['card'] it works fine?
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?
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
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
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
yeah, it'll still be stripe-react-native
let me upgrade that (hopefully goes smoothly)
๐
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
heheh, yes that is the ONLY thing I am passing
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
well you can tell someone to add that to the next version ๐
There is definitely work being done to add ACH to Payment Sheet
Just not there yet
okay, so is there a way to ONLY allow ACH?
Okay so let's go back to your collectBankAccountForSetup call
(or create a link to the bank account to store later)
Yes, you were doing the right thing for that originally.
that one still errored, but I'll pull it back up
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
now for this, it's only allowing me (because of TS) to use 'USBankAccount'
Can you share your full client-side code for this?
{
"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?
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
yeah, same error
Okay then yeah full code is next step
leave the client_secret in there?
Sure it isn't sensitive
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;
Okay instead of initializing collectBankAccountForSetup from useStripe, let's just import it from Stripe-React-Native alongside useStripe
do I even need to call useStripe, then?
No you shouldn't for this
same error
yup
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
will do
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?
no, I am just using the initStripe
sounds like I still need that even with the hook?
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
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
๐
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!