#pure_ece-callback

1 messages ¡ Page 1 of 1 (latest)

main nymphBOT
steep jayBOT
#

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.

main nymphBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1235635875543646309

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

neat compass
#

Hey @robust flume! I'm happy to help but I will need a detailed write up of the issue, your exact code or if possible a live demo page where I can easily see what's happening

#

pure_ece-callback

robust flume
#

Hi, in my confirm event, I'm calling stripe.createConfirmationToken() and immediately failing afterwards with event.paymentFailed();

neat compass
#

Sorry that's still really high level and vague. Can you show exact code, exact error and why you are calling that event?

robust flume
#

I'm calling that to test if I can use that callback to let the customer know the payment did not go through for whatever reason. The code is quite simple.

const stripeEvent = async(event: StripeExpressCheckoutElementConfirmEvent) => {
  await stripe.createConfirmationToken({elements});
  event.paymentFailed();
};
neat compass
#

Okay so can you do it without creating a ConfirmationToken? It doesn't really make sense to do both together

robust flume
#

I plan to use the confirmation token to do a server-side auth, how would I inform the client that it failed or not?

neat compass
#

You would show a failure in your UI in that case

robust flume
#

But how do I prevent the apple pay sheet from showing a success?

neat compass
robust flume
#

The doc you linked is a client-side auth.

#

I'm attempting server-side auth with a confirmation token.

neat compass
#

sure but the doc I linked shows you how to display an error right? This happens after the confirmation and you would do the same with yours. To confirm server-side you have to make a call to your server, and get a succes/failed response right?

robust flume
#

yes, but I want to prevent the apple pay sheet from showing a success

#

I do plan on showing my own error with more details, but it looks deceiving to have the apple pay sheet show a "success" when it wasn't.

#

I presume this paymentFailed() callback is exactly for that purpose, to fail on the apple pay sheet as well.

neat compass
#

I tried locally and expressCheckoutElement.on('confirm', async (event) => { console.log("handle error"); event.paymentFailed({error: "testing 123"}); return false; } works for me for example and I see the UI show an error (though not that string)

robust flume
#

yes, that works for me as well. however, if i make the confirmation token call first, that paymentFailed() callback no longer works.

neat compass
#

Ack, let me try that, give me a few minutes

#

okay yeah no I can repro. Feels really strange, give me a few minutes

#

(might take a bit of time but pairing with someone else on my team, I had never done a call before that event.paymentFailed() so never realized it would error that way)

#

(still working on it)

#

okay back