#Anjan-webhooks-salesforce

1 messages · Page 1 of 1 (latest)

fickle ore
#

hello, how is the Salesforce endpoint authenticated?

azure bone
#

It needs a token in the header of the request.

#

Currently what I get is Invalid Session ID

fickle ore
#

yeah our webhooks don't support any custom headers being sent with them

#

so you'll have to build your webhook endpoint at a place that doesn't require header based authentication

azure bone
#

Hmm .. So we have to build a public site and expose this rest endpoint

#

Any sample code to verify signature or secret to trust the message on the Salesforce side ?

fickle ore
#

yes

azure bone
#

I am able to get signature from the request but what would be the next thing ? Should I prepare signed_payload on the salesforce side ?

fickle ore
#

you have to verify the signature, most stripe server libraries incorporate a helper to do that

#

the doc I linked you has all the steps

azure bone
#

Do I make a call from salesforce to strip to verify again ??

#

Another API to call hit stripe and verify .. looking at ways to verify on salesforce itself

fickle ore
#

not sure I understand what you mean

#

basically all it is is that Stripe sends a webhook evnet to your endpoint

you verify signatures to verify it was from Stripe

you respond with a 200 HTTP status code to let Stripe know "you've received the event!"

and then you process the event in your code whether that endpoint does it or you talk to your Salesforce endpoint to do the actual processing

#

let me know if that helps!

#

a colleague is stepping in but feel free to ask more qs

azure bone
#

If all what I needed is in teh request then no need to make callout to stripe. Which is good news. I just need to figure out how I could generate load and verify.

#

If there is a sample code to verify signatures on salesforce/apex, please share along.

fierce spade
#

Hi 👋 I'm stepping in for @fickle ore

#

I don't think we have docs specific to Salesforce/Apex on verifying webhook signatures.

azure bone
#

ok

#

Do I need signing secret on the webhook to compare the signatures ?

fierce spade
#

As our docs provided mention, you need the raw request body, the signing secret from the webhook, and the Stripe signature header.

azure bone
#

Now I have the body, secret from webhook and signature header

#

just need to figure out how I can compare and verify

fierce spade
#

Can you use any of the Stripe libraries (PHP, Python, Go, etc.)?

azure bone
#

I have to use apex on the salesforce side

fierce spade
azure bone
#

When you say manually, I need follow step 1 through 4 in the doc you shared ?

fierce spade
#

I'm saying you should thoroughly review the doc I shared and make sure you clearly understand it before attempting to build anything.

azure bone
#

OK

#

Thanks !!