#harolold

1 messages ยท Page 1 of 1 (latest)

gilded ploverBOT
pine sapphire
#

Hi ๐Ÿ‘‹

Are you specifing redirect always or if_required?

candid quartz
#

no

#

I'm using confirmsetup btw

pine sapphire
#

That shouldn't matter

candid quartz
#

turned on redirect : "always"

#

same thing

pine sapphire
#

It's a setting that handles redirecting your customers if they use a payment method that requires a redirect to a 3rd party site

#

What Stripe tech are you using? Payment Element? Checkout Session?

candid quartz
#

payment element

pine sapphire
#

And what is the behavior you expect when a user confirms their payment method setup?

candid quartz
#

to redirect to a page

#

also it seems my alternative payment methods with redirect do not work

#

it just refreshes the screen on submit rather than opening a new tab for entering ideal or cash app

pine sapphire
#

Cash app loads a modal window in Test mode. Is your page preventing modal windows perhaps?

candid quartz
#

how would I fix that?

pine sapphire
#

I don't even know if it's happening, I just suggested it as something you may want to look into.

#

It will be a setup intent confirmation API call

#

I just tested my own redirection on confirmation

my JS looks like this

stripe.confirmSetup({
  elements,
  confirmParams: {
    return_url: `${window.location.origin}/success`
  }
})
candid quartz
#

"id": "seti_1NyGRqDNrxNFSI5I9Djyqv6Y",

#

req_fuoxYwQ9mmPnf7

pine sapphire
#

Are you always using the LInk payment method in your tests?

candid quartz
#

no

pine sapphire
#

So what happened when you completed the payment? Were you redirected at all?

candid quartz
#

no it just refreshed the page

pine sapphire
#

Hmmm... and you didn't see anything change in the URL?

candid quartz
#

it just put a ? at the end

pine sapphire
#

And how does your framework handle redirect requests?

candid quartz
#

hey btw I found the error

pine sapphire
#

You did? what was it?

candid quartz
#

for this part I had e.preventdefault(); commented out

#

async function handleSubmit(e) {
e.preventDefault();
setLoading(true);

// //Send email to next page in queryparameters
//// //email is a route
//redirect_url = "https://www.google.com";
console.log(redirect_url);

//setTimeout(function () {
//    window.location.href = redirect_url;
//}, 1000000);

const { error } = await stripe.confirmSetup({
    elements,
    confirmParams: {
        // Make sure to change this to your payment completion page
        return_url: 'https://stripe.com'
    },
    redirect : "always"
});

console.log("error=" + error);

//response.then((data) => { console.log("response=" + data) });


// This point will only be reached if there is an immediate error when
// confirming the payment. Otherwise, your customer will be redirected to
// your `return_url`. For some payment methods like iDEAL, your customer will
// be redirected to an intermediate site first to authorize the payment, then
// redirected to the `return_url`.
if (error.type === "card_error" || error.type === "validation_error") {
    showMessage(error.message);
} else if (error.type == "") {
    //doesn't get triggered
    window.location.href = redirect_url;
}
else{
    showMessage("An unexpected error occurred.");
}


setLoading(false);

}

pine sapphire
#

Oooooohhhhh. So including prevented the default POST behavior, right?

candid quartz
#

yeah I guess so

#

it's working now. Thanks so much. I have been trying to figure it out for a day ๐Ÿ™‚