Creating Multiple Stripe Service Implementations for Test and Production Environments

I am building a stripe service

export class StripeService extends Effect.Service<StripeService>()(
  "StripeService",
  {
    accessors: true,
    effect: Effect.gen(function* () {
      const secretKey = Deno.env.get("STRIPE_SECRET_KEY")!;
      const webhookSecret = Deno.env.get("STRIPE_WEBHOOK_SECRET")!;

      const config = yield* Schema.decodeUnknownEither(StripeConfigSchema)({
        secretKey,
        apiVersion: "2025-07-30.basil",
        webhookSecret,
      });

      return new Stripe(config.secretKey, {
        apiVersion: config.apiVersion,
        typescript: true,
      });
    }),
  }
) {}


And I would like to have 2 different implementations, one which uses test env and one which uses real env, how can I do this?
Was this page helpful?