Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pages/cloudflare/howtos/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"NextAuth": "NextAuth",
"stripeAPI": "Stripe API"
}
16 changes: 16 additions & 0 deletions pages/cloudflare/howtos/stripeAPI.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

## [Stripe API](https://www.npmjs.com/package/stripe)

When [creating a Stripe object](https://docs.stripe.com/js/initializing), the default http client implementation is based on `node:https` which is not implemented on Workers.

However you can use an http client based on fetch ([`FetchHttpClient`](https://github.com/stripe/stripe-node/blob/54d423e5d1118dc35c4b76260889826003e00e9f/src/net/FetchHttpClient.ts)) via the `httpClient` option:

```ts
import Stripe from "stripe";

const stripe = Stripe(STRIPE_API_KEY, {
// Cloudflare Workers use the Fetch API for their API requests.
httpClient: Stripe.createFetchHttpClient()
});
```