diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index 2a5f9b8ee9..41534841a7 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -3363,6 +3363,8 @@ declare namespace Stripe { subscription_trial_end?: number; } + type IInvoiceListLineItemsOptions = IListOptions; + interface IInvoiceUpcomingOptions extends IDataOptions { /** * The code of the coupon to apply. If a subscription or subscription_plan is provided, the invoice returned will preview updating @@ -3417,6 +3419,9 @@ declare namespace Stripe { subscription_trial_end?: number; } + // TODO: update once https://stripe.com/docs/api/invoices/upcoming_invoice_lines is fixed. + type IInvoiceListUpcomingLineItemsOptions = IListOptions; + interface IPeriod { /** * The period start date @@ -8542,6 +8547,20 @@ declare namespace Stripe { retrieveLines(id: string, options: HeaderOptions, response?: IResponseFn>): IListPromise; retrieveLines(id: string, response?: IResponseFn>): IListPromise; + /** + * When retrieving an invoice, you'll get a lines property containing the total count of line items and the first + * handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. + * + * @returns Returns a list of line_item objects. + * + * @param id The id of the invoice containing the lines to be retrieved + * @param data Filtering options + */ + listLineItems(id: string, data: invoices.IInvoiceListLineItemsOptions, options: HeaderOptions, response?: IResponseFn>): IListPromise; + listLineItems(id: string, data: invoices.IInvoiceListLineItemsOptions, response?: IResponseFn>): IListPromise; + listLineItems(id: string, options: HeaderOptions, response?: IResponseFn>): IListPromise; + listLineItems(id: string, response?: IResponseFn>): IListPromise; + /** * At any time, you can preview the upcoming invoice for a customer. This will show you all the charges that are pending, * including subscription renewal charges, invoice item charges, etc. It will also show you any discount that is applicable @@ -8561,6 +8580,21 @@ declare namespace Stripe { retrieveUpcoming(id: string, options: HeaderOptions, response?: IResponseFn): Promise; retrieveUpcoming(id: string, response?: IResponseFn): Promise; + /** + * When retrieving an upcoming invoice, you’ll get a lines property containing the total count of line + * items and the first handful of those items. There is also a URL where you can retrieve the full + * (paginated) list of line items. + * + * @returns Returns a list of line_item objects. + * + * @param id The id of the invoice containing the lines to be retrieved + * @param data Filtering options + */ + listUpcomingLineItems(data: invoices.IInvoiceListUpcomingLineItemsOptions, options: HeaderOptions, response?: IResponseFn>): IListPromise; + listUpcomingLineItems(data: invoices.IInvoiceListUpcomingLineItemsOptions, response?: IResponseFn>): IListPromise; + listUpcomingLineItems(options: HeaderOptions, response?: IResponseFn>): IListPromise; + listUpcomingLineItems(response?: IResponseFn>): IListPromise; + /** * Until an invoice is paid, it is marked as open (closed=false). If you'd like to stop Stripe from automatically attempting * payment on an invoice or would simply like to close the invoice out as no longer owed by the customer, you can update the diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index 459205222d..86fccb2db5 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -1258,6 +1258,9 @@ stripe.invoices.retrieveLines( stripe.invoices.retrieveLines("in_15fvyXEe31JkLCeQH7QbgZZb", { limit: 5 }).then((lines) => { // asynchronously called }); +stripe.invoices.listLineItems("in_15fvyXEe31JkLCeQH7QbgZZb", { limit: 5 }).then((lines) => { + lines; // $ExpectType IList +}); stripe.invoices.retrieveUpcoming( "cus_5rfJKDJkuxzh5Q", @@ -1279,6 +1282,9 @@ stripe.invoices.retrieveUpcoming( stripe.invoices.retrieveUpcoming("cus_5rfJKDJkuxzh5Q").then((upcoming) => { // asynchronously called }); +stripe.invoices.listUpcomingLineItems({ limit: 5 }).then((lines) => { + lines; // $ExpectType IList +}); stripe.invoices.update( "in_15fvyXEe31JkLCeQH7QbgZZb",