#n8k_webhooks

1 messages ยท Page 1 of 1 (latest)

scenic thornBOT
#

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

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

split maple
#

This is the content of my fixture file with test data:

{
"_meta": { "template_version": 0 },
"fixtures": [
{
"name": "early_fraud_warning.created",
"path": "/v1/events",
"method": "post",
"params": {
"type": "radar.early_fraud_warning.created",
"data": {
"object": {
"id": "issfrw_test_123",
"object": "early_fraud_warning",
"charge": "ch_test_charge",
"fraud_type": "unauthorized_use_of_card",
"livemode": false,
"payment_intent": "pi_test_intent"
}
}
}
}
]
}

mortal glacier
split maple
#

Yeah, but I was hoping to follow this approach

mortal glacier
#

not all events are supported via Fixtures but let me confirm if this does

split maple
#

ty!

scenic thornBOT
mortal glacier
split maple
#

Hmm I did see that GH issue and upvoted it, but this looks like it is related to prebuilt events not custom fixtures?

mortal glacier
#

Yes, that is for a prebuilt event. I attempted to trigger the event but could not using fixtures

split maple
#

Okay do you have a good place for me to read on custom fixtures? I may be misunderstanding them

mortal glacier
split maple
#

I think I see - if I want to create them custom i need to find the url path to just create it in the api?

timid jasper
#

Hi there ๐Ÿ‘‹ jumping in as my teammate needs to step away. I also don't think this is something that you can test via fixtures, as fixtures are used to change the API calls that the CLI makes, but early fraud warnings aren't triggered by making requests to our API. Instead they're generated when we receive input from issuers, so there isn't an endpoint in our API for creating those that you can call.

I do think that using the 5423 test card is the best path for testing these early fraud warnings.

split maple
#

Ahh

#

this makes sense

#

Okay so I basically just need to validate this locally by turning off signature verification and just believing my local webhook

#

And then I can use the special card for non-local testing

timid jasper
#

Not necessarily, you can still use the CLI to listen for these types of Events, and use it to forward them to a local endpoint that you're running for testing purposes. The CLI will generate a signing secret when you run stripe listen that can be used to keep signature validation in place for the localhost testing.

#

Just you won't use stripe trigger to generate the Event.

split maple
#

So even using one of those prebuilt on stripe test payment pages for testing coudl forward to my local via the stripe listen?

#

That would be great

#

like with a payment link

timid jasper
#

Yup, we have a step in one of our webhook guides showing this here:
https://docs.stripe.com/webhooks#test-webhook

The gist is, that when you run stripe listen you use the --forward-to option (and --forward-connect-to if you're also testing Events for a Connect integration) to tell the CLI where it should send Events to once it receives them:
https://docs.stripe.com/cli/listen#listen-forward-to

The CLI will automatically handle signature verification with our service, so Events won't be sent more than once, but it will also generate a signing secret when you run stripe listen that you can use to test signature verification on your local endpoint (the Event is essentially re-signed for you once it hits your machine). My attached screenshot is showing how that signing secret is printed after you run that command to start the listener.

split maple
#

Great this worked! ty!

#

This is perfect - thank you ๐Ÿ™‚ Feel free to close this one!

timid jasper
#

๐Ÿฅณ Yay! Glad to hear that did the trick