#rahuls1098_api
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/1240357550575325257
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Can you provide request IDs for the requests you're referring to?
Here's how you can find a 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.
Here is the request ID: req_gykUEW2Kcp6QVk
^ That one is for the payment_intent.succeeded event
Here is the payment_intent.created request ID: req_HDMMIjaL2SdEuf
I'm noticing that your GET request was received 1 second before your POST request, so if you added metadata to via the POST request, it would make sense that the GET request didn't have the most up to date version
I added metadata to the stripe.PaymentIntent.create() function (within the arguments). This is the GET right?
And POST is payment intent.succeeded, which follows the GET, so it should have the metadata
I added metadata to the stripe.PaymentIntent.create() function (within the arguments). This is the GET right?
No. You don't change the object in GET requests.
That makes sense since we're fetching data; I thought I say GET next to the payment_intent.created
I'm also wondering why the hyperlink doesn't work (when I click on the payment intent id)
Yeah, I think this is just a classic race condition. You need to wait a little longer before fetching the data
So I have a fucntion that posts the PaymentIntent.create(), and a webhook that listens for payment intent.succeeded
The webhook automatically captures the event, not sure how I can add a delay in the 'fetch'
Also, just for my understanding, if the GET request that's received 1 second before the POST request - are you referring to the payment intent creation as the POST and the payment intent.created as the GET? And when you say 'received' do you mean on Stripe's end?
And when you say 'received' do you mean on Stripe's end?
yes
So I've actually been able to pass metadata through this before. I'm just adding new fields to the metadata. The only difference is I am testing this in a staging environment using the test key. Does the GET/POST behave differently using live keys?
Also, just for my understanding, if the GET request that's received 1 second before the POST request - are you referring to the payment intent creation as the POST and the payment intent.created as the GET?
No. You sent 2 requests.
This one is the POST request to confirm the Payment Intent --> req_gykUEW2Kcp6QVk
This one is the GET request you did when you fetched the Payment Intent --> req_HDMMIjaL2SdEuf
Does the GET/POST behave differently using live keys?
No
payment_intent.created is a webhook Event. If you're receiving this event and immediately fetching the Payment Intnet, then it would make sense the the subsequent confirmation attempt would happen afterward in some cases (the race condition I mentioned)
If you're still confused, can you take a minute to summarize what your intended flow is supposed to look like? What are you actually trying to do here?
Sure! On a high level, I have an application where a user can make a payment, such as towards their outstanding balance on their account using a credit card (Stripe-related). I capture this value and propagate it to the back-end, which eventually makes its way to a function that creates a payment intent (i.e., stripe.PaymentIntent.create(**payment_intent_params). payment_intent_params contains the metadata, which I have confirmed in my logs. I then have a stripe payment intent webhook in my controller which listens for payment intent . succeeded events. I parse the event object and extract the metadata (in this case, outstanding balance paid), and then add this to a table which stores payment transactions by the user
I don't think I am 'fetching' the payment intent anywhere. I am just creating a payment intent, then I have a webhook which captures the .succeeded event
If by fetching you mean 'stripe.PaymentIntent.retrieve()'
Yeah, at some point you're making a request to fetch the Payment Intent, so that's what this request indicates --> req_HDMMIjaL2SdEuf
Given the flow you just mentioned, I'm not sure where/when that GET request comes in, or why, but if we just focus on the workflow you mentioned, I would expect that the payment_intent.succeeded webhook would have all the updated metadata that was added during/prior-to the confirmation of the Payment Intent.
But you're saying it doesn't have that metadata in the webhook payload?
Actually I can't see the webhook payload at the moment since I am running locally, but I tried on my staging environemnt and noticed that the payment intent body did not include a metadata field
The Payment Intent body from where? The webhook event? The GET request?
Sorry, the GET request that can be seen on the stripe dashboard (in test mode -> logs)
But you said this is likely because of a race condition
I will do some more investigation on my own, but I still don't know why clicking on the payment intent id leads to a page that says "Sorry, something went wrong". Is the data not stored?
What page are you on when you click that? What's the URL?
Can you also send a screenshot of the error?
Can you copy/paste that Payment Intent ID for me real quick?
pi_3PGmX6RCHTs6KlFb1BdUNMma
That's odd. I was able to navigate to the page just fine. Do you have any extensions that might be blocking the page from rendering properly?
no extensions
That's really odd. Have you tried in incognito mode? Or done the usual troubleshooting? (e.g. updating the browser to latest version, close and reopen, restarting computer, etc.)
Haven't tried that yet, but will do and will report back
Sounds good!