#desa-paymentelement-ach

1 messages ยท Page 1 of 1 (latest)

proud groveBOT
coarse stag
#

๐Ÿ‘‹ I'm not sure I grasph what you are describing. You should ~never have a PaymentElement that does a SetupIntent and immediately after does a PaymentIntent so it feels like you might have approached the flow incorrectly

#

desa-paymentelement-ach

thorn bluff
#

We're basically just using the store and reuse

#

So it seems like something people do

coarse stag
#

You shouldn't do that at all if you are creating a payment immediately after though

proud groveBOT
thorn bluff
#

Pay and reuse*

#

What should i be doing? I want to store the method a user adds when paying..

#

here is some of our handlesubmit logic: ```const handleSubmit = async (e) => {
e.preventDefault();
if (!stripe || !elements) {
return;
}
setIsLoading(true);
const { error, setupIntent } = await stripe.confirmSetup({
elements,
confirmParams: {
return_url: process.env.NEXT_PUBLIC_SITE_URL,
},
redirect: 'if_required',
});

if (error) {
  if (error.type === 'card_error' || error.type === 'validation_error') {
    setMessage(error.message);
  } else {
    setMessage(
      'There was an error processing your payment. You have not been charged. Refresh the page and try again.',
      error
    );
  }
  setIsLoading(false);
}
if (setupIntent && setupIntent.payment_method) {
  await createPaymentMethod(paymentMethodType, setupIntent.payment_method);
  setMessage('Your payment method was successfully set up.');
  await updateUserInputShippingAddress();
  await processPayment(setupIntent.payment_method).then(() => {
    setIsLoading(false);
  });
}

};```
basically we just want to have a different submit flow if we are waiting for a manual bank account to be verified, since it was just added, everything else works fine, i just want to know if there is a way to get the type of bank account linking you're doing out of the payment element, so i can change the submit from attempting a payment, to only linking and awaiting verification.

calm ivy
#

Hey there, just taking over and catchign up - give me a few minutes to read

#

Ok so, as koopa mentioned this is really something you should be deciding up front, and you can only tell the difference after the fact

#

Whether the flow is instant or delayed shouldn't affect your ability to setup vs pay, but the payment might be delayed

thorn bluff
#

I'm really just looking to get state information out of the paymentelement so i can adjust the text inside the 'pay now' button to be 'link' or something of the like. I basically just need to know the verification type, since I've already added a catch inside the submit function to read the setupIntent for the next step : if (setupIntent && setupIntent.payment_method) { console.log('setupIntent', setupIntent) await createPaymentMethod(paymentMethodType, setupIntent.payment_method); setMessage('Your payment method was successfully set up.'); await updateUserInputShippingAddress(); if(setupIntent.status === 'requires_action') { setMessage('Check Your Email to Confirm Your Payment Method') setIsLoading(true); } else{ await processPayment(setupIntent.payment_method).then(() => { setIsLoading(false); }); } }
Which yes, the setupIntent is a response after the fact.

calm ivy
#

For manual entry, that's null -- it's only populated when the customer used the bank connection flow

thorn bluff
#

i see

proud groveBOT
calm ivy
#

Do you need anything else here, then?