diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 6cd1357ca6..d21c5d74f6 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v166 \ No newline at end of file +v168 \ No newline at end of file diff --git a/lib/resources.js b/lib/resources.js index 2d94670e76..33b8120c46 100644 --- a/lib/resources.js +++ b/lib/resources.js @@ -39,6 +39,7 @@ module.exports = { Products: require('./resources/Products'), PromotionCodes: require('./resources/PromotionCodes'), Quotes: require('./resources/Quotes'), + QuotePhases: require('./resources/QuotePhases'), Refunds: require('./resources/Refunds'), Reviews: require('./resources/Reviews'), SetupAttempts: require('./resources/SetupAttempts'), diff --git a/lib/resources/QuotePhases.js b/lib/resources/QuotePhases.js new file mode 100644 index 0000000000..54c2db1c69 --- /dev/null +++ b/lib/resources/QuotePhases.js @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec + +'use strict'; + +const StripeResource = require('../StripeResource'); +const stripeMethod = StripeResource.method; + +module.exports = StripeResource.extend({ + path: 'quote_phases', + + retrieve: stripeMethod({ + method: 'GET', + path: '/{quotePhase}', + }), + + list: stripeMethod({ + method: 'GET', + path: '', + methodType: 'list', + }), + + listLineItems: stripeMethod({ + method: 'GET', + path: '/{quotePhase}/line_items', + methodType: 'list', + }), +}); diff --git a/types/2020-08-27/Customers.d.ts b/types/2020-08-27/Customers.d.ts index 8d63c58388..72a6054d04 100644 --- a/types/2020-08-27/Customers.d.ts +++ b/types/2020-08-27/Customers.d.ts @@ -41,6 +41,11 @@ declare module 'stripe' { */ currency: string | null; + /** + * The default three-letter [ISO code for the currency](https://stripe.com/docs/currencies) that the customer will be charged in for billing purposes. + */ + default_currency?: string | null; + /** * ID of the default payment source for the customer. * @@ -72,6 +77,13 @@ declare module 'stripe' { */ email: string | null; + /** + * The current multi-currency balances, if any, being stored on the customer.If positive in a currency, the customer has a credit to apply to their next invoice denominated in that currency.If negative, the customer has an amount owed that will be added to their next invoice denominated in that currency. These balances do not refer to any unpaid invoices.They solely track amounts that have yet to be successfully applied to any invoice. A balance in a particular currency is only applied to any invoice as an invoice in that currency is finalized. + */ + invoice_credit_balance?: { + [key: string]: number; + }; + /** * The prefix for the customer used to generate unique invoice numbers. */ diff --git a/types/2020-08-27/Invoices.d.ts b/types/2020-08-27/Invoices.d.ts index 0998965aa5..babca2820f 100644 --- a/types/2020-08-27/Invoices.d.ts +++ b/types/2020-08-27/Invoices.d.ts @@ -936,6 +936,11 @@ declare module 'stripe' { */ collection_method?: InvoiceCreateParams.CollectionMethod; + /** + * The currency to create this invoice in. Defaults to that of `customer` if not specified. + */ + currency?: string; + /** * A list of up to 4 custom fields to be displayed on the invoice. */ diff --git a/types/2020-08-27/QuotePhases.d.ts b/types/2020-08-27/QuotePhases.d.ts new file mode 100644 index 0000000000..059656cb1f --- /dev/null +++ b/types/2020-08-27/QuotePhases.d.ts @@ -0,0 +1,226 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + /** + * The QuotePhase object. + */ + interface QuotePhase { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'quote_phase'; + + /** + * Total before any discounts or taxes are applied. + */ + amount_subtotal: number; + + /** + * Total after discounts and taxes are applied. + */ + amount_total: number; + + /** + * If set to `new`, the billing_cycle_anchor of the subscription is set to the start of the phase when entering the phase. If unset, then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). + */ + billing_cycle_anchor: 'reset' | null; + + /** + * Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions. + */ + collection_method: QuotePhase.CollectionMethod | null; + + /** + * The default tax rates to apply to the subscription during this phase of the quote. + */ + default_tax_rates?: Array; + + /** + * The stackable discounts that will be applied to the subscription on this phase. Subscription item discounts are applied before subscription discounts. + */ + discounts: Array; + + /** + * The end of this phase of the quote + */ + end_date: number | null; + + /** + * The invoice settings applicable during this phase. + */ + invoice_settings: QuotePhase.InvoiceSettings | null; + + /** + * Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. + */ + iterations: number | null; + + /** + * A list of items the customer is being quoted for. + */ + line_items?: ApiList; + + /** + * If the quote will prorate when transitioning to this phase. Possible values are `create_prorations` and `none`. + */ + proration_behavior: QuotePhase.ProrationBehavior; + + total_details: QuotePhase.TotalDetails; + + /** + * If set to true the entire phase is counted as a trial and the customer will not be charged for any recurring fees. + */ + trial: boolean | null; + + /** + * When the trial ends within the phase. + */ + trial_end: number | null; + } + + namespace QuotePhase { + type CollectionMethod = 'charge_automatically' | 'send_invoice'; + + interface InvoiceSettings { + /** + * Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`. + */ + days_until_due: number | null; + } + + type ProrationBehavior = 'always_invoice' | 'create_prorations' | 'none'; + + interface TotalDetails { + /** + * This is the sum of all the discounts. + */ + amount_discount: number; + + /** + * This is the sum of all the shipping amounts. + */ + amount_shipping: number | null; + + /** + * This is the sum of all the tax amounts. + */ + amount_tax: number; + + breakdown?: TotalDetails.Breakdown; + } + + namespace TotalDetails { + interface Breakdown { + /** + * The aggregated discounts. + */ + discounts: Array; + + /** + * The aggregated tax amounts by rate. + */ + taxes: Array; + } + + namespace Breakdown { + interface Discount { + /** + * The amount discounted. + */ + amount: number; + + /** + * A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes). + * It contains information about when the discount began, when it will end, and what it is applied to. + * + * Related guide: [Applying Discounts to Subscriptions](https://stripe.com/docs/billing/subscriptions/discounts). + */ + discount: Stripe.Discount; + } + + interface Tax { + /** + * Amount of tax applied for this rate. + */ + amount: number; + + /** + * Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax. + * + * Related guide: [Tax Rates](https://stripe.com/docs/billing/taxes/tax-rates). + */ + rate: Stripe.TaxRate; + } + } + } + } + + interface QuotePhaseRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface QuotePhaseListParams extends PaginationParams { + /** + * The ID of the quote whose phases will be retrieved. + */ + quote: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface QuotePhaseListLineItemsParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class QuotePhasesResource { + /** + * Retrieves the quote phase with the given ID. + */ + retrieve( + id: string, + params?: QuotePhaseRetrieveParams, + options?: RequestOptions + ): Promise>; + retrieve( + id: string, + options?: RequestOptions + ): Promise>; + + /** + * Returns a list of quote phases. + */ + list( + params: QuotePhaseListParams, + options?: RequestOptions + ): ApiListPromise; + + /** + * When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. + */ + listLineItems( + id: string, + params?: QuotePhaseListLineItemsParams, + options?: RequestOptions + ): ApiListPromise; + listLineItems( + id: string, + options?: RequestOptions + ): ApiListPromise; + } + } +} diff --git a/types/2020-08-27/SubscriptionSchedules.d.ts b/types/2020-08-27/SubscriptionSchedules.d.ts index a3efbb4b2c..8bd4e9d22c 100644 --- a/types/2020-08-27/SubscriptionSchedules.d.ts +++ b/types/2020-08-27/SubscriptionSchedules.d.ts @@ -1699,8 +1699,6 @@ declare module 'stripe' { interface Add { discounts?: Array; - metadata?: Stripe.MetadataParam; - price: string; quantity?: number; @@ -1728,26 +1726,13 @@ declare module 'stripe' { none?: Trial.None; - /** - * Details of a different price, quantity, or both, to bill your customer for during a paid trial. - */ - paid?: Trial.Paid; - - type: Trial.Type; + type: 'free'; } namespace Trial { interface Free {} interface None {} - - interface Paid { - price?: string; - - quantity?: number; - } - - type Type = 'free' | 'none' | 'paid'; } } @@ -1758,8 +1743,6 @@ declare module 'stripe' { interface Set { discounts?: Array; - metadata?: Stripe.MetadataParam; - price: string; quantity?: number; @@ -1787,26 +1770,13 @@ declare module 'stripe' { none?: Trial.None; - /** - * Details of a different price, quantity, or both, to bill your customer for during a paid trial. - */ - paid?: Trial.Paid; - - type: Trial.Type; + type: 'free'; } namespace Trial { interface Free {} interface None {} - - interface Paid { - price?: string; - - quantity?: number; - } - - type Type = 'free' | 'none' | 'paid'; } } diff --git a/types/2020-08-27; server_side_confirmation_beta=v1/index.d.ts b/types/2020-08-27; server_side_confirmation_beta=v1/index.d.ts index 5dfaa6c714..80a3a9dcd0 100644 --- a/types/2020-08-27; server_side_confirmation_beta=v1/index.d.ts +++ b/types/2020-08-27; server_side_confirmation_beta=v1/index.d.ts @@ -74,6 +74,7 @@ /// /// /// +/// /// /// /// @@ -179,6 +180,7 @@ declare module 'stripe' { products: Stripe.ProductsResource; promotionCodes: Stripe.PromotionCodesResource; quotes: Stripe.QuotesResource; + quotePhases: Stripe.QuotePhasesResource; refunds: Stripe.RefundsResource; reviews: Stripe.ReviewsResource; setupAttempts: Stripe.SetupAttemptsResource;