#andrewl1030

1 messages · Page 1 of 1 (latest)

left rootBOT
opal birch
#

Hi 👋

#

You're attempting to verify a Webhook signature, correct?

gritty apex
#

No, i am trying to verify the signature of a request from my app UI, not a webhook

opal birch
#

Ah, okay same error message

#

I ran into something similar in my Flask back-end for a test Stripe App. Here's the code snippet I used to create the payload to verify the signatures

payload = json.dumps(
            {'user_id': data['user_id'], 'account_id': data['account_id']},
            separators=(',', ':')
        )
        header_kwargs = {'payload': payload,
                         'header': sig_header, 'secret': APP_SECRET}
        try:
            stripe.WebhookSignature.verify_header(**header_kwargs)
gritty apex
#

that worked! The separators piece was what I needed, thank you!