#sergio_sanchez

1 messages · Page 1 of 1 (latest)

glossy quartzBOT
plush bough
#

Hello Toby

#

I can provide further context here

frail marsh
#

Hi there 👋 are you calling element.submit before stripe.confirmPayment? If so, can you share your code?

plush bough
#

yes of course, the thing is that we have having this issue with a case, and waht it happens we are telling to our customer to try again, as consequence, we are charging it multiple times by mistake

#

here is the code

#
      event.preventDefault();

      if (!stripe || !elements) {
        return;
      }

      // Trigger form validation and wallet collection
      const { error: submitError } = await elements.submit();

      if (submitError) {
        onRequestPaymentMethodError(submitError);
        return;
      }

      onPaymentValidationSuccess({ instrumentType: instrumentType.current });

      try {
        const { error } = await stripe.confirmPayment({
          elements,
          clientSecret: clientSecret || (await generateClientSecret()),
          confirmParams: {
            return_url: defineRedirectUrl({
              additionalQueryParams: { pricingId }
            }),
            payment_method_data: {
              billing_details: {
                email: user.email,
                name: user.fullname
              }
            }
          }
        });

        if (error) {
          onRequestPaymentMethodError(error);
        } else {
          // Your customer will be redirected to your `return_url`. For some payment
          // methods like iDEAL, your customer will be redirected to an intermediate
          // site first to authorize the payment, then redirected to the `return_url`.
        }
      } catch (error) {
        onRequestPaymentMethodError(error);
      }
    };````
#

we have seen that the cases face the issue of "elements.submit() must be called before stripe.confirmPayment().", so first question we have, when it happens, does confirmPayment return an error? confirmPayment will charge the payment intennt even when we have this error?

#

something useful here will be to force the error from our side (in test mode) in order to replica the case and to understand waht is happending, do you know if we have a way to force this error and see how is the behaviour?

frail marsh
#

I don't know if there is a way to force that error, I'm not sure what is causing it to begin with. Are you able to reproduce this behavior in your test site, and if so is that test site publicly accessible so I can take a closer look at your flow?

plush bough
#

The issue is that we are not able to reproduce this in test mode, because the error happens randomly

#

if it is useful I can provide you the case we have in production where in the same minute we have charge multiple times and where we have seen that the customer had this error if Integration Errir

frail marsh
#

Yeah, if you have the ID of a request where this behavior was seen, that may be helpful.

plush bough
#

we have already refunded two of them

frail marsh
#

I can't access your dashboard, can you provide IDs of objects?

plush bough
#

pi_3NXf1iIzcid8RrBH2tX5hLjC

#

pi_3NXf1cIzcid8RrBH1NU2ll2O

#

pi_3NXf1cIzcid8RrBH2oLJwJZ9

#

three payment intents in the same minutes, and we guess that for some of them we have the integration error

frail marsh
#

Thank you!

plush bough
#

actually we have another extra four PI created by this user in the same moment

#

pi_3NXf1kIzcid8RrBH0jmTkoAi

#

pi_3NXf1kIzcid8RrBH24lBWTpt

#

pi_3NXf1kIzcid8RrBH1SvRfl7V

#

pi_3NXf1kIzcid8RrBH1a8Whycc

#

these are incompleted

#

takeing a look to the logs we have:

#
  • 4 errors related to IntegrationError
#
  • 2 connection lost
frail marsh
#

Hm, nothing is jumping out at me so far. The first three all seem to have completed as expected, but the last 4 appear to have been created and then no other requests were made for them, or at least no requests reached us and were successfully parsed.

plush bough
#

ok! that is we have seen, but it seems that the combination of errors + how we are asking to our users to try again, is causing multiple charges

#

but we expected that if we have any of this errors, the pi keeps as incompleted, so no charge will be done

frail marsh
#

Hm, I'm not sure what to recommend to mitigate this without understanding what is causing the behavior you're seeing, which is difficult to do without knowing how to replicate that behavior.

plush bough
#

ok

#

thank a lot for your support in any case

#

we will take a look deeper, I wanted to ask you just in case that you have better logs for that

frail marsh
#

Any time, sorry I wasn't able to be of more help this time.