#AlexT17
1 messages ยท Page 1 of 1 (latest)
What does it say in the browser console?
If I look in the Stripe portal for our account I can see the failed API attempts and the error message but it doesn't appear in the label text I have on the web page. I click on the submit button and nothing happens in the UI.
I'm forcing an error by attempting to set up an intent which has already succeeded.
What does it say in the browser console though?
Does that help at all? I'm seeing a ReferenceError error isn't defined in your code
I did wonder if it was a problem with the users so I cleared them down and created another one. Tried it again using card number 4000000000009995 with a new user and had the same problem. Should this not display an error? Using card 4000002500003155 works fine via additional authentication.
It's a problem with your error handling. When you click the error is not defined error in the console, which line of code is it pointing to? Are there any more errors out of view that aren't in the above screenshot?
Ok, I'm not very knowledgeable with javascript so thought that this....
.then(function (result) {
if (result.error) {
const messageContainer = document.querySelector('#error-message');
messageContainer.textContent = error.message;
}
});
....was supposed to catch any errors and display them?
Ran the page again and these are all the console entries for the page.
If I fill in the fields with a card which is going to fail and submit I get this in the console.
Hello ๐
Taking a look
Hi, thanks.
out of curiosity, what is the API error message you're seeing on the dashboard?
Which is what I'd expect to see appearing on the screen.
Appreciate it's not a flow you would normally follow once an intent is created but I'm trying to break the code to find weak points.
Gotcha... hmm the error in the console is quite abstract
I was hoping to be able to display something like "You already have a payment method set up" as an error, or something similar. At the moment there
there's no response from the UI at all.
give me just a second, trying to see if I can reproduce this
quick question, why do you have return_url set as
return_url: window.location.href = 'https://localhost:44300/Home/PaymentSetupStatus'
I'm debugging the code on my local machine rather than a server. It will get changed before publishing.
can you try removing window.location.href = and only set the URL
try http instead of https (unless you have an SSL cert for localhost)
Sorry, if you mean the window.location.... that's already been removed so ignore.
gotcha
We have an SSL cert
Works great if the process succeeds, just not when there's an error so I think the https is ok.
ah could you change following
messageContainer.textContent = error.message; code to
messageContainer.textContent = result.error.message;
Let me try it.
yup looks like that was the issue
Your code works on my end
Yep, it's not getting stuck now but it's also not erroring and stopping a user setting multiple setup intents using the same card. Is that right?
yeah I don't think the API checks if there's already a card setup
You would want to check this on your end
Do I need to do that check in my code then as my test user now has three identical cards associated with their account.
What happens with this situation when a payment intent is set up? I'm guessing each of the three cards has a unique stripe ID?
What happens with this situation when a payment intent is set up? I'm guessing each of the three cards has a unique stripe ID?
Yes that's correct.
We have a video guide on how you can deduplicate payment methods
https://www.youtube.com/watch?v=MvMmOWWHjVo
Great, thanks for all your help in sorting this.