#facu_reactnative-ach

1 messages ¡ Page 1 of 1 (latest)

tacit fableBOT
#

👋 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.

dusk raft
#

facu_reactnative-ach

#

@junior sierra Can you share the exact code you are using in your React Native app?

junior sierra
#

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',
  });
}

};

dusk raft
junior sierra
#

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

dusk raft
#

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.

junior sierra
#

Ok, I'm going to try it and I'll ask you again if I have any questions. Thank you so much

dusk raft
#

Sure thing, you'll see it's much easier because it just works and you can add more payment methods in the future!