Skip to content

Adds parseEventNotificationAsync to match existing sync function#2685

Merged
xavdid merged 2 commits intostripe:masterfrom
pedroits:master
Apr 14, 2026
Merged

Adds parseEventNotificationAsync to match existing sync function#2685
xavdid merged 2 commits intostripe:masterfrom
pedroits:master

Conversation

@pedroits
Copy link
Copy Markdown
Contributor

Why?

In environments like Supabase Edge Functions (Deno), Cloudflare Workers, and Vercel Edge:

  • constructEventAsync does not support v2.core.event webhooks
  • It suggests using stripe.parseEventNotification
  • However, parseEventNotification relies on a synchronous crypto provider

This results in the runtime error:


SubtleCryptoProvider cannot be used in a synchronous context

Since these environments only support asynchronous cryptography, there is currently no way to validate v2.core.event webhooks.

What?

  • Added parseEventNotificationAsync implementation
  • Preserved backward compatibility (no changes to existing sync APIs)
  • updated tests

Usage

const event = await stripe.parseEventNotificationAsync(
  body,
  signature,
  endpointSecret
);

Notes

  • No breaking changes
  • Unblocks Stripe webhook validation in modern edge runtimes
    • Supabase Edge Functions
    • Cloudflare Workers
    • Vercel Edge Functions
  • Aligns SDK behavior with existing async patterns (constructEventAsync)
    • About this, i didn't like how it was done (function/code duplication) but it was done following the same bad patterns as in constructEvent and constructEventAsync

See Also

@pedroits pedroits requested a review from a team as a code owner April 14, 2026 20:28
@pedroits pedroits requested review from jar-stripe and removed request for a team April 14, 2026 20:28
@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented Apr 14, 2026

CLA assistant check
All committers have signed the CLA.

@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented Apr 14, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented Apr 14, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@xavdid
Copy link
Copy Markdown
Member

xavdid commented Apr 14, 2026

Thank you for the submission and sorry for the bug. Looks like the formatter needs to run but the PR itself looks good.

About this, i didn't like how it was done (function/code duplication) but it was done following the same bad patterns as in constructEvent and constructEventAsync

Yeah, we'll get that cleaned up on our end, no worries.

@xavdid xavdid changed the title Adds an async version of stripe.parseEventNotification Adds parseEventNotificationAsync to match existing sync function Apr 14, 2026
@xavdid xavdid merged commit 7ae0d66 into stripe:master Apr 14, 2026
7 checks passed
@fredkzk
Copy link
Copy Markdown

fredkzk commented Apr 16, 2026

Which version includes this? I cant find it in my node_modules yet. I'm with v22.0.1

@prathmesh-stripe
Copy link
Copy Markdown
Contributor

@fredkzk We shipped this in our latest v22.0.2 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants