#kosek
1 messages · Page 1 of 1 (latest)
hi! what's the PaymentIntent ID pi_xxx?
pi_3OL19lLJMdQkx7dY0ztA9rJQ
thanks! I had a quick look and I don't see anything unusual in the API calls made. I'd suggest reaching out to https://support.stripe.com/?contact=true for help with specific livemode payments for investigation
Ok thank you. If you still see the intent, can you tell me, are the multiple 200 OK requests to confirm payment normal? And each redirect_to_url.url has different pa_nonce etc?
ah right. I suppose that is strange, and sure , looks like there were two attempts, and one of them succeeded and the other didn't
ideally you wouldn't confirm again if an action is being handled(maybe make sure you set disabled on your frontend button after it's clicked)
Hmm it's the first thing I do.
const [submitting, setSubmitting] = useState(false);
const handleSubmit = async (event) => {
event.preventDefault();
setSubmitting(true);
/....
}
<Button
disabled={notReady || submitting}
onClick={handleSubmit}
>
{submitting ? <Loader /> : 'PAY'}
</Button>
notReady is always falsy so should work
interesting
I'll check more on the notReady, hold on
Yeah, it should work. There were more checks here, but now it just checks for cart
const [notReady, setNotReady] = useState(true);
const { cart } = useCart();
useEffect(() => {
setNotReady(true);
if (!cart) {
return;
}
setNotReady(false);
}, [cart]);
And cart is there for sure
I'll remove this effect anyway because it's not needed anymore, but the button should be disabled.
Can it be something else?
not sure!
Other than that this is the handler, stripped unrelated non Stripe stuff (cart validation, check for items availability etc)
const handleSubmit = async (event) => {
event.preventDefault();
setSubmitting(true);
if (!stripe || !elements) {
// Stripe.js has not yet loaded.
// Make sure to disable form submission until Stripe.js has loaded.
return;
}
const { error: fetchElementsError } = await elements.fetchUpdates();
if (fetchElementsError) {
showErrorNotification(fetchElementsError.message);
setSubmitting(false);
return;
}
const { error: elementSubmitError } = await elements.submit();
if (elementSubmitError) {
showErrorNotification(elementSubmitError.message);
setSubmitting(false);
return;
}
const clientSecret = cart.payment_sessions.find(
(s) => s.provider_id === 'stripe'
).data.client_secret;
const {
billing_address: {
first_name,
last_name,
phone,
city,
country_code,
address_1,
address_2,
postal_code,
province,
},
} = cart;
const { error, paymentIntent } = await stripe.confirmPayment({
clientSecret,
elements,
redirect: 'if_required',
confirmParams: {
return_url: `${window.location.origin}/order-completed?cartId=${cart.id}`,
payment_method_data: {
billing_details: {
address: {
country: country_code ?? undefined,
city: city ?? undefined,
line1: address_1 ?? undefined,
line2: address_2 ?? undefined,
postal_code: postal_code ?? undefined,
state: province ?? undefined,
},
name: `${first_name} ${last_name}`,
email: cart.email,
phone: phone ?? undefined,
},
},
},
});
sorry, not sure what I can say really!
Hmm. Ok and if you see the timestamps. The first request to confirm the payment was at 11:23:41. It was succesfull 11:25:45 (after user bank actions). THen one second after there is this new request to take action. Why is that?
I'm still trying to find if this is my dev fault.
I don't know
I hope I'm not bugging you, this is very important for us. Sorry If I do. I'm trying to find the cause.
I'm looking at the events again and it seems that the 200 OK on the screen above has a reponse body of next_action.redirect_to_url. Which shouldn't be the case. Are my notes here correct of what is happening:
Could this be some error on bank/stripe side?
yaeh I mean I don't know what the expected behaviour is
like if it should return a 4xx error about the attempt already being in progress if you confirm again, or if it's supposed to start a new attempt
I do think it's unusual you'd call confirm twice, but it's hard to know why without debugging your logs/reproducing the problem in test mode.
Might also be a specific problem like the partner not updating our backend with the payment outcome properly so we didn't complete the open attempt and transition the PaymentIntent to succeeded when expected, I don't know, that's why I recommended opening a support ticket at https://support.stripe.com/?contact=true to dig into the specific example here
Ok thank you. Just one more questions before you lose context.
From dev side. My return_url is a page without PaymentElement and it doesn't need to be there. right?
My return_url is just a page where I check the payment_intent (stripe.retrievePaymentIntent) and complete the cart if it's succeeded. That's completely fine?
There's a new event in activity!
The PaymentIntent failed due to a timeout on the upstream provider's side. Provide a new payment method to attempt to fulfill this PaymentIntent again.
yep that sounds normal (the return_url)
It just appeared
After contacting Stripe Support and Przelewy24 it seems this is something wrong with the payment on Przelewy24 side. 🙂
Thanks for notifying, Stripe Support will make sure to keep you updated as we navigate the incident.