Skip to content

Commit

Permalink
Merge pull request #1744 from stripe/sdk-release/next-major
Browse files Browse the repository at this point in the history
stripe-node v12
  • Loading branch information
richardm-stripe authored Apr 6, 2023
2 parents 81881e5 + 4560e06 commit 634b7dc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ We therefore encourage [upgrading your API version][api-version-upgrading]
if you would like to take advantage of Stripe's TypeScript definitions.

If you are on an older API version (e.g., `2019-10-17`) and not able to upgrade,
you may pass another version or `apiVersion: null` to use your account's default API version,
and use a comment like `// @ts-ignore stripe-version-2019-10-17` to silence type errors here
you may pass another version and use a comment like `// @ts-ignore stripe-version-2019-10-17` to silence type errors here
and anywhere the types differ between your API version and the latest.
When you upgrade, you should remove these comments.

Expand Down Expand Up @@ -176,7 +175,7 @@ const stripe = Stripe('sk_test_...', {

| Option | Default | Description |
| ------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `apiVersion` | `null` | Stripe API version to be used. If not set the account's default version will be used. |
| `apiVersion` | `null` | Stripe API version to be used. If not set, stripe-node will use the latest version at the time of release. |
| `maxNetworkRetries` | 0 | The amount of times a request should be [retried](#network-retries). |
| `httpAgent` | `null` | [Proxy](#configuring-a-proxy) agent to be used by the library. |
| `timeout` | 80000 | [Maximum time each request can take in ms.](#configuring-timeout) |
Expand Down
8 changes: 2 additions & 6 deletions src/stripe.core.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as _Error from './Error.js';
import * as apiVersion from './apiVersion.js';
import * as resources from './resources.js';
import {HttpClient, HttpClientResponse} from './net/HttpClient.js';
import {
Expand All @@ -16,7 +17,7 @@ import {StripeObject, AppInfo, UserProvidedConfig} from './Types.js';
const DEFAULT_HOST = 'api.stripe.com';
const DEFAULT_PORT = '443';
const DEFAULT_BASE_PATH = '/v1/';
const DEFAULT_API_VERSION = (null as unknown) as string;
const DEFAULT_API_VERSION = apiVersion.ApiVersion;

const DEFAULT_TIMEOUT = 80000;

Expand Down Expand Up @@ -63,11 +64,6 @@ export function createStripe(
Stripe.HttpClientResponse = HttpClientResponse;
Stripe.CryptoProvider = CryptoProvider;

// For backwards compatibiblity after moving to separate CJS and ESM entrypoints.
// To be removed in the next major version.
Stripe.Stripe = Stripe;
Stripe.default = Stripe;

function Stripe(
this: StripeObject,
key: string,
Expand Down
3 changes: 2 additions & 1 deletion test/stripe.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {FetchHttpClient} from '../cjs/net/FetchHttpClient.js';
import {NodeHttpClient} from '../cjs/net/NodeHttpClient.js';
import {createStripe} from '../cjs/stripe.core.js';
import {getMockPlatformFunctions} from './testUtils.js';
import {ApiVersion} from '../cjs/apiVersion.js';

const testUtils = require('./testUtils.js');
const Stripe = require('../cjs/stripe.cjs.node.js');
Expand Down Expand Up @@ -119,7 +120,7 @@ describe('Stripe Module', function() {

cases.forEach((item) => {
const newStripe = Stripe(testUtils.getUserStripeKey(), item);
expect(newStripe.getApiField('version')).to.equal(null);
expect(newStripe.getApiField('version')).to.equal(ApiVersion);
});
});

Expand Down
3 changes: 0 additions & 3 deletions testProjects/mjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ assert(Stripe.StripeResource.MAX_BUFFERED_REQUEST_METRICS);
assert(Stripe.webhooks);
assert(Stripe.resources);

assert(Stripe.Stripe);
assert(Stripe.default);

const stripe = new Stripe(process.argv[2]);
const defaultStripe = new DefaultStripe(process.argv[2]);

Expand Down

0 comments on commit 634b7dc

Please sign in to comment.