#cristoffer_webhooks

1 messages ยท Page 1 of 1 (latest)

blazing summitBOT
distant shardBOT
#

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.

blazing summitBOT
#

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

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

midnight ivy
crimson cave
#

Isn't that cli generated one?

midnight ivy
crimson cave
#

oo it can be done, that will be helpful

#

i guess i should use --add [resource] option

#

Still there is no way to test it locally without cli?

midnight ivy
#

Well you can use ngrok or something and configure a webhook in your Dashboard that will point to that, and the ngrok points to your localhost

#

Some service like that where you expose your localhost on the web

crimson cave
#

Yeah i see the problem now ๐Ÿ˜„

#

Copying metadata from generated event by myself and passing it to cli will be good method to provide good data?

#

I want test data that will be the same as on my website

midnight ivy
#

I don't understand what you're asking me

#

What is it you're trying to do?

crimson cave
#

I want to store in metadata data about products which customer buy

midnight ivy
#

OK, and you're doing that when creating your intents via the API?

crimson cave
#

yes, exactly. And after a successful payment i want to use webhooks to save this data to my database also. That's why i need to generate events which will include metadata created by me

midnight ivy
#

If you have a working end-to-end integration that creates and confirms intents, then triggering events is redundant. You can just use the CLI to listen and forward the events that natureally fire as part of your payment integration

#

And assuming you set metadata when you create the intent, it'll be included in the payment_intent.succeeded event that the CLI forwards

crimson cave
#

Yeah just like in this event. evt_3PLO3mRrtsKOar1b1EzgpIbo

#

i have created it now

#

so this event will trigger a webhook /successful-payment and i want to simulate that

#

With same metadata as in this even

midnight ivy
#

Ok, then just use stripe listen --events=payment_intent.succeeded --forward-to=http://yourendpoint/successful-payment in the CLI

#

And you'll receieve the events generated by your actual integration code, that'll include the metadata fields

crimson cave
#

also in test mode? To create that event i have used PaymentElement in React

midnight ivy
#

Yes, CLI defaults to test mode

crimson cave
#

hm it doesnt work right now. My server only receives event's triggered from CLI, but not from my React App

#

nevermind, it works now ๐Ÿ˜„

midnight ivy
#

What does 'doesn't work' mean? Is there an error in your code or the CLI? I would guess that the CLI is signed in to use a different account

crimson cave
midnight ivy
#

Yep

crimson cave
#

Oke, thanks and sorry for my kinda stupid questions ๐Ÿซ 

midnight ivy
#

No such thing as a stupid question!

crimson cave
#

Also i have one about best practices. Should i somehow stop user from creating new payment intents? Right now every refresh on page where my PaymentElement component is creates new request to server and new payment intent

#

Should i implement some session managed on server so page refresh doesn't cause new payment intent creation?

midnight ivy
#

I'd say that's a detail of your implementation, but it's probably recommended yes. Obviously creating a new intent on each load of the cart/checkout adds latency. If you can persist the client_secret in state somewhere then you can just re-use it and even update the intent if the cart changes

crimson cave
#

Sounds like something that should be done..

#

Oke thanks for your help, have a good day ๐Ÿ˜‰