#primo_paymentelement-applepay

1 messages ¡ Page 1 of 1 (latest)

jovial remnantBOT
#

👋 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/1260350319628386314

📝 Have more to share? Add details, code, screenshots, videos, etc. below.

fierce geodeBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

calm hound
#

Hi there

#

Do you have a link to an environment where I can reproduce this?

next abyss
calm hound
#

Tried to implement token merchant flow
Can you share a link to any docs you're following for this?

next abyss
#

Just go through the flow, selectin anything, and after entering random email you can click continue without account

calm hound
#

Hm, I see ApplePay within the PaymentElement

#

I take it you get "Something went wrong. Unable to show Apple Pay. Please choose a different payment method and try again." after clicking "Give now"?

next abyss
#

Yes, but you cannot pay with it.

#

As soon as you try to pay, it doesn't give you a popup, and it gives you an error message in console

#

Do you get Apple Pay popup when you try to pay with it?

calm hound
#

No, I see the same error in the console log

next abyss
#

Any idea what could be wrong?
Domain is verified, payment with other payment methods ( card, google pay, etc. ) works fine

calm hound
#

I suspect it's due to setup_future_usage: "off_session". If you omit this from your PI creation server side, can you get the ApplePay modal to show up?

next abyss
#

No, I did try it, the same issue happens.

#

I can re-deploy server-side again without it, if you would like to try

calm hound
#

Hm

#

And when "Get Now" is clicked, do you call confirmPayment()?

next abyss
#

Yes

calm hound
#

Is there anything else that you do before this?

next abyss
#

Yes, I do call our server for internal donation creation first, and on subscribe I then call createPayment()

#

( so that when webhook is contacting our server back, donation is already created with status "Pending", and webhook then sets it to "Success" or "Fail" )

calm hound
#

The other hint I get in the console log is Unhandled Promise Rejection

next abyss
#

I saw this as well, but my assumption was this is from Stripe request, since in network tab there isn't anything that would fail ( everything is in HTTP 200 range )

jovial remnantBOT
frozen nymph
#

I don't really get your code. And it's a picture and it has an if about clientSecret that doesn't make sense to me

#

confirmPayment() is being called before the ApplePay UI shows right?

next abyss
#

confirmPayment should be triggering ApplePay popup, yes.

that if statement is there, since there is also a support for saved payment cards, and for those you need to call a different confirmPayment() function that accepts clientSecret instead of whole elements instance

#

Do you need text version of code?

#

I'm happy to pass it on

frozen nymph
#

Okay let's take it one step at a time. When I load your page I get tens of red errors, CSPs, all of that. Is it expected?

next abyss
#

no, it is not.
( and it didn't happen before )

I'm just looking into that as well.

frozen nymph
#

like this is not the sign of a good/working integration

#

Okay so what exactly if your flow doing? Are you creating a PaymentIntent? If so when?

#

primo_paymentelement-applepay

next abyss
#

Payment intent is created when page is loaded ( anonymous user, without saved cards ).
Intent is created with server call, and paymentIntentId is returned back to front end

#

with payment intent ID i'm creating stripe elements instance

frozen nymph
#

okay you mean client_secret and not ID right?

next abyss
#

let me check server side integration if there is any name mapping done

frozen nymph
#

Do you have a simpler version or your app that isn't fully minified? The whole script is tens of thousands of lines long so I don't really know where to start

next abyss
#

yes, clientSecret

#

you are right

#

I don't have it, ( at least not publicly published )

#

I can put together a simple example

frozen nymph
#

Okay I think that's the next step honestly. Start with a much simpler example in Test mode to confirm it does work as expected.

next abyss
#

ok, makes sense.

#

I assume this channel will stay open, and I can come back as soon as I will have a simple example?

frozen nymph
#

we keep threads open for a short time as we help dozens of people a day here. But it'll stay open for at least 30 more minutes

#

I'd also recommend adding clear logs before and after calling confirmPayment() to track where exactly it's failing

next abyss
#

I doubt I will be able to get it working in 30min ( with simplified code + current server communication )
In this case please feel free to close this thread, and I will open another one later whith an simplified example

frozen nymph
#

sounds good!

#

Also you don't really need any server. You only need to hardcode some values to render PaymentElement and get to confirmPayment() working

#

sorry I looked further but I'm not finding anything obvious that could cause the error