chore: update stripe webhook example (#33774)

* Chore: Update stripe-webhooks.mdx

* Update index.ts
This commit is contained in:
Rodrigo Mansueli authored and GitHub committed 2025-02-21 15:30:13 -03:00
1 parent 9a59de73ed
commit aea6ad069b
2 files changed
+9 -4

No files matched your search

@@ -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"
/>
@@ -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/stripe@11.1.0?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 })
})
});