#harshit-paymentelement-applepay

1 messages · Page 1 of 1 (latest)

acoustic mountainBOT
full valve
#

@shy field do you have more details? What do you call "dev" as an environment?

shy field
#

I am getting this error

#

By dev I mean staging env

full valve
#

You're going to have to debug this as a developer, look at the JS console, the logs, the network tab, etc.

shy field
#

I have checked there is no error

#

Can we setup a call on tuesday or wednesday.. just ti check what is happening exactly

#

??

full valve
#

No we don't do calls

shy field
#

The above error i am getting from stripe itself

#

Can you please help me with that

full valve
#

I'm trying, you need to provide a lot more actionable information. Your exact code, how you handle errors, why you think this is a Stripe-specific error (as that UI modal thing with the error is not a Stripe thing)

#

harshit-paymentelement-applepay

shy field
#

const { error } = await stripe.confirmPayment({

    elements,

    confirmParams: {

      return_url: process.env.REACT_APP_URL + "/driver/confirmation",

    },

  });

  if (error) {

    dispatch(loaderActions.show({ show: false }));

    if (error.type !== "validation_error")

      dispatch(            messageActions.show({

          openPopup: true,

          messageBody: CD_TOLL_PAYMENT_FAILED_SUB_LABEL,

          messageHeader: CD_TOLL_PAYMENT_FAILED_LABEL,

          type: "",

          showClose: true,

        })

      );

    }
#

This is the code which I am using

#

So it is going on error and we are printing exact error what is coming from stripe directly

full valve
#

So not really right? You get an error in if(error) and then you ignore that error entirely and log your own text

#

Try logging the exact error you get in that part of the code, like log the whole error object

shy field
#

Yes we have done the same thing what you are saying

#

Thats why in the abice screenshot you are able to see that error

#

I have taken the screenshot after modifying the code

full valve
#

But then why share a different code? Sorry I'm confused

#

and the error is truncated and unreadable

#

can you please log the exact error and then share that exact error in text here?

shy field
#

In the above screenshot the message object is exactly what we are getting from stripe

full valve
#

Yeah sorry I'm really trying to help you. I asked for code but you shared different code than the picture. I asked for the exact error message but you said "it's in the picture"

#

Please try and do a little of extra work to make it easier for me to help you. Please copy-paste the exact error message in text in this chat. And please share the exact code that maps to that picture

shy field
#

Something went wrong. Unable to show Apple Pay. Please choose a different payment method and try again.

#

This is the error

wintry tree
#

👋 jumping in to help as things are getting busy.

To be clear, the error returned by stripe.confirmPayment({...}) is what you're printing in the modal?

shy field
#

In the above body you can see messageBody: CD_TOLL_Payment_failed _label

We have modified that in our code and printing the exact error what is coming from stripe and apart from that code is same

#

Yes

wintry tree
#

Is the page you're testing this on, live? If so, can you share the URL?

shy field
#

Yes it is live but due to company policy i cant share

#

I can provide you account id

wintry tree
#

I mean we can't do much with just the account ID as we'll need to look at the exact instance where this is happening.
We can only speculate which won't help much.

shy field
#

We can setup a meeting, it will be really helpful

wintry tree
#

As mentioned earlier, that's not something our team offers. If you can't share the URL publicly, you can DM it to me or post here and delete.
If none of those work for you then you'd likely need to work with our support team via
https://support.stripe.com/?contact=true

In the picture you shared, the screenshot is from an iPhone, have you tested the site on a mac or a different device?

shy field
#

I have tested that in iphone safari browser

shy field
wintry tree
#

How exactly did you check the client-side logs?

Fwiw, here's a great resource that would let you debug websites on an iOS device
https://www.browserstack.com/guide/how-to-debug-on-iphone

It is quite un-natural for the SDK operation to fail without an error. Would recommend double checking the client-side logs for any wallet issues.

shy field
#

But same code is working in different environments. Hiw?

#

How*?

wintry tree
#

That's indeed weird, which is why we need to look at the exact example where you're seeing this issue. Without that, there's not much we can do.

shy field
#

Ok

wintry tree
#

Additionally, one more thing I'd recommend checking is if there are any different environment variables you're setting in your QA/Prod environments versus Dev which might be affecting this

shy field
#

No everything is same

#

And we have setup the apple pay at stripe end also

wintry tree
#

can you share the account ID?

shy field
#

For all env

#

Yea give me second

#

For every env the account id is same

wintry tree
#

Your domain registration looks fine. Do you have test license plate number that can help me get to the checkout page?

shy field
#

Right now i dont have

#

Let me check

wintry tree
#

yup that worked

acoustic mountainBOT
wintry tree
#

looking at the error in the console
IntegrationError: The code that shows the Apple Pay payment sheet must be invoked directly by a user activation event, like a click or a touch gesture. To prevent this error make sure the code that shows the payment sheet is at or near the top of your user gesture event handler, before any async or long-running code.

#

Can you share the code that calls stripe.confirmPayment(...)

shy field
#

The code that I have shared

#

Is the exact code

wintry tree
#

No. You only shared confirmPayment(...) function.

You haven't shared the code that triggers a confirmPayment call (code that calls stripe.confirmPayment

#

Like the code that configures and runs when clicking on "Pay" button

shy field
#

Right now i dont have access to UI code, the UI developer is on leave

wintry tree
#

stripe.confirmPayment needs to be called from an event listener/handler.

I have a feeling your app calls this function some other way

#

which is triggering this error

shy field
#

But we are calling the same code in qa and pre prod and there it is working fine

wintry tree
#

Also I'm seeing some different error on the page (not the one you're seeing)

#

So yeah this means that there has to be some differences between the code thats running on your dev vs other env

shy field
#

We have deployed our code

#

With hard coded text

#

But to see what error we are getting we just replace the hardcoded text with stripe error

wintry tree
#

Not sure what you mean by that. but I also see

{type: "invalid_request_error", message: "Something went wrong. Unable to show Apple Pay. Pl… choose a different payment method and try again."} in the console after

IntegrationError: The code that shows the Apple Pay payment sheet must be invoked directly by a user activation event, like a click or a touch gesture. To prevent this error make sure the code that shows the payment sheet is at or near the top of your user gesture event handler, before any async or long-running code.

#

so I'm quite sure that's related

#

There must be some differences in the way confirmPayment is being called from different environments

shy field
#

Can you remove above pic

wintry tree
#

sure

shy field
#

I will check with my UI developer

wintry tree
#

I'd recommend working with the UI developer and inspecting the code thoroughly

#

yeah

#

that's likely the best option

shy field
#

But as far as we know we deploy the same code

#

Everywhere

#

So there will be no difference in the way we are calling confirmPayment

#

But for googlePay it is working fine

#

In all env

wintry tree
#

We'll need to take a look at more code than what you've shared thus far to confirm there are no differences.

My best guess is that confirmPayment isn't being called directly inside the event handler for button click or form submit and is probably being called from a hook/diff function.

I'm definitely speculating since I haven't looked at your complete code but the difference here could be the latency (dev servers generally have higher latency than QA/prod servers).

#

So the hook/function might be performing faster on QA/Prod

#

which then avoids getting detected as an IntegrationError

shy field
#

Ok ok got it

wintry tree
#

I'd highly recommend double checking the code with your UI dev to make sure that the function is being called from the event handler

shy field
#

Ok sure

wintry tree
#

I looked at your script code from the browser, it seems minified but has the confirmPayment calls inside a switch case

#

so most likely it is being invoked inside a reducer