#dishant_cli-connect-events

1 messages · Page 1 of 1 (latest)

zinc iceBOT
#

👋 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/1282670648984076483

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

outer quail
#

Hi

daring berry
#

hi! can you say more? what exact command are you running, what sort of events are you expecting?

outer quail
#

In cmd I am using stripe listen --forard-to 'locally created enpoint url'
I am expecting

  • charge.succeeded
  • charge.updated
  • charge.failed
  • payment_intent.succeeded, etc..
    Whatever event stripe is throwing to the webhook end point.
    Later using code I will filter the events
daring berry
#

do you have an example of a ch_xxx Charge ID that you expect to be seeing? How do you create the test events?

outer quail
#

I place the payment to stripe and using separate project which is listening to webhook events I am testing the events

daring berry
#

maybe your "separate project" is using the API keys of a different Stripe account than the one stripe-cli is using?

outer quail
#

pi_3Px65TBYB6ebuc8B1l80aIcc
this is the payment which I placed just 5 min ago

daring berry
#

ah this is a Connect payment, right? you're using Connect with Direct Charges?

outer quail
#

Yes

#

Earlier this is working fine in local host

#

but now it is only throwing application_fee.created event

outer quail
#

ohhkk
When this update came?

daring berry
#

not sure what you mean, there's no update or anything new here

outer quail
#

this --forward-connect-to is not working for me, I think because my webhook end point is created into platform account

#

--forward-to should be working as earlier

daring berry
#

the way you do this normally is you use stripe login to connect stripe-cli to your platform account, and then you can use --forward-connect-to to listen to events that happen on your connected accounts(like events relating to payments processed as Direct Charges)

outer quail
#

but that --forward-connect-to is actually not working for me

#

I used** stripe login --api-key 'key'**
then** stripe listen --forward-to 'endpoint url'**

#

Is that okay?

daring berry
#

when you say "not working" what does that mean?

outer quail
#

It means it is not calling my webhook endpoint which was working with --forward-to

#

As I told you I created one separated azure function code which is handling my webhook events

daring berry
#

I mean it really depends what "key" is , is it your platform key, the key of a connected account , something else...

#

I told you the supported/recommended way of doing this : you use stripe login to connect stripe-cli to your platform account, and then you can use --forward-connect-to to listen to events that happen on your connected accounts(like events relating to payments processed as Direct Charges)

outer quail
#

this way also I am getting only one event same as earlier

#

What could be the cause of this only one event trigger when payment made to stripe?

daring berry
#

if you're only getting application_fee.created it's because you're running on the platform account and only listening to events that happen on the platform account(--forward-to), which is why you need to listen to Connect events via --forward-connect-to

outer quail
#

It is actually listening to connect

#

Is that correct?

daring berry
#

not sure, I've never created a restricted key this way to use with stripe-cli. Can't you just use stripe login , copy the link, open the link in your browser where you're logged into your platform account, and accept? I'd recommend that.

outer quail
#

I did the same
And that created this key

#

I used stripe login
the authorized from the link then did the stripe listen

daring berry
#

cool

#

so now if you run stripe listen --forward-connect-to=<url> , leave that Terminal window open; then go do some test payments on a connected account, what happens?

#

also if you do stripe config --list what is the value of account_id

zinc iceBOT
#

dishant_cli-connect-events

outer quail
#

the platform's account id I am getting

daring berry
#

and what ID acct_xxx is that exactly?

outer quail
#

acct_19WmAUFe0vn1lMmX

daring berry
#

sounds good. So now if you run stripe listen --forward-connect-to=<url> , leave that Terminal window open; then go do some test payments on a connected account, what happens?

#

and share the ID pi_xxx of the test payment you create

outer quail
#

I tried and it is not hitting the separate code I created to listen webhook events which is azure function code

wintry ridge
#

Hi there 👋 jumping in as my teammate needs to step away soon. Can you elaborate on what that means? Do you see the additional events being received in the CLI's output, and they just aren't being sent where you're hoping they will be?

outer quail
#

Hi @wintry ridge

#

So the issue is I am running CLI in local machine and it is only hitting for application_fee.created event

#

no other events like charge.succeeded, charge.updated, etc..
which is working fine earlier with the same code which I have right now

wintry ridge
#

To break this down a bit more, Events that are important for a Platform appear in one of two places. Either directly on the Platform account, or they are generated on a related Connected Account.

forward-to only forwards events for your account (the platform) you have to also use forward-connect-to in order to forward the Events from your Connected Accounts as well.
https://docs.stripe.com/cli/listen#listen-forward-connect-to

outer quail
#

I only got this

wintry ridge
#

What is the exact command you're using to start stripe listen?

#

That's because you aren't using forward-connect-to as well as forward-to

outer quail
#

When I use the forward-connect-to
it is actully not hitting my local host endpoint

wintry ridge
#

Can you show me that? Run stripe listen --forward-to [your_endpoint] --forward-connect-to [your_endpoint] and then make a test payment

outer quail
#

Sure above screen shot is with --forward-to [endpoint]

#

here is with -connect

#

and as you can see it does not have the [200] ok result because it does not hit the endpoint which I created

wintry ridge
#

Can you try again with both options as I suggested above? Can you also share the ID of the Payment Intent when you try that

outer quail
#

pi_3Px6vKBYB6ebuc8B1sKzagE8
with --forward-to

pi_3Px7BDBYB6ebuc8B1yIkRbJv
with --forward-connect-to

wintry ridge
#

I don't understand why you're pairing them with only one option. Are you running stripe listen with both forward-to and forward-connect-to options?

outer quail
#

Yes

#

Am I doing something wrong here?

#

If yes then what is the correct way pls tell me

wintry ridge
#

So far all of the screenshots you've shared show you only using one option (only forward-to or only forward-connect-to) when running stripe listen. You should use both of them simultaneously. Like this:
stripe listen --forward-to [your_endpoint] --forward-connect-to [your_endpoint]

outer quail
#

With that also I am getting only one event in my code

wintry ridge
#

Now I need the Payment Intent ID from that test ^

outer quail
#

pi_3Px7IzBYB6ebuc8B0o1OBXqw

wintry ridge
#

Thank you, let me take a look there.

outer quail
#

yes please

wintry ridge
#

And triple checking, you ran listen before making the confirmation request?

outer quail
#

I didn't get it

#

can you tell me what should I do to resolve this?

wintry ridge
#

I'm asking you more questions about what you're doing so I can try to spot what is going on. Part of your flow is to confirm a Payment Intent, like you did in this request:
https://dashboard.stripe.com/test/logs/req_u54YWRKZ46VpOw
I'm making sure that you had run stripe listen in your terminal before you made that confirmation request?

daring berry
#

it's because the account is only connected in live mode, not test, so test mode events don't get delivered. We'd recommend testing with fully test-mode accounts, not making test mode requests on live accounts.

#

you can technically also connect the account in test mode as well (by doing https://docs.stripe.com/connect/oauth-standard-accounts using your test mode ca_xxx client ID) but it's quite tricky and you'd need the owner of the connected account to agree.
It's easier to just use a regular test account you create.

wintry ridge
#

Great spot!

outer quail
#

Okay that means I have to try the account which is integrated into test as well as live mode
Is that correct?

wintry ridge
#

Yup

outer quail
#

I can try this and let you know

#

Thank you for your help @daring berry & @wintry ridge

#

Is there anyway that I can convert live to test acocunt?

wintry ridge
#

No. An account that can operate in livemode can also operate in testmode, there isn't a conversion that needs to happen.

outer quail
#

okay but for this case I need an acocunt which is available in both, Right?

wintry ridge