#Jasuno

1 messages ยท Page 1 of 1 (latest)

untold gulchBOT
normal apex
#

hey there, how are you triggering this confirmation? Can you share your client code and the call that leads to this?

modest jungle
#

const processPayment = async () => {
let response;
if (paymentRef.current.payWithBank) {
response = await paymentRef.current.payWithBank();
}
if (paymentRef.current.payWithCard) {
response = await paymentRef.current.payWithCard();
}

const { error, setupIntent } = response || {};

if (error) {
  return toast({
    title: "Error",
    position: "top-right",
    description: error.message,
    status: "error",
    duration: 5000,
    isClosable: true,
  });
} else {
  if (response?.setupIntent && paymentIntent) {
    await confirmPayment({
      payment_intent_id: paymentIntent?.id,
      payment_method: setupIntent?.payment_method,
    });
  }

  if (
    response?.isAutoChargeEnabled &&
    invoice?.lines?.data[0]?.subscription
  ) {
    await setDefaultPaymentMethod({
      subscription_id: invoice.lines.data[0].subscription,
      payment_method: setupIntent?.payment_method,
    });
  }
  toast({
    title: "Success",
    position: "top-right",
    description: "Your payment was processed successfully",
    status: "success",
    duration: 5000,
    isClosable: true,
  });
  router.push(TenantRouterPaths.PAYMENTS);
}

};

#

and this is whats going on in confirm payment intent

#

const { payment_intent_id, payment_method } = data;

const payment = await stripe.paymentIntents.confirm(payment_intent_id, {
payment_method: payment_method,
});

return payment;

#

this is in the backend

untold gulchBOT
modest jungle
#

Hello?

tall tusk
#

Hello ๐Ÿ‘‹
Give me a moment to take a look

modest jungle
#

Ok thanks

normal apex
modest jungle
#

So the process is that we first set up the payment method and then we use that payment method and the we use the payment method id to process the transaction

tall tusk
#

Can you try removing verification_method: "instant" from SetupIntent creation?

modest jungle
#

we are trying to use the verification_method: "instant" to bypass the micro transactions which take a long time this is the way i was told to do that after a few conversations here and with customer support

tall tusk
#

I see. Hmm ๐Ÿค”

modest jungle
#

I can link the other conversations if you like

tall tusk
#

All good. Can you confirm if omitting the parameter fixes the error?
I'll look around to see if this is expected behaviour or not

modest jungle
#

It probably will since thats what caused the error, it was working fine before

tall tusk
#

Can you share the code you're using to Setup the payment method?

I don't see it above

modest jungle
#

here it is without the verification methos

#
  const userId = context.auth?.uid;
    const UserSecret = (
      await admin
        .firestore()
        .collection("collection")
        .doc(userId || "")
        .get()
    ).data() as UserPrivate;

    const setupIntent = await stripe.setupIntents.create({
      customer: UserSecret.stripeCustomerId,
      payment_method_types: ["acss_debit", "card"],
      payment_method_options: {
        acss_debit: {
          currency: "cad",
          mandate_options: {
            payment_schedule: "interval",
            interval_description:
              "Same day every month since the start of the lease agreement",
            transaction_type: "business",
          },
        },
      },
    });

    return setupIntent.client_secret;
  }
tall tusk
#

And the code that confirms the SetupIntent client-side?

modest jungle
#

No that just create the client token to be used, the setup stuff are being done by stripe.js which is in the client side code i sent earlier

tall tusk
#

for SetupIntents, you'd need to use confirmSetup(...) function and not confirmPayment

#

I don't see a confirmSetup call in the code you've shared thus far

modest jungle
#

Oooooh ok yeah i forgot to send that give me a sec

#

thats here

 const onSubmit = async (values: {
      accountNumber: string;
      institutionNumber: string;
      transitNumber: string;
    }) => {
      const stripe = await stripePromise;
      const bankData = {
        payment_method: {
          acss_debit: {
            account_number: values.accountNumber,
            institution_number: values.institutionNumber,
            transit_number: values.transitNumber,
          },
          billing_details: {
            email: authData?.email || "",
            name: authData?.displayName || "",
          },
        },
      };

      const response = await stripe?.confirmAcssDebitSetup(clientKey, bankData);
      return {
        ...response,
        isAutoChargeEnabled: true,
      };
    };
tall tusk
#

Hmm, okay! let me see if I can reproduce this on my end..

modest jungle
#

perfect thanks

#

sorry for the complications by the way

tall tusk
#

All good, I was able to reproduce this on my end

#

Looks like we're testing this flow incorrectly

#

You shouldn't be passing payment_method.acss_debit hash when calling confirmAcssDebitSetup

#

If you omit that, financial connections UI should take over and collect that information for you

modest jungle
#

Here is the thing we are in canada so finacial connections are not supported here which was the problem i had in my first thread

tall tusk
#

OH I see

untold gulchBOT
modest jungle
#

Lol this escalated

tall tusk
#

My understanding is that we do support Financial Connections in Canada

Can you share the link to the previous thread where you were told we don't?

modest jungle
tall tusk
#

thanks, can you quickly give financial connections a try?

#

Financial Connections has many different components apart from just verification

#

Some of it are US only

#

However, ACSS verification should work

#

try omitting

            account_number: values.accountNumber,
            institution_number: values.institutionNumber,
            transit_number: values.transitNumber,
          },```
modest jungle
#

I did, you can see here req_3TutVnG6JyEURl when i tried to create the client token if throws an error

tall tusk
#

Ah you don't need to create a session separately.

confirmAcssDebitSetup would handle this automatically

modest jungle
#

interesting, but confirmAcssDebitSetup takes a client id as the first param i believe

tall tusk
#

It would take a SetupIntent client-secret

#

So the same exact code you currently have should work if you just remove following

            account_number: values.accountNumber,
            institution_number: values.institutionNumber,
            transit_number: values.transitNumber,
          },```
modest jungle
#

ok give me one sec ill try that out

tall tusk
#

๐Ÿ‘

modest jungle
#

THAT WORKS ๐ŸŽ‰๐ŸŽŠ thanks been at this all day you are like the 4th support person i talked to

tall tusk
#

Glad it worked ๐Ÿ™‚
Apologies for the confusion earlier.

modest jungle
#

No don't worry about it everyone i spoked to was really nice and tried their best, i guess there was missing context, but thank you all so much

tall tusk
#

NP! Happy to help

modest jungle
#

the funny to think that the problem was removing 3 lines ๐Ÿ˜‚

tall tusk
#

Haha its always something minor that takes a while. Big issues have simpler solutions.

#

Anyways I have to step away now but @unique torrent can help if you have any follow ups