You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide a public helper to sign webhook data #1697
Is your feature request related to a problem? Please describe.
The Node SDK provides a generateTestHeaderString() utility to manually sign payloads for testing. It would be great to have a similar utility in the Python SDK.
We currently copy over this internal test fixture, but the signing logic is an internal detail that can change at any point in time.
Hi @Viicos! Thanks for creating this issue! I agree that we should have a test payload-signing utility in Python similar to what we have in Node. For now, your workaround is sound since that logic is unlikely to change for the foreseeable future, but there should be an affordance to abstract away that logic.
We have added this to our backlog, but we will need to evaluate it against other planned work. In the meantime, you can keep your current workaround, or feel free to create a PR to address this issue.
Hi! I’m interested in working on this issue and would like to explore a PR. I’ll start by reviewing the existing internal signing logic and the Node SDK helper.
Hi @kartheek0107, are you still planning to work on this? If not, I’d be happy to take it on with a scoped PR for a public webhook test-signing helper and tests. If I don’t hear back in about a week, I’ll plan to start on it.
Hi @Zhang-Charlie, thanks for checking in! I actually have the logic mapped out from the Node SDK and was planning to push a PR this week. I'll have a draft up by [Wednesday/Thursday]. If I don't hit that, feel free to take over!
Hi @mbroshi-stripe, I've opened #1810 to address this. Below are some notes on the implementation and i'm happy to update the implementation based on your feedback.
What it adds
A public WebhookSignature.generate_test_header_string() helper, mirroring stripe-node's generateTestHeaderString().
Placed on WebhookSignature rather than Webhook, since that's where EXPECTED_SCHEME, _compute_signature, and verify_header already live. Happy to move it to Webhook if you'd prefer a 1:1 surface with stripe-node.
Keyword arguments instead of an options dict which is idiomatic in Python, while preserving the full Node parameter surface: payload, secret, timestamp, scheme, signature.
Defaults match Node:
classmethod so EXPECTED_SCHEME is the default for scheme, consistent with how verify_header is structured.
No async variant. stripe-node has one only because of its CryptoProvider abstraction while the Python SDK's signing path is synchronous.
@kartheek0107@Zhang-Charlie apologies for the overlap. I saw this one being open for a while, so took a stab at it. I'm happy to defer or coordinate if either of you already has something in flight.
Activity
mbroshi-stripe commentedon Dec 16, 2025
Hi @Viicos! Thanks for creating this issue! I agree that we should have a test payload-signing utility in Python similar to what we have in Node. For now, your workaround is sound since that logic is unlikely to change for the foreseeable future, but there should be an affordance to abstract away that logic.
We have added this to our backlog, but we will need to evaluate it against other planned work. In the meantime, you can keep your current workaround, or feel free to create a PR to address this issue.
kartheek0107 commentedon Dec 27, 2025
Hi! I’m interested in working on this issue and would like to explore a PR. I’ll start by reviewing the existing internal signing logic and the Node SDK helper.
Please let me know if that sounds good.
Zhang-Charlie commentedon Apr 17, 2026
Hi @kartheek0107, are you still planning to work on this? If not, I’d be happy to take it on with a scoped PR for a public webhook test-signing helper and tests. If I don’t hear back in about a week, I’ll plan to start on it.
kartheek0107 commentedon Apr 19, 2026
Hi @Zhang-Charlie, thanks for checking in! I actually have the logic mapped out from the Node SDK and was planning to push a PR this week. I'll have a draft up by [Wednesday/Thursday]. If I don't hit that, feel free to take over!
vishwakt commentedon May 14, 2026
Hi @mbroshi-stripe, I've opened #1810 to address this. Below are some notes on the implementation and i'm happy to update the implementation based on your feedback.
What it adds
A public
WebhookSignature.generate_test_header_string()helper, mirroring stripe-node'sgenerateTestHeaderString().Design choices
WebhookSignaturerather thanWebhook, since that's whereEXPECTED_SCHEME,_compute_signature, andverify_headeralready live. Happy to move it toWebhookif you'd prefer a 1:1 surface with stripe-node.payload,secret,timestamp,scheme,signature.classmethodsoEXPECTED_SCHEMEis the default forscheme, consistent with howverify_headeris structured.CryptoProviderabstraction while the Python SDK's signing path is synchronous.@kartheek0107 @Zhang-Charlie apologies for the overlap. I saw this one being open for a while, so took a stab at it. I'm happy to defer or coordinate if either of you already has something in flight.
xavdid commentedon Aug 10, 2026
This was added in
v15.5.0asstripe.WebhookSignature.generate_signature_header(...)Thank you for filing!