#Fahim
1 messages · Page 1 of 1 (latest)
Hi there!
Can you share the request ID (req_xxx)? Here's how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
req_DiQaf2dIyeRXTg
You used test card 4000000000009995 (Insufficient funds decline), so what were you expecting?
so will it return a 402? shouldn't request be success and return value should say it's Insufficient funds decline?
Anyways what I want to do is redirect to a page, if payment fail.
No, in this case it's expected that we return a 402. You can learn more about the HTTP status code here: https://stripe.com/docs/api/errors
But in local setup it's not redirecting
const { error } = await stripe.confirmPayment({
elements,
confirmParams: {
// Make sure to change this to your payment completion page
return_url: window.location.origin+"/admin/system/stripe/testing/connected-accounts/take-a-payment/return-url",
},
});
if (error.type === "card_error" || error.type === "validation_error") {
showMessage(error.message);
} else {
showMessage("An unexpected error occurred.");
}
var paymentIntentid = $("#payment_intent_id").val();
var payment_id = get_payment_id(paymentIntentid);
if(payment_id != '' && payment_id != undefined && payment_id != 0){
redirect_url = "/admin/system/stripe/payment/"+payment_id;
window.location.href = redirect_url;
}
this is the code block I'm talking about