#_nerder

1 messages · Page 1 of 1 (latest)

silk jettyBOT
ruby fractal
#

No. That webhook would only fire on the platform account

timid fiber
#

Umm, then i'm seeing something strange happening in my local environment using stripe-cli

#

what about the opposite instead?

ruby fractal
#

Can you be a bit more specific?

timid fiber
#

I meant when an event is triggered in the connected account, this will be also triggered in the platform account?

ruby fractal
#

'You can view and recieve events from connected accounts, but you would need a separate webhook endpoint. One for the platform and one for the connect accounts: https://stripe.com/docs/connect/webhooks

Learn how to use webhooks with Connect to be notified of Stripe activity.

timid fiber
#

Ok that's clear

#

The misunderstanding what that in local in my stripe cli I needed to use --forward-connect-to

#

instead of simply --forward-to

ruby fractal
#

Ahhhh, yup. You got it

timid fiber
#

Just one little question tho

#

because i'm not sure if this is the intended behaviour for stripe-cli

#

I have created in my docker-compose.yml 2 container for the webhooks (connected end direct)

#
  stripe-cli-connected:
    image: stripe/stripe-cli:latest
    container_name: stripe-cli-connected
    command: >
      listen
      --device-name ${DEVICE_NAME}-connected
      --events=customer.created,customer.deleted,customer.subscription.created,customer.subscription.updated,customer.subscription.deleted,payment_method.attached,invoice.paid
      --forward-connect-to http://host/connected/stripe-connected
    environment:
      - STRIPE_API_KEY
      - DEVICE_NAME
  stripe-cli-platform:
    image: stripe/stripe-cli:latest
    container_name: stripe-cli-platform
    command: >
      listen 
      --device-name ${DEVICE_NAME}-platform
      --events=customer.created,customer.deleted,customer.updated,payment_method.attached,payment_method.updated,payment_method.detached
      --forward-to http://host/platform/stripe-platform
#

it seems from my tests that in case an event is triggered from the connected account, both the direct and the connected account are triggered

#

I should instead opt for having a single container and use --forward-to and --forward-connect-to instead of 2?

ruby fractal
#

I think you can only have one or the other in a single command, but I could be wrong. Have you tried it already? Did it work?

timid fiber
#

No I haven't tried. Let me try real quick

#

But now that i'm looking at the command it shouldn't work, especially because --event will not make sense then

ruby fractal
#

I personally would keep them separate, since it's easier to debug and you'll have separate webhook handlers for each in a live environment anyway, so it more closely mimics what you'd see in prod

timid fiber
#

I agree, then I need to understand what I have misconfigured and why the direct also fires when the connected fires

ruby fractal
#

What event are you triggering specifically? Or are you creating the Customer outside of the CLI?

timid fiber
#

I'm triggering the events from the dashboard

#

i'm testing on customer.deleted which is present in both webhooks

#

While with --forward-connect-to now i'm not seeing anymore the Connected endpoint firing for PLATFORM only events

#

when i delete a customer from the connected account both my endpoints are called locally

ruby fractal
#

And the Customer was created via the CLI?

timid fiber
#

no, was created from my integration

#

but in the webhook logs (in the dashboard) everything looks fine

#

it's only in my local machine that both the containers are called

ruby fractal
#

Can I see the Customer ID?

timid fiber
#

yes

#

this was the customer i deleted cus_OOFxbQh64DCisE

ruby fractal
#

Hmmm, it looks like the deleted webhook tried to go to both production and test endpoints, but the delivery wasn't successful on this one: wh_1NzkXSLAVB3C1lDIKzjIIT6p

So my guess is that it's expected that both endpoints should be getting this event

#

Ah, wait. I think I might be confused. There are other endpoints that look kind of orphaned in play here, so I mistook one of the orphaned endpoints for the one you're referring to.

#

Apologies

timid fiber
#

That's strange yes, because I coulnd't find that webhook

#

This is what I see in my local listeners

#

I was testing a way to pass the device name from my docker-compose and failed

#

and for some reasons they are still there even if disconnected

ruby fractal
#

Do you have the commands you ran for each listener? Can you post them here exactly as you ran them?

#

It looks like the CLI listeners you set up are both configured for Connect-only events. So I'm hoping to help you fix one of them to listen only to the platform events

timid fiber
#

it's extracted from docker-compose so this should be the command:

stripe listen 
      --device-name ${DEVICE_NAME}-platform
      --events=customer.created,customer.deleted,customer.updated,payment_method.attached,payment_method.updated,payment_method.detached
      --forward-to http://firebase:5001/checkin-test-fba3d/us-central1/platform/stripe-platform
#

this is for the platform

silk jettyBOT
timid fiber
#
stripe listen
      --device-name ${DEVICE_NAME}-connected
      --events=customer.created,customer.deleted,customer.subscription.created,customer.subscription.updated,customer.subscription.deleted,payment_method.attached,invoice.paid
      --forward-connect-to http://firebase:5001/checkin-test-fba3d/us-central1/connected/stripe-connected

this instead is for the connected

ruby fractal
#

Huh, that looks correct. Let me repro real quick

#

Well, it looks like the platform listener will always receive both platform events and connect account events. Why? Not a clue.

That being said, you should see a connect flag on events that pass through that listener.

timid fiber
#

Ok than, I was not going crazy

ruby fractal
#

Sorry for the wild goose chase. I assumed that we didn't send Connect events to listeners without the Connect flag, but I was wrong

timid fiber
ruby fractal
#

Not a bad idea

#

I'm sure you're not the only one to run into this

timid fiber
#

here it is