Skip to content

Commit

Permalink
Merge pull request #1875 from stripe/richardm-update-api-version-in-t…
Browse files Browse the repository at this point in the history
…ypes

Update Typescript for the new API Version
  • Loading branch information
richardm-stripe authored Aug 17, 2023
2 parents 3065b53 + f884e6e commit d4409ac
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/webhook-signing/express/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {AddressInfo} from 'net';
env.config();

const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {
apiVersion: '2022-11-15',
apiVersion: '2023-08-16',
});

const webhookSecret: string = process.env.STRIPE_WEBHOOK_SECRET;
Expand Down
2 changes: 1 addition & 1 deletion examples/webhook-signing/koa/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env.config();
const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET;

const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {
apiVersion: '2022-11-15',
apiVersion: '2023-08-16',
});

const handleWebhook = async (ctx: Koa.ParameterizedContext, next: Koa.Next) => {
Expand Down
2 changes: 1 addition & 1 deletion examples/webhook-signing/nextjs/pages/api/webhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const handler = async (
res: NextApiResponse
): Promise<void> => {
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {
apiVersion: '2022-11-15',
apiVersion: '2023-08-16',
});

const webhookSecret: string = process.env.STRIPE_WEBHOOK_SECRET;
Expand Down
2 changes: 1 addition & 1 deletion examples/webhook-signing/test/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ env.config({

const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET;
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {
apiVersion: '2022-11-15',
apiVersion: '2023-08-16',
});

const payload = Buffer.from(
Expand Down
2 changes: 1 addition & 1 deletion testProjects/cloudflare-pages/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export async function onRequestPost({env, request}) {
const body = await request.text();

const stripe = new Stripe(env.STRIPE_API_KEY, {
apiVersion: '2022-11-15',
apiVersion: '2023-08-16',
httpClient: Stripe.createFetchHttpClient(),
});
const webCrypto = Stripe.createSubtleCryptoProvider();
Expand Down
4 changes: 2 additions & 2 deletions testProjects/mjs-ts/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import DefaultStripe, {Stripe} from 'stripe';

const stripe = new Stripe(process.argv[2], {
apiVersion: '2022-11-15',
apiVersion: '2023-08-16',
host: process.env.STRIPE_MOCK_HOST || 'localhost',
port: process.env.STRIPE_MOCK_PORT || 12111,
protocol: 'http',
});
const defaultStripe = new DefaultStripe(process.argv[2], {
apiVersion: '2022-11-15',
apiVersion: '2023-08-16',
host: process.env.STRIPE_MOCK_HOST || 'localhost',
port: process.env.STRIPE_MOCK_PORT || 12111,
protocol: 'http',
Expand Down
2 changes: 1 addition & 1 deletion types/lib.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ declare module 'stripe' {
}): (...args: any[]) => Response<ResponseObject>; //eslint-disable-line @typescript-eslint/no-explicit-any
static MAX_BUFFERED_REQUEST_METRICS: number;
}
export type LatestApiVersion = '2022-11-15';
export type LatestApiVersion = '2023-08-16';
export type HttpAgent = Agent;
export type HttpProtocol = 'http' | 'https';

Expand Down
4 changes: 2 additions & 2 deletions types/test/typescriptTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Stripe from 'stripe';

let stripe = new Stripe('sk_test_123', {
apiVersion: '2022-11-15',
apiVersion: '2023-08-16',
});

// @ts-ignore lazily ignore apiVersion requirement.
Expand All @@ -27,7 +27,7 @@ stripe = new Stripe('sk_test_123', {

// Check config object.
stripe = new Stripe('sk_test_123', {
apiVersion: '2022-11-15',
apiVersion: '2023-08-16',
typescript: true,
maxNetworkRetries: 1,
timeout: 1000,
Expand Down

0 comments on commit d4409ac

Please sign in to comment.