#jskitz-webhhoks

1 messages · Page 1 of 1 (latest)

fierce iron
#

Hi there! Are you creating a $0 Subscription?

#

If so, there won't be a payment_intent.succeeded event.

fathom gazelle
#

no I'm not. I'm creating a $6/mo subscription

fierce iron
#

Weird

fathom gazelle
#

I'm also not getting invoice.paid

fierce iron
#

Can you provide an example ID?

fathom gazelle
#

I get these every time:

"type": "checkout.session.completed"
"type": "charge.succeeded"
"type": "payment_method.attached"
"type": "customer.created"
"type": "customer.updated"
"type": "invoice.created"
"type": "invoice.finalized"
"type": "customer.subscription.created"
"type": "invoice.updated"
"type": "customer.subscription.updated"
#

A subscription ID? which ID would you like?

fierce iron
#

Yep Subscription ID is great

fathom gazelle
#

sub_1KtCvkGlyfQqa0B5wS2P9PB0

#

this is in Test Mode

#

not sure if this is related, but I also get pending_webhooks: 2 on every message. Not sure why that never gets down to zero

fierce iron
#

So I do see a payment_intent.succeeded event for that Sub and it has a successful response from the CLI. Check evt_3KtCvlGlyfQqa0B50Ub3vwOK

fathom gazelle
#

does the payment_intent.succeeded come delayed by some amount of time?

fierce iron
#

No it should not

#

Looks like it came 2 seconds after the checkout.session.completed in this case

fathom gazelle
#

okay, I can run it right now and give you the trace

#

if you can give me just a minute

fierce iron
#

Sure

fathom gazelle
#

because I traced three times yesterday, different users, it didn't come through

fierce iron
#

I'm going to need to step away myself in a minute, but a colleague is here and will step in.

fathom gazelle
#

great, continue to respond here?

fierce iron
#

Yep!

fathom gazelle
#

Okay, I just did a trace, and I'm still getting all the same events but not payment_intent.succeeded

"type": "charge.succeeded"
"type": "checkout.session.completed"
"type": "payment_method.attached"
"type": "customer.created"
"type": "customer.updated"
"type": "invoice.created"
"type": "invoice.finalized"
"type": "customer.subscription.created"
"type": "invoice.updated"
#

I just ran this for a new user

fierce iron
#

You are using the CLI to forward to your local endpoint?

fathom gazelle
#

yes and that endpoint logs every event

#

I'm using it like this:

stripe listen --forward-to localhost:5010/payments/webhook --format JSON | grep '^{"api_version"' | jq

#

sorry, it's localhost:4242 for this demo, but everything else is the same... also my app is logging the received events

#

actually, maybe it did come in correctly, but for some reason, it's not being logged to the console?

#

from the webapp logs, I'm seeing it

fierce iron
#

Yeah that's what I'm wondering

#

I see the event going through

#

So it makes me think it isn't getting logged on your server

#

What's your local endpoint look like?

fathom gazelle
#

I'm seeing this from the web app logs

event charge.succeeded
event checkout.session.completed
event payment_method.attached
event customer.created
event customer.updated
event invoice.created
event invoice.finalized
event customer.subscription.created
event invoice.updated
event customer.subscription.updated
event invoice.paid
event invoice.payment_succeeded
event payment_intent.succeeded
event payment_intent.created
#

which seems reasonable to me... but that's not what was logged from the stripe listen CLI log

#

but this makes me feel better

#

the local endpoint is just a python flask app, and it logged those... the other trace I sent you was from the Stripe CLI, which perhaps the problem is my grep clause?

#

follow up question: is there a way to listen to stripe messages, output to json and pipe it through jq without doing the grep?

#

jq will fail if I don't have a grep on there

#

stripe listen --forward-to localhost:5010/payments/webhook --format JSON | grep '^{"api_version"' | jq

#

basically I'm trying to find the start of the json block to pipe through jq

fierce iron
#

Ah I misunderstood

#

Hmmm yeah I haven't played with the CLI like this

#

But that would make sense to me

fathom gazelle
#

seems like those payment_intent events don't start with "api_version"

fierce iron
#

They should

#

It should be "id": "evt_xxxx", "object": "event", "api_version": "2020-08-27", etc.

#

For all

fathom gazelle
#

a lot of them start with api_version and I guess some don't... maybe I can just look for {" - I'll try that. Okay, so I'm not losing events. One last question, when I go live, I shouldn't be listening to everything.. just the ones I need, correct?

fierce iron
#

Correct so that you don't overload your handler

fathom gazelle
#

the order of the logs on Stripe and the order of the events on my web app are different. That's normal, right?

fierce iron
#

Yes expected

#

We don't guarantee order

fathom gazelle
#

thanks! I think I'm good for now. Appreciate all the help

fierce iron
#

Sure thing!