#ameotoko_code
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/1277953599539777638
๐ 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.
- ameotoko_best-practices, 1 day ago, 6 messages
๐ happy to help
would you mind sharing more information (e.g. request ID)?
if it's a 400 error this means that your code is sending an invalid request, and means that you need to fix your code
But I am not constructing that request, it's a legitimate call of stripe.confirmPayment()
hang on, I'll give you the details
would you mind sharing the request ID?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
req_Ugvtn7cYwWJvBd
Theoretically, a user can open the payment page and get distracted. If he comes back a day later and submits the form โ the incomplete subscription is already expired, which leads to the error above.
I'm fine with the error itself. What's unexpected is that stripe fails instead of returning the error, as described in docs.
I'm not seeing anything in the front end, since my script fails to execute after this point
in the dev tools console
POST https://api.stripe.com/v1/payment_intents/pi_3PsB93GJjvO6CYPf1kT86tpo/confirm 400 (Bad Request)
give me a few minutes to replicate
Sure, thanks for taking a look
I actually can't reproduce the behavior you're describing
the error is returned properly and as you can see in the screenshot I can inspect it normally
hi! I'm taking over this thread. let me know if you have any other question.
I think I'd need to try to replicate this using a Stripe sample. Is this the correct one? https://github.com/stripe-samples/subscription-use-cases/tree/main/fixed-price-subscriptions
I'm looking for one that corresponds with https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=web&ui=elements the best
what do you want to replicate? the error you got is pretty clear: https://dashboard.stripe.com/test/logs/req_Qa5voWAgnj6CQH
you are trying to confirm a PaymentIntent that has status:cancelled, which is not possible
and the status is cancelled because you deleted the corresponding subscription: https://dashboard.stripe.com/test/logs/req_aBWEa2CusHraz3
Yes, but technically it exists in incomplete_expired state. This would be the same if it just expired after 23h, correct?
I don't get it. you deleted the Subscription from the Stripe dashboard yourself: https://dashboard.stripe.com/test/logs/req_aBWEa2CusHraz3
so you can no longer use the PaymentIntent from that Subscription
you would need to create a new one
I'm testing a scenario where user tries to confirm payment for an expired subscription
I explained it here
As I already mentioned โ I do understand the error, the error is not the problem. The problem is โ instead of being returned from stripe.confirmPayment() as described in the guide, the call itself fails with 400 Bad request, which breaks execution of the script and makes further handling in the frontend impossible.
did you see this previous message? #1277953599539777638 message
Yes. That's why I think I need to test it with the sample now, which brings me to my last question
here
I also asked for an opinion
I'm sorry I'd like to help but I don't get your question. why do you need a Simple sample? what exactly are you trying to reproduce? what's the issue you are trying to solve?
Sorry if I'm being unclear
can you try re-explaning your question?
Please take a look at "Returns" section here: https://docs.stripe.com/js/payment_intents/confirm_payment#confirm_payment_intent
It reads:
If the confirmation fails, the Promise will resolve with an {error} object that describes the failure.
My problem is, that I get this instead
This cannot be handled by the application, and that is the problem
got it. and why do you need a Stripe sample for this?
I don't, if you can tell me what I'm doing wrong, or how can I handle this in a best possible way
got it. give me a few minutes to try to reproduce this on my end.
Sorry, I finally found the bug on my end, it was tiny and very easy to miss
oh, great! so is your issue resolved?
Yes. Thank you for your patience! I was starting to think I found a bug in Stripe library, which is not likely tbh ๐
For anyone else searching: stripe.confirmPayment() returns a Promise, so make sure to use await if you don't want to chain .then(). Somehow I lost await while refactoring and didn't notice.