cf: fix stripe api issue by setting httpClient

This commit is contained in:
javayhu 2025-06-17 22:35:27 +08:00
parent 86f13a1748
commit 19a6c4d994

View File

@ -48,7 +48,13 @@ export class StripeProvider implements PaymentProvider {
}
// Initialize Stripe without specifying apiVersion to use default/latest version
this.stripe = new Stripe(apiKey);
// https://opennext.js.org/cloudflare/howtos/stripeAPI
// When creating a Stripe object, the default http client implementation is based on
// node:https which is not implemented on Workers.
this.stripe = new Stripe(apiKey, {
// Cloudflare Workers use the Fetch API for their API requests.
httpClient: Stripe.createFetchHttpClient(),
});
this.webhookSecret = webhookSecret;
}