#jzills-JS
1 messages · Page 1 of 1 (latest)
let stripeResponse;
try {
stripeResponse = await stripe.confirmPayment({
elements,
confirmParams: {
return_url: `${window.location.origin}`
}
});
} catch (error) {
console.log(stripeResponse);
debugger
}
Are you sure that try block is getting hit at all? The example PaymentIntent you provided doesn't have any error associated
This is the initialization bit:
const stripe = Stripe("pk_test_oBlpPAYPHf6PEAm1ObQ5YO3R");
const appearance = { theme: 'stripe' };
elements = stripe.elements({ appearance, clientSecret: "pi_3KxaexGlQRIgvmTk0KL5uAEq_secret_jWegjxPkg9nzq43kQm02MCVbg" });
Hmmm thinking
Can you add a log before stripeResponse = await just to make sure we are hitting the try block?
Okay, what is triggering this try block?
Are you attempting to call it on load here for testing?
No a button is triggering it
Okay can you log out elements within the block then?
Sorry for the delay, server is busy.
Okay so instead of logging out the stripeResponse for your error
Can you just log out the full error?
When you console.log(error) you see {}?
Correct
Hello. Taking over here as bismarck had to step out. Do you see anything in your browser console?
Hi there - no, the only error is {}.
Hm this is strange
I'm not a JS expert, but I know let can be tricky with scoping issues
Can you try to change that to var for stripeResponse?
Again, this might not be the issue as I'm not a JS expert
Still undefined. I sent the json representing the Stripe Elements object...can you verify it looks correct?
Looks like _customerOptions is null? Should that be populated after initialization?
I think that should be fine. We still should be getting some error here
How are you retrieving the elements object?
And also, are you using the latest stripe.js?
This is the version I'm using
This is the initialization
Gotcha. Unfortunately, this is going to take some time to debug that we probably won't have for just a Discord session
I recommend writing into support about this so an engineer can dedicate some time to help: https://support.stripe.com
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
@sturdy cedar Out of curiosity, if you remove the try/catch code does it work as expected? If not what happens?