@paykit-sdk/stripe 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -885,10 +885,11 @@ var StripeProvider = class extends core.AbstractPayKitProvider {
885
885
  }
886
886
  return results;
887
887
  };
888
- const { debug = true, apiKey, ...rest } = opts;
889
- this.stripe = new Stripe__default.default(apiKey, rest);
890
- this.opts = opts;
891
- this.isSandbox = opts.isSandbox;
888
+ const { debug, apiKey, isSandbox, ...stripeConfig } = opts;
889
+ const resolvedSandbox = isSandbox ?? apiKey.includes("_test_");
890
+ this.stripe = new Stripe__default.default(apiKey, stripeConfig);
891
+ this.opts = { ...opts, debug: debug ?? resolvedSandbox };
892
+ this.isSandbox = resolvedSandbox;
892
893
  }
893
894
  get _native() {
894
895
  return this.stripe;
@@ -905,12 +906,10 @@ var stripe = () => {
905
906
  process.env ?? {},
906
907
  "Missing required environment variables: {keys}"
907
908
  );
908
- const isSandbox = process.env.NODE_ENV === "development";
909
909
  return createStripe({
910
910
  apiKey: envVars.STRIPE_API_KEY,
911
- isSandbox,
912
- debug: isSandbox,
913
- apiVersion: "2025-07-30.basil"
911
+ apiVersion: "2025-07-30.basil",
912
+ isSandbox: envVars.STRIPE_API_KEY.includes("_test_") || process.env.NODE_ENV !== "production"
914
913
  });
915
914
  };
916
915
 
package/dist/index.mjs CHANGED
@@ -879,10 +879,11 @@ var StripeProvider = class extends AbstractPayKitProvider {
879
879
  }
880
880
  return results;
881
881
  };
882
- const { debug = true, apiKey, ...rest } = opts;
883
- this.stripe = new Stripe(apiKey, rest);
884
- this.opts = opts;
885
- this.isSandbox = opts.isSandbox;
882
+ const { debug, apiKey, isSandbox, ...stripeConfig } = opts;
883
+ const resolvedSandbox = isSandbox ?? apiKey.includes("_test_");
884
+ this.stripe = new Stripe(apiKey, stripeConfig);
885
+ this.opts = { ...opts, debug: debug ?? resolvedSandbox };
886
+ this.isSandbox = resolvedSandbox;
886
887
  }
887
888
  get _native() {
888
889
  return this.stripe;
@@ -899,12 +900,10 @@ var stripe = () => {
899
900
  process.env ?? {},
900
901
  "Missing required environment variables: {keys}"
901
902
  );
902
- const isSandbox = process.env.NODE_ENV === "development";
903
903
  return createStripe({
904
904
  apiKey: envVars.STRIPE_API_KEY,
905
- isSandbox,
906
- debug: isSandbox,
907
- apiVersion: "2025-07-30.basil"
905
+ apiVersion: "2025-07-30.basil",
906
+ isSandbox: envVars.STRIPE_API_KEY.includes("_test_") || process.env.NODE_ENV !== "production"
908
907
  });
909
908
  };
910
909
 
@@ -9,6 +9,7 @@ interface StripeMetadata extends ProviderMetadataRegistry {
9
9
  refund: Stripe.RefundCreateParams;
10
10
  }
11
11
  interface StripeOptions extends PaykitProviderOptions, Stripe.StripeConfig {
12
+ /** Stripe secret key (sk_test_... or sk_live_...) */
12
13
  apiKey: string;
13
14
  }
14
15
  type StripeRawEvents = {
@@ -9,6 +9,7 @@ interface StripeMetadata extends ProviderMetadataRegistry {
9
9
  refund: Stripe.RefundCreateParams;
10
10
  }
11
11
  interface StripeOptions extends PaykitProviderOptions, Stripe.StripeConfig {
12
+ /** Stripe secret key (sk_test_... or sk_live_...) */
12
13
  apiKey: string;
13
14
  }
14
15
  type StripeRawEvents = {
@@ -885,10 +885,11 @@ var StripeProvider = class extends core.AbstractPayKitProvider {
885
885
  }
886
886
  return results;
887
887
  };
888
- const { debug = true, apiKey, ...rest } = opts;
889
- this.stripe = new Stripe__default.default(apiKey, rest);
890
- this.opts = opts;
891
- this.isSandbox = opts.isSandbox;
888
+ const { debug, apiKey, isSandbox, ...stripeConfig } = opts;
889
+ const resolvedSandbox = isSandbox ?? apiKey.includes("_test_");
890
+ this.stripe = new Stripe__default.default(apiKey, stripeConfig);
891
+ this.opts = { ...opts, debug: debug ?? resolvedSandbox };
892
+ this.isSandbox = resolvedSandbox;
892
893
  }
893
894
  get _native() {
894
895
  return this.stripe;
@@ -879,10 +879,11 @@ var StripeProvider = class extends AbstractPayKitProvider {
879
879
  }
880
880
  return results;
881
881
  };
882
- const { debug = true, apiKey, ...rest } = opts;
883
- this.stripe = new Stripe(apiKey, rest);
884
- this.opts = opts;
885
- this.isSandbox = opts.isSandbox;
882
+ const { debug, apiKey, isSandbox, ...stripeConfig } = opts;
883
+ const resolvedSandbox = isSandbox ?? apiKey.includes("_test_");
884
+ this.stripe = new Stripe(apiKey, stripeConfig);
885
+ this.opts = { ...opts, debug: debug ?? resolvedSandbox };
886
+ this.isSandbox = resolvedSandbox;
886
887
  }
887
888
  get _native() {
888
889
  return this.stripe;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paykit-sdk/stripe",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Stripe provider for PayKit",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",