#jzills-JS

1 messages · Page 1 of 1 (latest)

split condor
#

Hi there! Can you provide your full code snippet here where you are confirming?

sturdy cedar
#
let stripeResponse;
        try {
            stripeResponse = await stripe.confirmPayment({
                elements,
                confirmParams: {
                    return_url: `${window.location.origin}`
                }
            });
        } catch (error) {
            console.log(stripeResponse);
            debugger
        }
split condor
#

Are you sure that try block is getting hit at all? The example PaymentIntent you provided doesn't have any error associated

sturdy cedar
#

This is the initialization bit:

const stripe = Stripe("pk_test_oBlpPAYPHf6PEAm1ObQ5YO3R");
        const appearance = { theme: 'stripe' };
        elements = stripe.elements({ appearance, clientSecret: "pi_3KxaexGlQRIgvmTk0KL5uAEq_secret_jWegjxPkg9nzq43kQm02MCVbg" });
split condor
#

Hmmm thinking

#

Can you add a log before stripeResponse = await just to make sure we are hitting the try block?

sturdy cedar
#

I stepped through it - we are.

split condor
#

Okay, what is triggering this try block?

#

Are you attempting to call it on load here for testing?

sturdy cedar
#

No a button is triggering it

split condor
#

Okay can you log out elements within the block then?

sturdy cedar
#

Here is the full stripe elements object that is being passed in:

split condor
#

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?

sturdy cedar
#

The error is just {}

#

No details or anything

split condor
#

When you console.log(error) you see {}?

sturdy cedar
#

Correct

native herald
#

Hello. Taking over here as bismarck had to step out. Do you see anything in your browser console?

sturdy cedar
#

Hi there - no, the only error is {}.

native herald
#

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

sturdy cedar
#

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?

native herald
#

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?

sturdy cedar
native herald
#

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

hazy pond
#

@sturdy cedar Out of curiosity, if you remove the try/catch code does it work as expected? If not what happens?

sturdy cedar
#

No it does not

#

nothing is returned from the stripe call...I get undefined back

#

I tried attaching then on the promise instead of awaiting the stripe call to try and get the error out but it never hits.