#red_error
1 messages ยท Page 1 of 1 (latest)
๐ 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/1384150438483333120
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- red_api, 2 days ago, 17 messages
hi - the whole thing, or just a section?
the part where it's failing
do you see it above?
that doesn't have .type
console.log("in handleSubmit with e: " + e);
e.preventDefault();
setLoading(true);
const { error } = await stripe.confirmPayment({
elements,
confirmParams: {
// Make sure to change this to your payment completion page
return_url: "http://localhost:4242/complete.html",
},
redirect: 'if_required'
});
// 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`
console.error("error encountered after submit: " + error);
if (error.type === "card_error" || error.type === "validation_error") {
showMessage(error.message);
} else {
showMessage("An unexpected error occurred.");
}
setLoading(false);
}```
it drops through to console.error("error encountered after submit: " + error);
even though error is undefined
because of the integration requirements from GoHighLevel I have to run this in an iframe, so I cannot redirect
how should I handle successful transaction in this case
this is the Stripe code I copied - do I just need to check for null error and continue?
I would just add a ? for null coalescing error?.
ok. Is there any built in code to display success confirmation?
in the JS you provide?
I just added the debug statement: console.error("error encountered after submit: " + error); but will drop down into the error IF statement
I'm suggesting doing this
showMessage(error.message);
} else {
showMessage("An unexpected error occurred.");
}
ok - but then it will just show An unexpected error occurred. when the payment is successful?
then there's another error happening
would you mind sharing the PaymentIntent ID you're confirming?
sure - 1 sec
what should happen if the payment is successful in that code? If redirect is set off, it will just drop into that error section, no?
no it would go to the else block
ohhhhh!
I see what you mean
you need to check if the error is null then you consider the payment to be successful otherwise you would go through the if/else code without the ?.
right!
is there a JS funtion in your JS package to display confirmation though?
"id": "pi_3Race4BBPymgN3Ps1DZTf5wP"
I just added check for null - no error now obviously, but page just sits there
I need to show successful payment details
Hi, taking over as my teammate needs to step away. Let me catch up.
hello!
thanks
I'm using your https://js.stripe.com/v3/
I can't redirect as I am forced to run in iframe due to GoHighLevel integrations
the payment is succcessful, I'm just trying to figure out how to show successful payment in the UI - is there a method to call?
I see, https://help.gohighlevel.com/support/solutions/articles/48000981400-stripe-integration has their own integration with Stripe. Aside from passing the return url on this function, https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=elements#web-submit-payment there is not such function for confirmation.
they do have their own integration ,but it doesn't meet our needs for surcharging
the return URL won't work in an iframe though, right?
Looking still
thanks!
Ok, on that page, we state 'Avoid placing the Payment Element within another iframe because some payment methods require redirecting to another page for payment confirmation.'. What you're looking for is not supported
well - I'm not using the payment methods that require redirecting
even if I redirect, though, how do I get the info on the successful payment?
We document that on that same step: 'Use one of the query parameters to retrieve the PaymentIntent. Inspect the status of the PaymentIntent to decide what to show your customers.'
I'm unsure what 'original page' means, but you can retrieve the PI using your publishable key on your client-side.
the page the above code is on - but that works, thanks!