#rahuls1098_api

1 messages ยท Page 1 of 1 (latest)

young vigilBOT
#

๐Ÿ‘‹ 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.

random yacht
opal veldt
#

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

random yacht
#

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

opal veldt
#

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

random yacht
#

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.

opal veldt
#

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)

random yacht
#

Yeah, I think this is just a classic race condition. You need to wait a little longer before fetching the data

opal veldt
#

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?

random yacht
#

And when you say 'received' do you mean on Stripe's end?
yes

opal veldt
#

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?

random yacht
#

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?

opal veldt
#

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()'

random yacht
# opal veldt 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?

opal veldt
#

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

random yacht
#

The Payment Intent body from where? The webhook event? The GET request?

opal veldt
#

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?

random yacht
#

What page are you on when you click that? What's the URL?

Can you also send a screenshot of the error?

opal veldt
#

CLicking on this link

#

leads to this

random yacht
#

Can you copy/paste that Payment Intent ID for me real quick?

opal veldt
#

pi_3PGmX6RCHTs6KlFb1BdUNMma

random yacht
#

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?

opal veldt
#

no extensions

random yacht
#

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.)

opal veldt
#

Haven't tried that yet, but will do and will report back

random yacht
#

Sounds good!

dense spokeBOT
opal veldt
#

I was able to check on a colleague's browser and they were able to get to the page

#

Not necessarily following that link, but using dashboard.stripe.come/test/...connect_account_id/...paymentIntentID

frail star
#

๐Ÿ‘‹ stepping in as my colleague needed to step away

#

Okay so yeah it sounds like you are trying to navigate to viewing a Connected Account's PaymentIntent

#

And it isn't working