Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: update stripe webhook example (#33774)

Rodrigo Mansueliaea6ad069b1c
diff --git a/apps/docs/content/guides/functions/examples/stripe-webhooks.mdx b/apps/docs/content/guides/functions/examples/stripe-webhooks.mdx
index d95378ffdc0..60bcf64cf3d 100644
--- a/apps/docs/content/guides/functions/examples/stripe-webhooks.mdx
+++ b/apps/docs/content/guides/functions/examples/stripe-webhooks.mdx
@@ -13,3 +13,9 @@ description: 'Handling signed Stripe Webhooks with Edge Functions.'
</div>
Handling signed Stripe Webhooks with Edge Functions. [View on GitHub](https://github.com/supabase/supabase/blob/master/examples/edge-functions/supabase/functions/stripe-webhooks/index.ts).
+
+<$CodeSample
+path="edge-functions/supabase/functions/stripe-webhooks/index.ts"
+lines={[[1, -1]]}
+meta="index.ts"
+/>
diff --git a/examples/edge-functions/supabase/functions/stripe-webhooks/index.ts b/examples/edge-functions/supabase/functions/stripe-webhooks/index.ts
index 7eb7eeb3111..6622303d3d1 100644
--- a/examples/edge-functions/supabase/functions/stripe-webhooks/index.ts
+++ b/examples/edge-functions/supabase/functions/stripe-webhooks/index.ts
@@ -3,13 +3,12 @@
// This enables autocomplete, go to definition, etc.
// Import via bare specifier thanks to the import_map.json file.
-import Stripe from 'https://esm.sh/[email protected]?target=deno'
+import Stripe from 'https://esm.sh/stripe@14?target=denonext'
const stripe = new Stripe(Deno.env.get('STRIPE_API_KEY') as string, {
// This is needed to use the Fetch API rather than relying on the Node http
// package.
- apiVersion: '2022-11-15',
- httpClient: Stripe.createFetchHttpClient(),
+ apiVersion: '2024-11-20'
})
// This is needed in order to use the Web Crypto API in Deno.
const cryptoProvider = Stripe.createSubtleCryptoProvider()
@@ -36,4 +35,4 @@ Deno.serve(async (request) => {
}
console.log(`🔔 Event received: ${receivedEvent.id}`)
return new Response(JSON.stringify({ ok: true }), { status: 200 })
-})
+});