#mhassaan

1 messages ยท Page 1 of 1 (latest)

jovial wedgeBOT
ocean badger
#

Hi, are you able to share more context here?

#

@tidal aurora - created this thread for us

#

Moving the last bit to this thread

tidal aurora
#

sure, i have one main stripe account, using this main account i create subscriptions and payment links in the connected accounts. Now on successfull checkout session i receive webhook events, if the payment link that i used to pay belongs to patoform account then i receive the events susccessfully, however if payment link belongs to connected account then i receive Webhook signature verification failed. error. I assume that this error is because i am using whsec from main account only.

ocean badger
#

yes, this event occurs when the Checkout Session is successfully completed.

tidal aurora
#

https://mysite/webhooks gives me one sec for main account , i want to use the same URL for connected account which would give me second secret, my question is how would i be able to determine inside code which secret to use ?

ocean badger
#

Actually, can you share the Event id with me please?

tidal aurora
#

you mean events i am listening to or actual event_id recieved on receiving webhook?

ocean badger
#

The event id that is seeing this error.

tidal aurora
#

just give me sometime and i get back to you

#

evt_1LiOrFGvzOPd2uKlnrSsiQbK
belongs to checkout.session.completed

ocean badger
#

Thank you, taking a look here

#

It appears that you have both of the secret keys in the Stripe-Signature on that request so that will not work as it has to exactly match the secret key shown in the Dashboard.

Can you confirm that you're seeking to use the same URL for both the platform account and the connected account? You're wondering how to achieve this with the signature verification piece. Is that correct?

tidal aurora
#

exactly you got it right

#

i am wondering how to play with this signature verification stuff for these two different keys on the same URL

normal oracle
#

(as a User) I use two separate routes for /direct and /connect - they go to the same handler (as express structure), and the Express route differentiates so I can use the separate secrets...

#

happy to share node/JS code, if you want

fierce orbit
#

๐Ÿ‘‹ stepping in for pgskc

#

As GigStartr noted, you want two different endpoints here

tidal aurora
#

i agree, using two different routes can be the solution. also i was wondering i could decide based on presence of account params in the response, something like this

    if account
      webhook_secret = ENV["webhook_secret_connected"]
    else
      webhook_secret = ENV["webhook_secret_direct"]
    end
fierce orbit
#

No that doesn't work since you construct the event based on the raw request body