#facu_reactnative-ach
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1250842555222851645
đ Have more to share? Add details, code, screenshots, videos, etc. below.
facu_reactnative-ach
@junior sierra Can you share the exact code you are using in your React Native app?
yes, give me a minute
The problem is in the validation of the ACH, currently cards is ok, but is there a way to validate the ACH automatically without sending an email to the user?
this is my current code to add ACH payment method
const handleAddPaymentMethod = async (data: {
accountNumber: string;
fullName: string;
routingNumber: string;
}) => {
try {
setLoading(true);
// ===== Create a "SETI_ID" from stripe ===== //
const createIntent = await getStripeIntentForNewPaymentMethod();
// ===== Add this new Payment Method to stripe user ===== //
const {error, setupIntent} = await confirmSetupIntent(createIntent.stripeClientSecret, {
paymentMethodType: 'USBankAccount',
paymentMethodData: {
accountNumber: data.accountNumber,
billingDetails: {
name: data.fullName,
},
routingNumber: data.routingNumber,
},
});
if (error) {
Toast.show({
type: 'error',
text1: 'An error occurred, check the data or try again later',
});
setLoading(false);
} else if (setupIntent) {
// ===== Update the payment method in our DB ===== //
await updatePaymentMethod({
paymentMethodUuid: createIntent.uuid,
stripeId: setupIntent.paymentMethod?.id as string,
});
// ===== Get all payment methods from DB ===== //
dispatch(actionGetAllPaymentMethods());
Toast.show({
type: 'success',
text1: 'Payment method added successfully',
});
closeBottomSheet();
setLoading(false);
}
} catch (error) {
setLoading(false);
Toast.show({
type: 'error',
text1: 'An error occurred, check the data or try again later',
});
}
};
yeah that is the problem. You seem to be collecting raw bank account details yourself in your own UI and then calling confirmSetupIntent with it.
That's not what you should do. You should use our PaymentSheet UI for this that will automatically do the same as web. Follow those docs: https://docs.stripe.com/payments/accept-a-payment?platform=react-native
Sure, but the problem is that I don't want to accept a payment, I simply want to save the payment method, with cards I use this
the component
<CardField
ref={testRef}
from Stripe
It works the exact same way with a SetupIntent. So really, replace your older integration with CardField and move to PaymentSheet and let us collect card details, bank account details and in the future other details.
You can follow this guide if you prefer: https://docs.stripe.com/payments/save-and-reuse?platform=react-native&mobile-ui=payment-element it's specifically for SetupIntents
Ok, I'm going to try it and I'll ask you again if I have any questions. Thank you so much
Sure thing, you'll see it's much easier because it just works and you can add more payment methods in the future!