stripe 11.18.0 → 12.0.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 12.0.0 - 2023-04-06
4
+ * [#1743](https://github.com/stripe/stripe-node/pull/1743) Remove `Stripe.default` and `Stripe.Stripe`
5
+ This was added to maintain backwards compatibility during the transition of stripe-node to a dual ES module / CommonJS package, and should not be functionally necessary.
6
+ * [#1742](https://github.com/stripe/stripe-node/pull/1743) Pin latest API version as the default
7
+ **⚠️ ACTION REQUIRED: the breaking change in this release likely affects you ⚠️**
8
+
9
+ In this release, Stripe API Version `2022-11-15` (the latest at time of release) will be sent by default on all requests.
10
+ The previous default was to use your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version).
11
+
12
+ To successfully upgrade to stripe-node v12, you must either
13
+
14
+ 1. **(Recommended) Upgrade your integration to be compatible with API Version `2022-11-15`.**
15
+
16
+ Please read the API Changelog carefully for each API Version from `2022-11-15` back to your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version). Determine if you are using any of the APIs that have changed in a breaking way, and adjust your integration accordingly. Carefully test your changes with Stripe [Test Mode](https://stripe.com/docs/keys#test-live-modes) before deploying them to production.
17
+
18
+ You can read the [v12 migration guide](https://github.com/stripe/stripe-node/wiki/Migration-guide-for-v12) for more detailed instructions.
19
+ 2. **(Alternative option) Specify a version other than `2022-11-15` when initializing `stripe-node`.**
20
+
21
+ If you were previously initializing stripe-node without an explicit API Version, you can postpone modifying your integration by specifying a version equal to your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version). For example:
22
+
23
+ ```diff
24
+ - const stripe = require('stripe')('sk_test_...');
25
+ + const stripe = require('stripe')('sk_test_...', {
26
+ + apiVersion: 'YYYY-MM-DD' // Determine your default version from https://dashboard.stripe.com/developers
27
+ + })
28
+ ```
29
+
30
+ If you were already initializing stripe-node with an explicit API Version, upgrading to v12 will not affect your integration.
31
+
32
+ Read the [v12 migration guide](https://github.com/stripe/stripe-node/wiki/Migration-guide-for-v12) for more details.
33
+
34
+ Going forward, each major release of this library will be *pinned* by default to the latest Stripe API Version at the time of release.
35
+ That is, instead of upgrading stripe-node and separately upgrading your Stripe API Version through the Stripe Dashboard. whenever you upgrade major versions of stripe-node, you should also upgrade your integration to be compatible with the latest Stripe API version.
36
+
3
37
  ## 11.18.0 - 2023-04-06
4
38
  * [#1738](https://github.com/stripe/stripe-node/pull/1738) Update generated code
5
39
  * Add support for new value `link` on enums `Charge.payment_method_details.card.wallet.type` and `PaymentMethod.card.wallet.type`
package/README.md CHANGED
@@ -97,8 +97,7 @@ We therefore encourage [upgrading your API version][api-version-upgrading]
97
97
  if you would like to take advantage of Stripe's TypeScript definitions.
98
98
 
99
99
  If you are on an older API version (e.g., `2019-10-17`) and not able to upgrade,
100
- you may pass another version or `apiVersion: null` to use your account's default API version,
101
- and use a comment like `// @ts-ignore stripe-version-2019-10-17` to silence type errors here
100
+ you may pass another version and use a comment like `// @ts-ignore stripe-version-2019-10-17` to silence type errors here
102
101
  and anywhere the types differ between your API version and the latest.
103
102
  When you upgrade, you should remove these comments.
104
103
 
@@ -176,7 +175,7 @@ const stripe = Stripe('sk_test_...', {
176
175
 
177
176
  | Option | Default | Description |
178
177
  | ------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
179
- | `apiVersion` | `null` | Stripe API version to be used. If not set the account's default version will be used. |
178
+ | `apiVersion` | `null` | Stripe API version to be used. If not set, stripe-node will use the latest version at the time of release. |
180
179
  | `maxNetworkRetries` | 0 | The amount of times a request should be [retried](#network-retries). |
181
180
  | `httpAgent` | `null` | [Proxy](#configuring-a-proxy) agent to be used by the library. |
182
181
  | `timeout` | 80000 | [Maximum time each request can take in ms.](#configuring-timeout) |
package/VERSION CHANGED
@@ -1 +1 @@
1
- 11.18.0
1
+ 12.0.0
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createStripe = void 0;
4
4
  const _Error = require("./Error.js");
5
+ const apiVersion = require("./apiVersion.js");
5
6
  const resources = require("./resources.js");
6
7
  const HttpClient_js_1 = require("./net/HttpClient.js");
7
8
  const utils_js_1 = require("./utils.js");
@@ -12,7 +13,7 @@ const Webhooks_js_1 = require("./Webhooks.js");
12
13
  const DEFAULT_HOST = 'api.stripe.com';
13
14
  const DEFAULT_PORT = '443';
14
15
  const DEFAULT_BASE_PATH = '/v1/';
15
- const DEFAULT_API_VERSION = null;
16
+ const DEFAULT_API_VERSION = apiVersion.ApiVersion;
16
17
  const DEFAULT_TIMEOUT = 80000;
17
18
  const MAX_NETWORK_RETRY_DELAY_SEC = 2;
18
19
  const INITIAL_NETWORK_RETRY_DELAY_SEC = 0.5;
@@ -33,17 +34,13 @@ const ALLOWED_CONFIG_PROPERTIES = [
33
34
  ];
34
35
  const defaultRequestSenderFactory = (stripe) => new RequestSender_js_1.RequestSender(stripe, StripeResource_js_1.StripeResource.MAX_BUFFERED_REQUEST_METRICS);
35
36
  function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) {
36
- Stripe.PACKAGE_VERSION = '11.18.0';
37
+ Stripe.PACKAGE_VERSION = '12.0.0';
37
38
  Stripe.USER_AGENT = Object.assign({ bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', publisher: 'stripe', uname: null, typescript: false }, (0, utils_js_1.determineProcessUserAgentProperties)());
38
39
  Stripe.StripeResource = StripeResource_js_1.StripeResource;
39
40
  Stripe.resources = resources;
40
41
  Stripe.HttpClient = HttpClient_js_1.HttpClient;
41
42
  Stripe.HttpClientResponse = HttpClient_js_1.HttpClientResponse;
42
43
  Stripe.CryptoProvider = CryptoProvider_js_1.CryptoProvider;
43
- // For backwards compatibiblity after moving to separate CJS and ESM entrypoints.
44
- // To be removed in the next major version.
45
- Stripe.Stripe = Stripe;
46
- Stripe.default = Stripe;
47
44
  function Stripe(key, config = {}) {
48
45
  if (!(this instanceof Stripe)) {
49
46
  return new Stripe(key, config);
@@ -1,4 +1,5 @@
1
1
  import * as _Error from './Error.js';
2
+ import * as apiVersion from './apiVersion.js';
2
3
  import * as resources from './resources.js';
3
4
  import { HttpClient, HttpClientResponse } from './net/HttpClient.js';
4
5
  import { determineProcessUserAgentProperties, pascalToCamelCase, validateInteger, } from './utils.js';
@@ -9,7 +10,7 @@ import { createWebhooks } from './Webhooks.js';
9
10
  const DEFAULT_HOST = 'api.stripe.com';
10
11
  const DEFAULT_PORT = '443';
11
12
  const DEFAULT_BASE_PATH = '/v1/';
12
- const DEFAULT_API_VERSION = null;
13
+ const DEFAULT_API_VERSION = apiVersion.ApiVersion;
13
14
  const DEFAULT_TIMEOUT = 80000;
14
15
  const MAX_NETWORK_RETRY_DELAY_SEC = 2;
15
16
  const INITIAL_NETWORK_RETRY_DELAY_SEC = 0.5;
@@ -30,17 +31,13 @@ const ALLOWED_CONFIG_PROPERTIES = [
30
31
  ];
31
32
  const defaultRequestSenderFactory = (stripe) => new RequestSender(stripe, StripeResource.MAX_BUFFERED_REQUEST_METRICS);
32
33
  export function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) {
33
- Stripe.PACKAGE_VERSION = '11.18.0';
34
+ Stripe.PACKAGE_VERSION = '12.0.0';
34
35
  Stripe.USER_AGENT = Object.assign({ bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', publisher: 'stripe', uname: null, typescript: false }, determineProcessUserAgentProperties());
35
36
  Stripe.StripeResource = StripeResource;
36
37
  Stripe.resources = resources;
37
38
  Stripe.HttpClient = HttpClient;
38
39
  Stripe.HttpClientResponse = HttpClientResponse;
39
40
  Stripe.CryptoProvider = CryptoProvider;
40
- // For backwards compatibiblity after moving to separate CJS and ESM entrypoints.
41
- // To be removed in the next major version.
42
- Stripe.Stripe = Stripe;
43
- Stripe.default = Stripe;
44
41
  function Stripe(key, config = {}) {
45
42
  if (!(this instanceof Stripe)) {
46
43
  return new Stripe(key, config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stripe",
3
- "version": "11.18.0",
3
+ "version": "12.0.0",
4
4
  "description": "Stripe API wrapper",
5
5
  "keywords": [
6
6
  "stripe",