#gl1tch_webhooks

1 messages ยท Page 1 of 1 (latest)

wind fernBOT
#

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

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

velvet quest
#

Events will provide a snapshot of the object at the time the event occurred, so if you're adding metadata after the PaymentIntent succeeds, it won't be included in payment_intent.succeeded

unique shale
#

actually i created payment intent then i have some process after this process i immediatly update metadata :

1- stripe.paymentIntents.create({
2- some actions
3- this.stripe.paymentIntents.update(paymentIntentId, {
metadata: {
...metadata,
},
});
}

#

so based on what you said should i create payment intent not confirmed then i confirm it after the metadata update ?

velvet quest
#

possibly but it depends!

does the metadata that you need to add depend on the payment success or other status? or is the payment status irrelevant to the metadata?

unique shale
#

yep thats the point it depend on the payment success

velvet quest
#

sure, so then if you need to confirm the payment success (i.e. payment_intent.succeeded) before you add the metadata, it's impossible for the metadata to be included in that Event data

#

are you able to share more context on why you want the metadata to be included in this Event specifically (as opposed to the API response you receive after updating the PaymentIntent)?

unique shale
#

oh sorry lets more clarify , what i am looking for is having metadata updated when payment intent succeeded but if it fails i already catch that and i dont need thet metadata, but when i check stripe dashboard i just noticed metadata updated after 3 sec payment_intent.succeeded triggered , yet i update metadata exactly after the payment intent creation

velvet quest
#

ok this makes sense, but even if the metadata update was processed <1s after the PI succeeds, it still won't be included in payment_intent.succeeded because that Event captures the object at the time the payment succeeded - not after

so it is expected that the metadata (again, added after the PI succeeds) isn't in that event data

#

it sounds like you need/want the metadata to be included in the event specifically - can you clarify why it needs to be included in the payment_intent.succeeded event?

#

I should note that you can find the metadata in the API response after adding it, and by retrieving the PaymentIntent via the API

unique shale
#

ok here is what i do :
1- stripe.paymentIntents.create
2- create record in my db
3- stripe.paymentIntents.update with record id

in webhook:
1- when payment_intent.succeeded , i use record id in meta data to do some other actions

Why i am doing this: i use stripe.paymentIntents.create to check BIC IBAN , SEPA Direct Debit correct or not if not i do not proceed the process of 2- create record in my db i just stop my process

#

another question please , metadata updated after all webhook events triggered is that the normal behavior in stripe ?

wind fernBOT
velvet quest
#

ok makes sense! would it be workable for your system to not rely on payment_intent.succeeded to get the record ID? it's not possible to get the metadata from that event, but since your system already has the record ID I'm unclear on why it needs to be included in the event

unique shale
#

to identify that payment intent related the same record , yep i can just save PI id and my record in my system then in webhook identify the correct record based on the PI id , But thats not possible to use metadata without doing this ?

tacit robin
#

Hey! Taking over for my colleague. Let me catch up.

unique shale
#

ok

tacit robin
#

in the event payment_intent.succeeded

unique shale
#

thats not happening

#

using the stripe.paymentIntents.update and i update metadata

#

but when i create PaymentIntent with metadata i get metadata values in the event payment_intent.succeeded

tacit robin
#

I'm not understanding you follow up, sorry. Could you please clarufy more ?

unique shale
#

its ok i just solved the problem , thanks for ur time you can close this thread

tacit robin
#

Sure, happy to help!

unique shale
#

i think probably i am using the payment intent update metadata in the wrong way but all i was looking for is to create payment intent , then update payment intent meta data and i though ill get the metadata in payment_intent.succeeded but i just noticed the metadata not updated in that event , may be an issue or thats not the normal behavior its up to you to classify it if its not meant to be like that

tacit robin
#

to create payment intent , then update payment intent meta data and i though ill get the metadata in payment_intent.succeeded but i just noticed the metadata not updated in that event
In order to get the metadata in this event, you need to set the metadata values before charing the customer.