Repository: stripe/stripe-node
Pull request #1686 (2023-02-16 19:23:55)

API Updates for beta branch
Codegen for openapi v226.
cc @stripe/api-libraries

## Changelog
* Updated stable APIs to the latest version
* Change type of `Quote.status_details.canceled` from `QuotesResourceStatusDetailsCanceledStatusDetails | null` to `QuotesResourceStatusDetailsCanceledStatusDetails`
* Change type of `Quote.status_details.stale` from `QuotesResourceStatusDetailsStaleStatusDetails | null` to `QuotesResourceStatusDetailsStaleStatusDetails`
* Change `Quote.status_details.canceled` and `Quote.status_details.stale` to be optional
* Remove support for `reference` on `Tax.Calculation` and `TaxCalculationCreateParams`
* Add support for `reference` on `TaxTransactionCreateParams`




Patch:
diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION
index 6c06b023..72a2ee91 100644
--- a/OPENAPI_VERSION
+++ b/OPENAPI_VERSION
@@ -1,1 +1,1 @@
-v224
\ No newline at end of file
+v226
\ No newline at end of file
diff --git a/examples/webhook-signing/README.md b/examples/webhook-signing/README.md
index a2ffd3c9..ad7e17c4 100644
--- a/examples/webhook-signing/README.md
+++ b/examples/webhook-signing/README.md
@@ -5,6 +5,7 @@ Verify the events that Stripe sends to your webhook endpoints. Additional detail
 Available examples:
 - [`express`](./express) - Express 4
 - [`koa`](./koa) - Koa 2
+- [`nextjs`](./nextjs) - NextJS 13
 
 ### Requirements
 
diff --git a/examples/webhook-signing/express/package.json b/examples/webhook-signing/express/package.json
index 620ba75f..7e2a174d 100644
--- a/examples/webhook-signing/express/package.json
+++ b/examples/webhook-signing/express/package.json
@@ -21,6 +21,7 @@
     "@types/koa": "^2.13.5",
     "@types/koa-bodyparser": "^4.3.10",
     "@types/node": "^13.1.4",
-    "typescript": "^4.8.3"
+    "typescript": "^4.8.3",
+    "ts-node": "^10.9.1"
   }
 }
diff --git a/examples/webhook-signing/nextjs/.gitignore b/examples/webhook-signing/nextjs/.gitignore
new file mode 100644
index 00000000..a680367e
--- /dev/null
+++ b/examples/webhook-signing/nextjs/.gitignore
@@ -0,0 +1,1 @@
+.next
diff --git a/examples/webhook-signing/nextjs/main.ts b/examples/webhook-signing/nextjs/main.ts
new file mode 100755
index 00000000..4456a78e
--- /dev/null
+++ b/examples/webhook-signing/nextjs/main.ts
@@ -0,0 +1,17 @@
+#!/usr/bin/env -S npm run-script run
+
+/*
+  ATTENTION: this file exists to support github/stripe/stripe-node example test infrastructure
+  You don't need to copy this file to your NextJS project.
+*/
+
+import child_process from 'child_process';
+
+const process = child_process.exec('npm run dev --verbose');
+process.stdout.on('data', (line) => {
+  const match = /url: (.*)/gm.exec(line);
+  if (match) {
+    console.log(`Webhook endpoint available at ${match[1]}/api/webhooks`);
+  }
+  console.log(line);
+});
diff --git a/examples/webhook-signing/nextjs/next-env.d.ts b/examples/webhook-signing/nextjs/next-env.d.ts
new file mode 100644
index 00000000..4f11a03d
--- /dev/null
+++ b/examples/webhook-signing/nextjs/next-env.d.ts
@@ -0,0 +1,5 @@
+/// <reference types="next" />
+/// <reference types="next/image-types/global" />
+
+// NOTE: This file should not be edited
+// see https://nextjs.org/docs/basic-features/typescript for more information.
diff --git a/examples/webhook-signing/nextjs/package.json b/examples/webhook-signing/nextjs/package.json
new file mode 100644
index 00000000..dc42ce73
--- /dev/null
+++ b/examples/webhook-signing/nextjs/package.json
@@ -0,0 +1,28 @@
+{
+  "name": "webhook-signing-example-nextjs",
+  "version": "1.0.0",
+  "description": "NextJS webhook parsing sample",
+  "repository": {},
+  "main": "./main.ts",
+  "scripts": {
+    "run": "ts-node-transpile-only ./main.ts",
+    "prepare": "../prepare.sh",
+    "dev": "next dev --port 0"
+  },
+  "author": "",
+  "license": "ISC",
+  "dependencies": {
+    "dotenv": "^8.2.0",
+    "next": "^13.1.6",
+    "react": "^18.2.0",
+    "react-dom": "^18.2.0",
+    "stripe": "^11.9.1"
+  },
+  "devDependencies": {
+    "@types/node": "^13.1.4",
+    "@types/react": "18.0.27",
+    "eslint": "^8.33.0",
+    "typescript": "^4.8.3",
+    "ts-node": "^10.9.1"
+  }
+}
diff --git a/examples/webhook-signing/nextjs/pages/api/webhooks.ts b/examples/webhook-signing/nextjs/pages/api/webhooks.ts
new file mode 100644
index 00000000..9fe77c0f
--- /dev/null
+++ b/examples/webhook-signing/nextjs/pages/api/webhooks.ts
@@ -0,0 +1,74 @@
+import Stripe from 'stripe';
+import {NextApiRequest, NextApiResponse} from 'next';
+
+const handler = async (
+  req: NextApiRequest,
+  res: NextApiResponse
+): Promise<void> => {
+  const stripe = new Stripe(process.env.STRIPE_WEBHOOK_SECRET, {
+    apiVersion: '2022-11-15',
+  });
+
+  const webhookSecret: string = process.env.STRIPE_WEBHOOK_SECRET;
+
+  if (req.method === 'POST') {
+    const sig = req.headers['stripe-signature'];
+
+    let event: Stripe.Event;
+
+    try {
+      const body = await buffer(req);
+      event = stripe.webhooks.constructEvent(body, sig, webhookSecret);
+    } catch (err) {
+      // On error, log and return the error message
+      console.log(`❌ Error message: ${err.message}`);
+      res.status(400).send(`Webhook Error: ${err.message}`);
+      return;
+    }
+
+    // Successfully constructed event
+    console.log('✅ Success:', event.id);
+
+    // Cast event data to Stripe object
+    if (event.type === 'payment_intent.succeeded') {
+      const stripeObject: Stripe.PaymentIntent = event.data
+        .object as Stripe.PaymentIntent;
+      console.log(`💰 PaymentIntent status: ${stripeObject.status}`);
+    } else if (event.type === 'charge.succeeded') {
+      const charge = event.data.object as Stripe.Charge;
+      console.log(`💵 Charge id: ${charge.id}`);
+    } else {
+      console.warn(`🤷‍♀️ Unhandled event type: ${event.type}`);
+    }
+
+    // Return a response to acknowledge receipt of the event
+    res.json({received: true});
+  } else {
+    res.setHeader('Allow', 'POST');
+    res.status(405).end('Method Not Allowed');
+  }
+};
+
+export const config = {
+  api: {
+    bodyParser: false,
+  },
+};
+
+const buffer = (req: NextApiRequest) => {
+  return new Promise<Buffer>((resolve, reject) => {
+    const chunks: Buffer[] = [];
+
+    req.on('data', (chunk: Buffer) => {
+      chunks.push(chunk);
+    });
+
+    req.on('end', () => {
+      resolve(Buffer.concat(chunks));
+    });
+
+    req.on('error', reject);
+  });
+};
+
+export default handler;
diff --git a/types/BillingPortal/Configurations.d.ts b/types/BillingPortal/Configurations.d.ts
index 25a969bc..e488b03c 100644
--- a/types/BillingPortal/Configurations.d.ts
+++ b/types/BillingPortal/Configurations.d.ts
@@ -117,6 +117,7 @@ declare module 'stripe' {
             type AllowedUpdate =
               | 'address'
               | 'email'
+              | 'name'
               | 'phone'
               | 'shipping'
               | 'tax_id';
diff --git a/types/BillingPortal/ConfigurationsResource.d.ts b/types/BillingPortal/ConfigurationsResource.d.ts
index fdb4882e..dd0b835e 100644
--- a/types/BillingPortal/ConfigurationsResource.d.ts
+++ b/types/BillingPortal/ConfigurationsResource.d.ts
@@ -104,6 +104,7 @@ declare module 'stripe' {
             type AllowedUpdate =
               | 'address'
               | 'email'
+              | 'name'
               | 'phone'
               | 'shipping'
               | 'tax_id';
@@ -352,6 +353,7 @@ declare module 'stripe' {
             type AllowedUpdate =
               | 'address'
               | 'email'
+              | 'name'
               | 'phone'
               | 'shipping'
               | 'tax_id';
diff --git a/types/Checkout/Sessions.d.ts b/types/Checkout/Sessions.d.ts
index acf6ca8c..b910c844 100644
--- a/types/Checkout/Sessions.d.ts
+++ b/types/Checkout/Sessions.d.ts
@@ -94,6 +94,11 @@ declare module 'stripe' {
          */
         currency_conversion?: Session.CurrencyConversion | null;
 
+        /**
+         * Collect additional information from your customer using custom fields. Up to 2 fields are supported.
+         */
+        custom_fields: Array<Session.CustomField>;
+
         custom_text: Session.CustomText;
 
         /**
@@ -479,6 +484,96 @@ declare module 'stripe' {
           }
         }
 
+        interface CustomField {
+          /**
+           * Configuration for `type=dropdown` fields.
+           */
+          dropdown: CustomField.Dropdown | null;
+
+          /**
+           * String of your choice that your integration can use to reconcile this field. Must be unique to this field, alphanumeric, and up to 200 characters.
+           */
+          key: string;
+
+          label: CustomField.Label;
+
+          /**
+           * Configuration for `type=numeric` fields.
+           */
+          numeric: CustomField.Numeric | null;
+
+          /**
+           * Whether the customer is required to complete the field before completing the Checkout Session. Defaults to `false`.
+           */
+          optional: boolean;
+
+          /**
+           * Configuration for `type=text` fields.
+           */
+          text: CustomField.Text | null;
+
+          /**
+           * The type of the field.
+           */
+          type: CustomField.Type;
+        }
+
+        namespace CustomField {
+          interface Dropdown {
+            /**
+             * The options available for the customer to select. Up to 200 options allowed.
+             */
+            options: Array<Dropdown.Option>;
+
+            /**
+             * The option selected by the customer. This will be the `value` for the option.
+             */
+            value: string | null;
+          }
+
+          namespace Dropdown {
+            interface Option {
+              /**
+               * The label for the option, displayed to the customer. Up to 100 characters.
+               */
+              label: string;
+
+              /**
+               * The value for this option, not displayed to the customer, used by your integration to reconcile the option selected by the customer. Must be unique to this option, alphanumeric, and up to 100 characters.
+               */
+              value: string;
+            }
+          }
+
+          interface Label {
+            /**
+             * Custom text for the label, displayed to the customer. Up to 50 characters.
+             */
+            custom: string | null;
+
+            /**
+             * The type of the label.
+             */
+            type: 'custom';
+          }
+
+          interface Numeric {
+            /**
+             * The value entered by the customer, containing only digits.
+             */
+            value: string | null;
+          }
+
+          interface Text {
+            /**
+             * The value entered by the customer.
+             */
+            value: string | null;
+          }
+
+          type Type = 'dropdown' | 'numeric' | 'text';
+        }
+
         interface CustomText {
           /**
            * Custom text that should be displayed alongside shipping address collection.
diff --git a/types/Checkout/SessionsResource.d.ts b/types/Checkout/SessionsResource.d.ts
index 9510a99c..58070a9e 100644
--- a/types/Checkout/SessionsResource.d.ts
+++ b/types/Checkout/SessionsResource.d.ts
@@ -54,6 +54,11 @@ declare module 'stripe' {
          */
         currency?: string;
 
+        /**
+         * Collect additional information from your customer using custom fields. Up to 2 fields are supported.
+         */
+        custom_fields?: Array<SessionCreateParams.CustomField>;
+
         /**
          * Display additional text for your customers using custom text.
          */
@@ -310,6 +315,70 @@ declare module 'stripe' {
           type Shipping = 'auto' | 'never';
         }
 
+        interface CustomField {
+          /**
+           * Configuration for `type=dropdown` fields.
+           */
+          dropdown?: CustomField.Dropdown;
+
+          /**
+           * String of your choice that your integration can use to reconcile this field. Must be unique to this field, alphanumeric, and up to 200 characters.
+           */
+          key: string;
+
+          /**
+           * The label for the field, displayed to the customer.
+           */
+          label: CustomField.Label;
+
+          /**
+           * Whether the customer is required to complete the field before completing the Checkout Session. Defaults to `false`.
+           */
+          optional?: boolean;
+
+          /**
+           * The type of the field.
+           */
+          type: CustomField.Type;
+        }
+
+        namespace CustomField {
+          interface Dropdown {
+            /**
+             * The options available for the customer to select. Up to 200 options allowed.
+             */
+            options: Array<Dropdown.Option>;
+          }
+
+          namespace Dropdown {
+            interface Option {
+              /**
+               * The label for the option, displayed to the customer. Up to 100 characters.
+               */
+              label: string;
+
+              /**
+               * The value for this option, not displayed to the customer, used by your integration to reconcile the option selected by the customer. Must be unique to this option, alphanumeric, and up to 100 characters.
+               */
+              value: string;
+            }
+          }
+
+          interface Label {
+            /**
+             * Custom text for the label, displayed to the customer. Up to 50 characters.
+             */
+            custom: string;
+
+            /**
+             * The type of the label.
+             */
+            type: 'custom';
+          }
+
+          type Type = 'dropdown' | 'numeric' | 'text';
+        }
+
         interface CustomText {
           /**
            * Custom text that should be displayed alongside shipping address collection.
diff --git a/types/InvoicesResource.d.ts b/types/InvoicesResource.d.ts
index 14157847..da2e14dd 100644
--- a/types/InvoicesResource.d.ts
+++ b/types/InvoicesResource.d.ts
@@ -1925,7 +1925,7 @@ declare module 'stripe' {
       namespace SubscriptionItem {
         interface BillingThresholds {
           /**
-           * Usage threshold that triggers the subscription to advance to a new billing period
+           * Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
            */
           usage_gte: number;
         }
@@ -2656,7 +2656,7 @@ declare module 'stripe' {
       namespace SubscriptionItem {
         interface BillingThresholds {
           /**
-           * Usage threshold that triggers the subscription to advance to a new billing period
+           * Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
            */
           usage_gte: number;
         }
diff --git a/types/PaymentLinks.d.ts b/types/PaymentLinks.d.ts
index 9e7ec259..fb82257f 100644
--- a/types/PaymentLinks.d.ts
+++ b/types/PaymentLinks.d.ts
@@ -59,6 +59,11 @@ declare module 'stripe' {
        */
       currency: string;
 
+      /**
+       * Collect additional information from your customer using custom fields. Up to 2 fields are supported.
+       */
+      custom_fields: Array<PaymentLink.CustomField>;
+
       custom_text: PaymentLink.CustomText;
 
       /**
@@ -200,6 +205,67 @@ declare module 'stripe' {
 
       type CustomerCreation = 'always' | 'if_required';
 
+      interface CustomField {
+        /**
+         * Configuration for `type=dropdown` fields.
+         */
+        dropdown: CustomField.Dropdown | null;
+
+        /**
+         * String of your choice that your integration can use to reconcile this field. Must be unique to this field, alphanumeric, and up to 200 characters.
+         */
+        key: string;
+
+        label: CustomField.Label;
+
+        /**
+         * Whether the customer is required to complete the field before completing the Checkout Session. Defaults to `false`.
+         */
+        optional: boolean;
+
+        /**
+         * The type of the field.
+         */
+        type: CustomField.Type;
+      }
+
+      namespace CustomField {
+        interface Dropdown {
+          /**
+           * The options available for the customer to select. Up to 200 options allowed.
+           */
+          options: Array<Dropdown.Option>;
+        }
+
+        namespace Dropdown {
+          interface Option {
+            /**
+             * The label for the option, displayed to the customer. Up to 100 characters.
+             */
+            label: string;
+
+            /**
+             * The value for this option, not displayed to the customer, used by your integration to reconcile the option selected by the customer. Must be unique to this option, alphanumeric, and up to 100 characters.
+             */
+            value: string;
+          }
+        }
+
+        interface Label {
+          /**
+           * Custom text for the label, displayed to the customer. Up to 50 characters.
+           */
+          custom: string | null;
+
+          /**
+           * The type of the label.
+           */
+          type: 'custom';
+        }
+
+        type Type = 'dropdown' | 'numeric' | 'text';
+      }
+
       interface CustomText {
         /**
          * Custom text that should be displayed alongside shipping address collection.
diff --git a/types/PaymentLinksResource.d.ts b/types/PaymentLinksResource.d.ts
index 1646fa3e..1de81069 100644
--- a/types/PaymentLinksResource.d.ts
+++ b/types/PaymentLinksResource.d.ts
@@ -48,6 +48,11 @@ declare module 'stripe' {
        */
       currency?: string;
 
+      /**
+       * Collect additional information from your customer using custom fields. Up to 2 fields are supported.
+       */
+      custom_fields?: Array<PaymentLinkCreateParams.CustomField>;
+
       /**
        * Display additional text for your customers using custom text.
        */
@@ -203,6 +208,70 @@ declare module 'stripe' {
 
       type CustomerCreation = 'always' | 'if_required';
 
+      interface CustomField {
+        /**
+         * Configuration for `type=dropdown` fields.
+         */
+        dropdown?: CustomField.Dropdown;
+
+        /**
+         * String of your choice that your integration can use to reconcile this field. Must be unique to this field, alphanumeric, and up to 200 characters.
+         */
+        key: string;
+
+        /**
+         * The label for the field, displayed to the customer.
+         */
+        label: CustomField.Label;
+
+        /**
+         * Whether the customer is required to complete the field before completing the Checkout Session. Defaults to `false`.
+         */
+        optional?: boolean;
+
+        /**
+         * The type of the field.
+         */
+        type: CustomField.Type;
+      }
+
+      namespace CustomField {
+        interface Dropdown {
+          /**
+           * The options available for the customer to select. Up to 200 options allowed.
+           */
+          options: Array<Dropdown.Option>;
+        }
+
+        namespace Dropdown {
+          interface Option {
+            /**
+             * The label for the option, displayed to the customer. Up to 100 characters.
+             */
+            label: string;
+
+            /**
+             * The value for this option, not displayed to the customer, used by your integration to reconcile the option selected by the customer. Must be unique to this option, alphanumeric, and up to 100 characters.
+             */
+            value: string;
+          }
+        }
+
+        interface Label {
+          /**
+           * Custom text for the label, displayed to the customer. Up to 50 characters.
+           */
+          custom: string;
+
+          /**
+           * The type of the label.
+           */
+          type: 'custom';
+        }
+
+        type Type = 'dropdown' | 'numeric' | 'text';
+      }
+
       interface CustomText {
         /**
          * Custom text that should be displayed alongside shipping address collection.
@@ -731,6 +800,13 @@ declare module 'stripe' {
        */
       billing_address_collection?: PaymentLinkUpdateParams.BillingAddressCollection;
 
+      /**
+       * Collect additional information from your customer using custom fields. Up to 2 fields are supported.
+       */
+      custom_fields?: Stripe.Emptyable<
+        Array<PaymentLinkUpdateParams.CustomField>
+      >;
+
       /**
        * Display additional text for your customers using custom text.
        */
@@ -832,6 +908,70 @@ declare module 'stripe' {
 
       type CustomerCreation = 'always' | 'if_required';
 
+      interface CustomField {
+        /**
+         * Configuration for `type=dropdown` fields.
+         */
+        dropdown?: CustomField.Dropdown;
+
+        /**
+         * String of your choice that your integration can use to reconcile this field. Must be unique to this field, alphanumeric, and up to 200 characters.
+         */
+        key: string;
+
+        /**
+         * The label for the field, displayed to the customer.
+         */
+        label: CustomField.Label;
+
+        /**
+         * Whether the customer is required to complete the field before completing the Checkout Session. Defaults to `false`.
+         */
+        optional?: boolean;
+
+        /**
+         * The type of the field.
+         */
+        type: CustomField.Type;
+      }
+
+      namespace CustomField {
+        interface Dropdown {
+          /**
+           * The options available for the customer to select. Up to 200 options allowed.
+           */
+          options: Array<Dropdown.Option>;
+        }
+
+        namespace Dropdown {
+          interface Option {
+            /**
+             * The label for the option, displayed to the customer. Up to 100 characters.
+             */
+            label: string;
+
+            /**
+             * The value for this option, not displayed to the customer, used by your integration to reconcile the option selected by the customer. Must be unique to this option, alphanumeric, and up to 100 characters.
+             */
+            value: string;
+          }
+        }
+
+        interface Label {
+          /**
+           * Custom text for the label, displayed to the customer. Up to 50 characters.
+           */
+          custom: string;
+
+          /**
+           * The type of the label.
+           */
+          type: 'custom';
+        }
+
+        type Type = 'dropdown' | 'numeric' | 'text';
+      }
+
       interface CustomText {
         /**
          * Custom text that should be displayed alongside shipping address collection.
diff --git a/types/Quotes.d.ts b/types/Quotes.d.ts
index 4866dac9..17bf1860 100644
--- a/types/Quotes.d.ts
+++ b/types/Quotes.d.ts
@@ -431,15 +431,9 @@ declare module 'stripe' {
         | 'stale';
 
       interface StatusDetails {
-        /**
-         * Details on when and why a quote has been marked as canceled.
-         */
-        canceled: StatusDetails.Canceled | null;
+        canceled?: StatusDetails.Canceled;
 
-        /**
-         * Details on when and why a quote has been marked as stale.
-         */
-        stale: StatusDetails.Stale | null;
+        stale?: StatusDetails.Stale;
       }
 
       namespace StatusDetails {
diff --git a/types/QuotesResource.d.ts b/types/QuotesResource.d.ts
index c2869447..fbf0035f 100644
--- a/types/QuotesResource.d.ts
+++ b/types/QuotesResource.d.ts
@@ -3361,7 +3361,7 @@ declare module 'stripe' {
       ): ApiListPromise<Stripe.LineItem>;
 
       /**
-       * When retrieving a quote, there is an includable lines property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of lines.
+       * Retrieves a paginated list of lines for a quote. These lines describe changes that will be used to create new subscription schedules or update existing subscription schedules when the quote is accepted.
        */
       listLines(
         id: string,
diff --git a/types/SubscriptionItemsResource.d.ts b/types/SubscriptionItemsResource.d.ts
index f00bdeb0..3311117a 100644
--- a/types/SubscriptionItemsResource.d.ts
+++ b/types/SubscriptionItemsResource.d.ts
@@ -87,7 +87,7 @@ declare module 'stripe' {
     namespace SubscriptionItemCreateParams {
       interface BillingThresholds {
         /**
-         * Usage threshold that triggers the subscription to advance to a new billing period
+         * Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
          */
         usage_gte: number;
       }
@@ -312,7 +312,7 @@ declare module 'stripe' {
     namespace SubscriptionItemUpdateParams {
       interface BillingThresholds {
         /**
-         * Usage threshold that triggers the subscription to advance to a new billing period
+         * Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
          */
         usage_gte: number;
       }
diff --git a/types/SubscriptionSchedulesResource.d.ts b/types/SubscriptionSchedulesResource.d.ts
index 066c1031..0b76e712 100644
--- a/types/SubscriptionSchedulesResource.d.ts
+++ b/types/SubscriptionSchedulesResource.d.ts
@@ -532,7 +532,7 @@ declare module 'stripe' {
         namespace Item {
           interface BillingThresholds {
             /**
-             * Usage threshold that triggers the subscription to advance to a new billing period
+             * Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
              */
             usage_gte: number;
           }
@@ -1242,7 +1242,7 @@ declare module 'stripe' {
         namespace Item {
           interface BillingThresholds {
             /**
-             * Usage threshold that triggers the subscription to advance to a new billing period
+             * Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
              */
             usage_gte: number;
           }
diff --git a/types/SubscriptionsResource.d.ts b/types/SubscriptionsResource.d.ts
index f2e4ea8a..c42fdfe3 100644
--- a/types/SubscriptionsResource.d.ts
+++ b/types/SubscriptionsResource.d.ts
@@ -432,7 +432,7 @@ declare module 'stripe' {
       namespace Item {
         interface BillingThresholds {
           /**
-           * Usage threshold that triggers the subscription to advance to a new billing period
+           * Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
            */
           usage_gte: number;
         }
@@ -1319,7 +1319,7 @@ declare module 'stripe' {
       namespace Item {
         interface BillingThresholds {
           /**
-           * Usage threshold that triggers the subscription to advance to a new billing period
+           * Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
            */
           usage_gte: number;
         }
diff --git a/types/Tax/Calculations.d.ts b/types/Tax/Calculations.d.ts
index 51895775..16cfeaf9 100644
--- a/types/Tax/Calculations.d.ts
+++ b/types/Tax/Calculations.d.ts
@@ -49,11 +49,6 @@ declare module 'stripe' {
          */
         livemode: boolean;
 
-        /**
-         * A custom unique identifier, such as 'myOrder_123'.
-         */
-        reference: string | null;
-
         /**
          * The amount of tax to be collected on top of the line item prices.
          */
diff --git a/types/Tax/CalculationsResource.d.ts b/types/Tax/CalculationsResource.d.ts
index 46ad4227..1e0908cd 100644
--- a/types/Tax/CalculationsResource.d.ts
+++ b/types/Tax/CalculationsResource.d.ts
@@ -34,11 +34,6 @@ declare module 'stripe' {
          */
         preview?: boolean;
 
-        /**
-         * A custom order or sale identifier, such as 'myOrder_123'.
-         */
-        reference?: string;
-
         /**
          * Timestamp of date at which the tax rules and rates in effect applies for the calculation. Measured in seconds since the Unix epoch.
          */
diff --git a/types/Tax/TransactionsResource.d.ts b/types/Tax/TransactionsResource.d.ts
index 7d8c80ab..fb8c016c 100644
--- a/types/Tax/TransactionsResource.d.ts
+++ b/types/Tax/TransactionsResource.d.ts
@@ -18,6 +18,11 @@ declare module 'stripe' {
          * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
          */
         metadata?: Stripe.MetadataParam;
+
+        /**
+         * A custom order or sale identifier, such as 'myOrder_123'.
+         */
+        reference?: string;
       }
 
       interface TransactionRetrieveParams {


Test patch:
diff --git a/test/Integration.spec.ts b/test/Integration.spec.ts
index 1126209d..92f2a9f4 100644
--- a/test/Integration.spec.ts
+++ b/test/Integration.spec.ts
@@ -5,7 +5,7 @@ import * as childProcess from 'child_process';
 const testUtils = require('../testUtils');
 
 describe('Integration test', function() {
-  this.timeout(30000);
+  this.timeout(50000);
   const testExec = (cmd: string): Promise<void> => {
     const child = childProcess.exec(cmd);
 
@@ -89,4 +89,6 @@ describe('Integration test', function() {
   it('Webhook sample express', () => runWebhookTest('express'));
 
   it('Webhook sample koa', () => runWebhookTest('koa'));
+
+  it('Webhook sample nextjs', () => runWebhookTest('nextjs'));
 });
diff --git a/test/resources/generated_examples_test.spec.js b/test/resources/generated_examples_test.spec.js
index 4709c627..938631f2 100644
--- a/test/resources/generated_examples_test.spec.js
+++ b/test/resources/generated_examples_test.spec.js
@@ -2,7 +2,8 @@
 
 'use strict';
 
-const stripe = require('../../testUtils').getStripeMockClient();
+const testUtils = require('../../testUtils');
+const stripe = testUtils.getStripeMockClient();
 const expect = require('chai').expect;
 
 describe('Accounts', function() {
@@ -192,6 +193,19 @@ describe('Accounts', function() {
     );
     expect(person).not.to.be.null;
   });
+
+  it('retrieve method', async function() {
+    const stripe = testUtils.createMockClient([
+      {
+        method: 'GET',
+        path: '/v1/accounts/acc_123',
+        response:
+          '{"business_profile":{"mcc":"mcc","name":"name","product_description":"product_description","support_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"support_email":"support_email","support_phone":"support_phone","support_url":"support_url","url":"url"},"business_type":"government_entity","capabilities":{"acss_debit_payments":"inactive","affirm_payments":"pending","afterpay_clearpay_payments":"inactive","au_becs_debit_payments":"active","bacs_debit_payments":"active","bancontact_payments":"inactive","bank_transfer_payments":"pending","blik_payments":"inactive","boleto_payments":"inactive","card_issuing":"active","card_payments":"active","cartes_bancaires_payments":"active","cashapp_payments":"active","eps_payments":"inactive","fpx_payments":"active","giropay_payments":"active","grabpay_payments":"pending","ideal_payments":"inactive","india_international_payments":"inactive","jcb_payments":"inactive","klarna_payments":"active","konbini_payments":"active","legacy_payments":"active","link_payments":"inactive","oxxo_payments":"pending","p24_payments":"inactive","paynow_payments":"active","promptpay_payments":"active","sepa_debit_payments":"inactive","sofort_payments":"active","tax_reporting_us_1099_k":"inactive","tax_reporting_us_1099_misc":"pending","transfers":"inactive","treasury":"pending","us_bank_account_ach_payments":"pending","zip_payments":"pending"},"charges_enabled":true,"company":{"address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"address_kana":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state","town":"town"},"address_kanji":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state","town":"town"},"directors_provided":true,"executives_provided":true,"name":"name","name_kana":"name_kana","name_kanji":"name_kanji","owners_provided":true,"ownership_declaration":{"date":"3076014","ip":"ip","user_agent":"user_agent"},"phone":"phone","structure":"sole_establishment","tax_id_provided":true,"tax_id_registrar":"tax_id_registrar","vat_id_provided":true,"verification":{"document":{"back":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"},"details":"details","details_code":"details_code","front":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"}}}},"controller":{"application":{"loss_liable":true,"onboarding_owner":true,"pricing_controls":true},"dashboard":{"type":"express"},"is_controller":true,"type":"account"},"country":"country","created":"1028554472","default_currency":"default_currency","details_submitted":true,"email":"email","external_accounts":null,"future_requirements":{"alternatives":[{"alternative_fields_due":["alternative_fields_due"],"original_fields_due":["original_fields_due"]}],"current_deadline":"270965154","currently_due":["currently_due"],"disabled_reason":"disabled_reason","errors":[{"code":"verification_document_failed_copy","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"id":"obj_123","individual":{"account":"account","address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"address_kana":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state","town":"town"},"address_kanji":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state","town":"town"},"created":"1028554472","dob":{"day":99228,"month":104080000,"year":3704893},"email":"email","first_name":"first_name","first_name_kana":"first_name_kana","first_name_kanji":"first_name_kanji","full_name_aliases":["full_name_aliases"],"future_requirements":{"alternatives":[{"alternative_fields_due":["alternative_fields_due"],"original_fields_due":["original_fields_due"]}],"currently_due":["currently_due"],"errors":[{"code":"verification_document_failed_copy","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"gender":"gender","id":"obj_123","id_number_provided":true,"id_number_secondary_provided":true,"last_name":"last_name","last_name_kana":"last_name_kana","last_name_kanji":"last_name_kanji","maiden_name":"maiden_name","metadata":{"undefined":"metadata"},"nationality":"nationality","object":"person","phone":"phone","political_exposure":"none","registered_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"relationship":{"director":true,"executive":true,"owner":true,"percent_ownership":760989685,"representative":true,"title":"title"},"requirements":{"alternatives":[{"alternative_fields_due":["alternative_fields_due"],"original_fields_due":["original_fields_due"]}],"currently_due":["currently_due"],"errors":[{"code":"verification_document_failed_copy","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"ssn_last_4_provided":true,"verification":{"additional_document":{"back":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"},"details":"details","details_code":"details_code","front":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"}},"details":"details","details_code":"details_code","document":{"back":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"},"details":"details","details_code":"details_code","front":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"}},"status":"status"}},"metadata":{"undefined":"metadata"},"object":"account","payouts_enabled":true,"requirements":{"alternatives":[{"alternative_fields_due":["alternative_fields_due"],"original_fields_due":["original_fields_due"]}],"current_deadline":"270965154","currently_due":["currently_due"],"disabled_reason":"disabled_reason","errors":[{"code":"verification_document_failed_copy","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"settings":{"bacs_debit_payments":{"display_name":"display_name"},"branding":{"icon":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"},"logo":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"finance_report_run","size":3530753,"title":"title","type":"type","url":"url"},"primary_color":"primary_color","secondary_color":"secondary_color"},"card_issuing":{"tos_acceptance":{"date":3076014,"ip":"ip","user_agent":"user_agent"}},"card_payments":{"decline_on":{"avs_failure":true,"cvc_failure":true},"statement_descriptor_prefix":"statement_descriptor_prefix","statement_descriptor_prefix_kana":"statement_descriptor_prefix_kana","statement_descriptor_prefix_kanji":"statement_descriptor_prefix_kanji"},"dashboard":{"display_name":"display_name","timezone":"timezone"},"payments":{"statement_descriptor":"statement_descriptor","statement_descriptor_kana":"statement_descriptor_kana","statement_descriptor_kanji":"statement_descriptor_kanji","statement_descriptor_prefix_kana":"statement_descriptor_prefix_kana","statement_descriptor_prefix_kanji":"statement_descriptor_prefix_kanji"},"payouts":{"debit_negative_balances":true,"schedule":{"delay_days":1647351405,"interval":"interval","monthly_anchor":1920305369,"weekly_anchor":"weekly_anchor"},"statement_descriptor":"statement_descriptor"},"sepa_debit_payments":{"creditor_id":"creditor_id"},"treasury":{"tos_acceptance":{"date":3076014,"ip":"ip","user_agent":"user_agent"}}},"tos_acceptance":{"date":"3076014","ip":"ip","service_agreement":"service_agreement","user_agent":"user_agent"},"type":"custom"}',
+      },
+    ]);
+    const account = await stripe.accounts.retrieve('acc_123');
+    expect(account).not.to.be.null;
+  });
 });
 
 describe('Apps.Secrets', function() {