diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b69e587ab..018ab3d885 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 11.5.0 - 2022-12-22 +* [#1642](https://github.com/stripe/stripe-node/pull/1642) API Updates + * Add support for new value `merchant_default` on enums `CashBalanceUpdateParams.settings.reconciliation_mode`, `CustomerCreateParams.cash_balance.settings.reconciliation_mode`, and `CustomerUpdateParams.cash_balance.settings.reconciliation_mode` + * Add support for `using_merchant_default` on `CashBalance.settings` + * Change `CheckoutSessionCreateParams.cancel_url` to be optional + * Change type of `Checkout.Session.cancel_url` from `string` to `string | null` + ## 11.5.0-beta.1 - 2022-12-15 * [#1640](https://github.com/stripe/stripe-node/pull/1640) API Updates for beta branch * Updated stable APIs to the latest version diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 1ffbdb7c16..a75e729f5a 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v215 +v216 \ No newline at end of file diff --git a/lib/resources.js b/lib/resources.js index 2db4c15678..aebd8364f7 100644 --- a/lib/resources.js +++ b/lib/resources.js @@ -46,10 +46,8 @@ module.exports = { SubscriptionItems: require('./resources/SubscriptionItems'), Subscriptions: require('./resources/Subscriptions'), SubscriptionSchedules: require('./resources/SubscriptionSchedules'), - TaxCalculations: require('./resources/TaxCalculations'), TaxCodes: require('./resources/TaxCodes'), TaxRates: require('./resources/TaxRates'), - TaxTransactions: require('./resources/TaxTransactions'), Tokens: require('./resources/Tokens'), Topups: require('./resources/Topups'), Transfers: require('./resources/Transfers'), @@ -100,6 +98,10 @@ module.exports = { Sigma: resourceNamespace('sigma', { ScheduledQueryRuns: require('./resources/Sigma/ScheduledQueryRuns'), }), + Tax: resourceNamespace('tax', { + Calculations: require('./resources/Tax/Calculations'), + Transactions: require('./resources/Tax/Transactions'), + }), Terminal: resourceNamespace('terminal', { Configurations: require('./resources/Terminal/Configurations'), ConnectionTokens: require('./resources/Terminal/ConnectionTokens'), diff --git a/lib/resources/TaxCalculations.js b/lib/resources/Tax/Calculations.js similarity index 87% rename from lib/resources/TaxCalculations.js rename to lib/resources/Tax/Calculations.js index 0614dfe001..ad4d387d2e 100644 --- a/lib/resources/TaxCalculations.js +++ b/lib/resources/Tax/Calculations.js @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec 'use strict'; -const StripeResource = require('../StripeResource'); +const StripeResource = require('../../StripeResource'); const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ create: stripeMethod({ diff --git a/lib/resources/TaxTransactions.js b/lib/resources/Tax/Transactions.js similarity index 88% rename from lib/resources/TaxTransactions.js rename to lib/resources/Tax/Transactions.js index b8ad7b137a..64306075f5 100644 --- a/lib/resources/TaxTransactions.js +++ b/lib/resources/Tax/Transactions.js @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec 'use strict'; -const StripeResource = require('../StripeResource'); +const StripeResource = require('../../StripeResource'); const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ create: stripeMethod({ diff --git a/src/resources.js b/src/resources.js index f9b5b738fc..80a56751d3 100644 --- a/src/resources.js +++ b/src/resources.js @@ -49,10 +49,8 @@ module.exports = { SubscriptionItems: require('./resources/SubscriptionItems'), Subscriptions: require('./resources/Subscriptions'), SubscriptionSchedules: require('./resources/SubscriptionSchedules'), - TaxCalculations: require('./resources/TaxCalculations'), TaxCodes: require('./resources/TaxCodes'), TaxRates: require('./resources/TaxRates'), - TaxTransactions: require('./resources/TaxTransactions'), Tokens: require('./resources/Tokens'), Topups: require('./resources/Topups'), Transfers: require('./resources/Transfers'), @@ -103,6 +101,10 @@ module.exports = { Sigma: resourceNamespace('sigma', { ScheduledQueryRuns: require('./resources/Sigma/ScheduledQueryRuns'), }), + Tax: resourceNamespace('tax', { + Calculations: require('./resources/Tax/Calculations'), + Transactions: require('./resources/Tax/Transactions'), + }), Terminal: resourceNamespace('terminal', { Configurations: require('./resources/Terminal/Configurations'), ConnectionTokens: require('./resources/Terminal/ConnectionTokens'), diff --git a/src/resources/TaxCalculations.js b/src/resources/Tax/Calculations.js similarity index 87% rename from src/resources/TaxCalculations.js rename to src/resources/Tax/Calculations.js index 7eb70c3b2f..11b0fea065 100644 --- a/src/resources/TaxCalculations.js +++ b/src/resources/Tax/Calculations.js @@ -2,7 +2,7 @@ 'use strict'; -const StripeResource = require('../StripeResource'); +const StripeResource = require('../../StripeResource'); const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ diff --git a/src/resources/TaxTransactions.js b/src/resources/Tax/Transactions.js similarity index 89% rename from src/resources/TaxTransactions.js rename to src/resources/Tax/Transactions.js index fe1e792746..23cf87ede1 100644 --- a/src/resources/TaxTransactions.js +++ b/src/resources/Tax/Transactions.js @@ -2,7 +2,7 @@ 'use strict'; -const StripeResource = require('../StripeResource'); +const StripeResource = require('../../StripeResource'); const stripeMethod = StripeResource.method; module.exports = StripeResource.extend({ diff --git a/types/CashBalances.d.ts b/types/CashBalances.d.ts index 69de3e435e..14f0a7d1c8 100644 --- a/types/CashBalances.d.ts +++ b/types/CashBalances.d.ts @@ -37,6 +37,11 @@ declare module 'stripe' { * The configuration for how funds that land in the customer cash balance are reconciled. */ reconciliation_mode: Settings.ReconciliationMode; + + /** + * A flag to indicate if reconciliation mode returned is the user's default or is specific to this customer cash balance + */ + using_merchant_default: boolean; } namespace Settings { diff --git a/types/Checkout/Sessions.d.ts b/types/Checkout/Sessions.d.ts index b12a2cbb91..4be3a9851b 100644 --- a/types/Checkout/Sessions.d.ts +++ b/types/Checkout/Sessions.d.ts @@ -59,9 +59,9 @@ declare module 'stripe' { billing_address_collection: Session.BillingAddressCollection | null; /** - * The URL the customer will be directed to if they decide to cancel payment and return to your website. + * If set, Checkout displays a back button and customers will be directed to this URL if they decide to cancel payment and return to your website. */ - cancel_url: string; + cancel_url: string | null; /** * A unique string to reference the Checkout Session. This can be a diff --git a/types/Checkout/SessionsResource.d.ts b/types/Checkout/SessionsResource.d.ts index 3895ac35c1..11c100fbf3 100644 --- a/types/Checkout/SessionsResource.d.ts +++ b/types/Checkout/SessionsResource.d.ts @@ -4,11 +4,6 @@ declare module 'stripe' { namespace Stripe { namespace Checkout { interface SessionCreateParams { - /** - * The URL the customer will be directed to if they decide to cancel payment and return to your website. - */ - cancel_url: string; - /** * The URL to which Stripe should send customers when payment or setup * is complete. @@ -37,6 +32,11 @@ declare module 'stripe' { */ billing_address_collection?: SessionCreateParams.BillingAddressCollection; + /** + * If set, Checkout displays a back button and customers will be directed to this URL if they decide to cancel payment and return to your website. + */ + cancel_url?: string; + /** * A unique string to reference the Checkout Session. This can be a * customer ID, a cart ID, or similar, and can be used to reconcile the diff --git a/types/CustomersResource.d.ts b/types/CustomersResource.d.ts index 3e6f9d0293..1426cbcba9 100644 --- a/types/CustomersResource.d.ts +++ b/types/CustomersResource.d.ts @@ -119,13 +119,13 @@ declare module 'stripe' { namespace CashBalance { interface Settings { /** - * Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic` or `manual`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). + * Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic`, `manual`, or `merchant_default`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). */ reconciliation_mode?: Settings.ReconciliationMode; } namespace Settings { - type ReconciliationMode = 'automatic' | 'manual'; + type ReconciliationMode = 'automatic' | 'manual' | 'merchant_default'; } } @@ -393,13 +393,13 @@ declare module 'stripe' { namespace CashBalance { interface Settings { /** - * Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic` or `manual`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). + * Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic`, `manual`, or `merchant_default`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). */ reconciliation_mode?: Settings.ReconciliationMode; } namespace Settings { - type ReconciliationMode = 'automatic' | 'manual'; + type ReconciliationMode = 'automatic' | 'manual' | 'merchant_default'; } } @@ -661,13 +661,13 @@ declare module 'stripe' { namespace CashBalanceUpdateParams { interface Settings { /** - * Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic` or `manual`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). + * Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic`, `manual`, or `merchant_default`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). */ reconciliation_mode?: Settings.ReconciliationMode; } namespace Settings { - type ReconciliationMode = 'automatic' | 'manual'; + type ReconciliationMode = 'automatic' | 'manual' | 'merchant_default'; } } diff --git a/types/OrdersResource.d.ts b/types/OrdersResource.d.ts index 49d3155560..62a79a9bbd 100644 --- a/types/OrdersResource.d.ts +++ b/types/OrdersResource.d.ts @@ -622,6 +622,9 @@ declare module 'stripe' { namespace CustomerBalance { interface BankTransfer { + /** + * Configuration for the eu_bank_transfer funding type. + */ eu_bank_transfer?: BankTransfer.EuBankTransfer; /** @@ -1845,6 +1848,9 @@ declare module 'stripe' { namespace CustomerBalance { interface BankTransfer { + /** + * Configuration for the eu_bank_transfer funding type. + */ eu_bank_transfer?: BankTransfer.EuBankTransfer; /** diff --git a/types/PaymentIntentsResource.d.ts b/types/PaymentIntentsResource.d.ts index 66db3bc033..4bf085d740 100644 --- a/types/PaymentIntentsResource.d.ts +++ b/types/PaymentIntentsResource.d.ts @@ -1389,6 +1389,9 @@ declare module 'stripe' { namespace CustomerBalance { interface BankTransfer { + /** + * Configuration for the eu_bank_transfer funding type. + */ eu_bank_transfer?: BankTransfer.EuBankTransfer; /** @@ -3282,6 +3285,9 @@ declare module 'stripe' { namespace CustomerBalance { interface BankTransfer { + /** + * Configuration for the eu_bank_transfer funding type. + */ eu_bank_transfer?: BankTransfer.EuBankTransfer; /** @@ -5273,6 +5279,9 @@ declare module 'stripe' { namespace CustomerBalance { interface BankTransfer { + /** + * Configuration for the eu_bank_transfer funding type. + */ eu_bank_transfer?: BankTransfer.EuBankTransfer; /** diff --git a/types/Quotes.d.ts b/types/Quotes.d.ts index 42b93fdace..ad97161940 100644 --- a/types/Quotes.d.ts +++ b/types/Quotes.d.ts @@ -552,7 +552,7 @@ declare module 'stripe' { interface SubscriptionData { /** - * TODO + * Describes what period to bill for upon accepting the quote. */ bill_on_acceptance?: SubscriptionData.BillOnAcceptance | null; @@ -577,7 +577,7 @@ declare module 'stripe' { effective_date: number | null; /** - * Behavior of the subscription schedule and underlying subscription when it ends. Possible values are `release` and `cancel`. + * Behavior of the subscription schedule and underlying subscription when it ends. */ end_behavior?: SubscriptionData.EndBehavior | null; @@ -756,7 +756,7 @@ declare module 'stripe' { description: string | null; /** - * Behavior of the subscription schedule and underlying subscription when it ends. Possible values are `release` and `cancel`. + * Behavior of the subscription schedule and underlying subscription when it ends. */ end_behavior: SubscriptionDataOverride.EndBehavior | null; diff --git a/types/QuotesResource.d.ts b/types/QuotesResource.d.ts index f5ae170805..e6780d02d8 100644 --- a/types/QuotesResource.d.ts +++ b/types/QuotesResource.d.ts @@ -1175,7 +1175,7 @@ declare module 'stripe' { effective_date?: Stripe.Emptyable<'current_period_end' | number>; /** - * Configures how the subscription schedule behaves when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. + * Behavior of the subscription schedule and underlying subscription when it ends. */ end_behavior?: SubscriptionData.EndBehavior; @@ -1359,7 +1359,7 @@ declare module 'stripe' { description?: string; /** - * Configures how the subscription schedule behaves when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. + * Behavior of the subscription schedule and underlying subscription when it ends. */ end_behavior?: SubscriptionDataOverride.EndBehavior; @@ -2696,7 +2696,7 @@ declare module 'stripe' { effective_date?: Stripe.Emptyable<'current_period_end' | number>; /** - * Configures how the subscription schedule behaves when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. + * Behavior of the subscription schedule and underlying subscription when it ends. */ end_behavior?: SubscriptionData.EndBehavior; @@ -2870,7 +2870,7 @@ declare module 'stripe' { description?: string; /** - * Configures how the subscription schedule behaves when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. + * Behavior of the subscription schedule and underlying subscription when it ends. */ end_behavior?: SubscriptionDataOverride.EndBehavior; diff --git a/types/SubscriptionSchedules.d.ts b/types/SubscriptionSchedules.d.ts index 930d70d8ee..ad6091d7f0 100644 --- a/types/SubscriptionSchedules.d.ts +++ b/types/SubscriptionSchedules.d.ts @@ -65,7 +65,7 @@ declare module 'stripe' { default_settings: SubscriptionSchedule.DefaultSettings; /** - * Behavior of the subscription schedule and underlying subscription when it ends. Possible values are `release` and `cancel`. + * Behavior of the subscription schedule and underlying subscription when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. */ end_behavior: SubscriptionSchedule.EndBehavior; diff --git a/types/SubscriptionSchedulesResource.d.ts b/types/SubscriptionSchedulesResource.d.ts index dbee731f11..3f4c8c7dd7 100644 --- a/types/SubscriptionSchedulesResource.d.ts +++ b/types/SubscriptionSchedulesResource.d.ts @@ -19,7 +19,7 @@ declare module 'stripe' { default_settings?: SubscriptionScheduleCreateParams.DefaultSettings; /** - * Configures how the subscription schedule behaves when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. + * Behavior of the subscription schedule and underlying subscription when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. */ end_behavior?: SubscriptionScheduleCreateParams.EndBehavior; @@ -729,7 +729,7 @@ declare module 'stripe' { default_settings?: SubscriptionScheduleUpdateParams.DefaultSettings; /** - * Configures how the subscription schedule behaves when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. + * Behavior of the subscription schedule and underlying subscription when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. */ end_behavior?: SubscriptionScheduleUpdateParams.EndBehavior; @@ -1577,6 +1577,8 @@ declare module 'stripe' { | 'duration' | 'schedule_end' | 'timestamp' + | 'trial_end' + | 'trial_start' | 'upcoming_invoice'; } @@ -1623,6 +1625,8 @@ declare module 'stripe' { | 'now' | 'schedule_end' | 'timestamp' + | 'trial_end' + | 'trial_start' | 'upcoming_invoice'; } @@ -2014,7 +2018,7 @@ declare module 'stripe' { interface ScheduleSettings { /** - * Configures how the subscription schedule behaves when it ends. + * Behavior of the subscription schedule and underlying subscription when it ends. */ end_behavior?: ScheduleSettings.EndBehavior; } diff --git a/types/Tax/Calculations.d.ts b/types/Tax/Calculations.d.ts new file mode 100644 index 0000000000..518957758c --- /dev/null +++ b/types/Tax/Calculations.d.ts @@ -0,0 +1,230 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace Tax { + /** + * A Tax `Calculation` allows you to calculate the tax to collect from your customer. + */ + interface Calculation { + /** + * Unique identifier for the calculation. + */ + id: string | null; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'tax.calculation'; + + /** + * Total after taxes. + */ + amount_total: number; + + /** + * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). + */ + currency: string; + + /** + * The ID of an existing [Customer](https://stripe.com/docs/api/customers/object) used for the resource. + */ + customer: string | null; + + customer_details: Calculation.CustomerDetails; + + /** + * Timestamp of date at which the tax calculation will expire. Empty if the calculation is an unsaved preview. + */ + expires_at: number | null; + + /** + * The list of items the customer is purchasing. + */ + line_items: ApiList | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + 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. + */ + tax_amount_exclusive: number; + + /** + * The amount of tax already included in the line item prices. + */ + tax_amount_inclusive: number; + + /** + * Breakdown of individual tax amounts that add up to the total. + */ + tax_breakdown: Array; + + /** + * Timestamp of date at which the tax rules and rates in effect applies for the calculation. + */ + tax_date: number; + } + + namespace Calculation { + interface CustomerDetails { + /** + * The customer's postal address (e.g., home or business location). + */ + address: Stripe.Address | null; + + /** + * The type of customer address provided. + */ + address_source: CustomerDetails.AddressSource | null; + + /** + * The customer's IP address (IPv4 or IPv6). + */ + ip_address: string | null; + + /** + * The customer's tax IDs (e.g., EU VAT numbers). + */ + tax_ids: Array; + } + + namespace CustomerDetails { + type AddressSource = 'billing' | 'shipping'; + + interface TaxId { + /** + * The type of the tax ID, one of `eu_vat`, `br_cnpj`, `br_cpf`, `eu_oss_vat`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, `ke_pin`, `tr_tin`, `eg_tin`, `ph_tin`, or `unknown` + */ + type: TaxId.Type; + + /** + * The value of the tax ID. + */ + value: string; + } + + namespace TaxId { + type Type = + | 'ae_trn' + | 'au_abn' + | 'au_arn' + | 'bg_uic' + | 'br_cnpj' + | 'br_cpf' + | 'ca_bn' + | 'ca_gst_hst' + | 'ca_pst_bc' + | 'ca_pst_mb' + | 'ca_pst_sk' + | 'ca_qst' + | 'ch_vat' + | 'cl_tin' + | 'eg_tin' + | 'es_cif' + | 'eu_oss_vat' + | 'eu_vat' + | 'gb_vat' + | 'ge_vat' + | 'hk_br' + | 'hu_tin' + | 'id_npwp' + | 'il_vat' + | 'in_gst' + | 'is_vat' + | 'jp_cn' + | 'jp_rn' + | 'jp_trn' + | 'ke_pin' + | 'kr_brn' + | 'li_uid' + | 'mx_rfc' + | 'my_frp' + | 'my_itn' + | 'my_sst' + | 'no_vat' + | 'nz_gst' + | 'ph_tin' + | 'ru_inn' + | 'ru_kpp' + | 'sa_vat' + | 'sg_gst' + | 'sg_uen' + | 'si_tin' + | 'th_vat' + | 'tr_tin' + | 'tw_vat' + | 'ua_vat' + | 'unknown' + | 'us_ein' + | 'za_vat'; + } + } + + interface TaxBreakdown { + /** + * The amount of tax, in integer cents. + */ + amount: number; + + /** + * Specifies whether the tax amount is included in the line item amount. + */ + inclusive: boolean; + + tax_rate_details: TaxBreakdown.TaxRateDetails; + + /** + * The amount on which tax is calculated, in integer cents. + */ + taxable_amount: number; + } + + namespace TaxBreakdown { + interface TaxRateDetails { + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country: string | null; + + /** + * The tax rate percentage as a string. For example, 8.5% is represented as `"8.5"`. + */ + percentage_decimal: string; + + /** + * State, county, province, or region. + */ + state: string | null; + + /** + * The tax type, such as `vat` or `sales_tax`. + */ + tax_type: TaxRateDetails.TaxType | null; + } + + namespace TaxRateDetails { + type TaxType = + | 'gst' + | 'hst' + | 'jct' + | 'pst' + | 'qst' + | 'rst' + | 'sales_tax' + | 'vat'; + } + } + } + } + } +} diff --git a/types/Tax/CalculationsResource.d.ts b/types/Tax/CalculationsResource.d.ts new file mode 100644 index 0000000000..46ad42278b --- /dev/null +++ b/types/Tax/CalculationsResource.d.ts @@ -0,0 +1,242 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace Tax { + interface CalculationCreateParams { + /** + * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). + */ + currency: string; + + /** + * A list of items the customer is purchasing. + */ + line_items: Array; + + /** + * The ID of an existing customer to use for this calculation. If provided, the customer's address and tax IDs are copied to `customer_details`. + */ + customer?: string; + + /** + * Details about the customer, including address and tax IDs. + */ + customer_details?: CalculationCreateParams.CustomerDetails; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The boolean value that indicates if the calculation is a preview. If true, the calculation is not stored. If false, the calculation is stored for 48 hours. Defaults to true. + */ + 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. + */ + tax_date?: number; + } + + namespace CalculationCreateParams { + interface CustomerDetails { + /** + * The customer's postal address (e.g., home or business location). + */ + address?: CustomerDetails.Address; + + /** + * The type of customer address provided. Required when using `address`. + */ + address_source?: CustomerDetails.AddressSource; + + /** + * The customer's IP address (IPv4 or IPv6). + */ + ip_address?: string; + + /** + * The customer's tax IDs. + */ + tax_ids?: Array; + } + + namespace CustomerDetails { + interface Address { + /** + * City, district, suburb, town, or village. + */ + city?: string; + + /** + * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + */ + country: string; + + /** + * Address line 1 (e.g., street, PO Box, or company name). + */ + line1?: string; + + /** + * Address line 2 (e.g., apartment, suite, unit, or building). + */ + line2?: string; + + /** + * ZIP or postal code. + */ + postal_code?: string; + + /** + * State/province as an [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) subdivision code, without country prefix. Example: "NY" or "TX". + */ + state?: string; + } + + type AddressSource = 'billing' | 'shipping'; + + interface TaxId { + /** + * Type of the tax ID, one of `ae_trn`, `au_abn`, `au_arn`, `bg_uic`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `ph_tin`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, or `za_vat` + */ + type: TaxId.Type; + + /** + * Value of the tax ID. + */ + value: string; + } + + namespace TaxId { + type Type = + | 'ae_trn' + | 'au_abn' + | 'au_arn' + | 'bg_uic' + | 'br_cnpj' + | 'br_cpf' + | 'ca_bn' + | 'ca_gst_hst' + | 'ca_pst_bc' + | 'ca_pst_mb' + | 'ca_pst_sk' + | 'ca_qst' + | 'ch_vat' + | 'cl_tin' + | 'eg_tin' + | 'es_cif' + | 'eu_oss_vat' + | 'eu_vat' + | 'gb_vat' + | 'ge_vat' + | 'hk_br' + | 'hu_tin' + | 'id_npwp' + | 'il_vat' + | 'in_gst' + | 'is_vat' + | 'jp_cn' + | 'jp_rn' + | 'jp_trn' + | 'ke_pin' + | 'kr_brn' + | 'li_uid' + | 'mx_rfc' + | 'my_frp' + | 'my_itn' + | 'my_sst' + | 'no_vat' + | 'nz_gst' + | 'ph_tin' + | 'ru_inn' + | 'ru_kpp' + | 'sa_vat' + | 'sg_gst' + | 'sg_uen' + | 'si_tin' + | 'th_vat' + | 'tr_tin' + | 'tw_vat' + | 'ua_vat' + | 'us_ein' + | 'za_vat'; + } + } + + interface LineItem { + /** + * A positive integer in cents representing the line item's total price. If `tax_behavior=inclusive`, then this amount includes taxes. Otherwise, taxes are calculated on top of this amount. + */ + amount: number; + + /** + * If provided, the product's `tax_code` will be used as the line item's `tax_code`. + */ + product?: string; + + /** + * The number of units of the item being purchased. The `amount` is a total amount for the whole line. Used to calculate the per-unit price, when required. + */ + quantity?: number; + + /** + * A custom identifier for this line item. Must be unique across the line items in the calculation. + */ + reference?: string; + + /** + * Specifies whether the `amount` includes taxes. If `tax_behavior=inclusive`, then the amount includes taxes. + */ + tax_behavior?: LineItem.TaxBehavior; + + /** + * A [tax code](https://stripe.com/docs/tax/tax-categories) ID to use for this line item. If not provided, we will use the tax code from the provided `product` param. If neither `tax_code` or `product` is provided, we will use the default tax code from your Tax Settings. + */ + tax_code?: string; + } + + namespace LineItem { + type TaxBehavior = 'exclusive' | 'inclusive'; + } + } + + interface CalculationListLineItemsParams extends PaginationParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class CalculationsResource { + /** + * Calculates tax based on input and returns a Tax Calculation object. + */ + create( + params: CalculationCreateParams, + options?: RequestOptions + ): Promise>; + + /** + * Retrieves the line items of a persisted tax calculation as a collection. + */ + listLineItems( + id: string, + params?: CalculationListLineItemsParams, + options?: RequestOptions + ): ApiListPromise; + listLineItems( + id: string, + options?: RequestOptions + ): ApiListPromise; + } + } + } +} diff --git a/types/Tax/Transactions.d.ts b/types/Tax/Transactions.d.ts new file mode 100644 index 0000000000..b77c03d6a6 --- /dev/null +++ b/types/Tax/Transactions.d.ts @@ -0,0 +1,179 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace Tax { + /** + * A Tax `Transaction` records the tax collected from or refunded to your customer. + */ + interface Transaction { + /** + * Unique identifier for the transaction. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'tax.transaction'; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). + */ + currency: string; + + /** + * The ID of an existing [Customer](https://stripe.com/docs/api/customers/object) used for the resource. + */ + customer: string | null; + + customer_details: Transaction.CustomerDetails; + + /** + * The tax collected or refunded, by line item. + */ + line_items: ApiList | null; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * 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. + */ + metadata: Stripe.Metadata | null; + + /** + * A custom unique identifier, such as 'myOrder_123'. + */ + reference: string; + + /** + * If `type=reversal`, contains information about what was reversed. + */ + reversal: Transaction.Reversal | null; + + /** + * Timestamp of date at which the tax rules and rates in effect applies for the calculation. + */ + tax_date: number; + + /** + * If `reversal`, this transaction reverses an earlier transaction. + */ + type: Transaction.Type; + } + + namespace Transaction { + interface CustomerDetails { + /** + * The customer's postal address (e.g., home or business location). + */ + address: Stripe.Address | null; + + /** + * The type of customer address provided. + */ + address_source: CustomerDetails.AddressSource | null; + + /** + * The customer's IP address (IPv4 or IPv6). + */ + ip_address: string | null; + + /** + * The customer's tax IDs (e.g., EU VAT numbers). + */ + tax_ids: Array; + } + + namespace CustomerDetails { + type AddressSource = 'billing' | 'shipping'; + + interface TaxId { + /** + * The type of the tax ID, one of `eu_vat`, `br_cnpj`, `br_cpf`, `eu_oss_vat`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, `ke_pin`, `tr_tin`, `eg_tin`, `ph_tin`, or `unknown` + */ + type: TaxId.Type; + + /** + * The value of the tax ID. + */ + value: string; + } + + namespace TaxId { + type Type = + | 'ae_trn' + | 'au_abn' + | 'au_arn' + | 'bg_uic' + | 'br_cnpj' + | 'br_cpf' + | 'ca_bn' + | 'ca_gst_hst' + | 'ca_pst_bc' + | 'ca_pst_mb' + | 'ca_pst_sk' + | 'ca_qst' + | 'ch_vat' + | 'cl_tin' + | 'eg_tin' + | 'es_cif' + | 'eu_oss_vat' + | 'eu_vat' + | 'gb_vat' + | 'ge_vat' + | 'hk_br' + | 'hu_tin' + | 'id_npwp' + | 'il_vat' + | 'in_gst' + | 'is_vat' + | 'jp_cn' + | 'jp_rn' + | 'jp_trn' + | 'ke_pin' + | 'kr_brn' + | 'li_uid' + | 'mx_rfc' + | 'my_frp' + | 'my_itn' + | 'my_sst' + | 'no_vat' + | 'nz_gst' + | 'ph_tin' + | 'ru_inn' + | 'ru_kpp' + | 'sa_vat' + | 'sg_gst' + | 'sg_uen' + | 'si_tin' + | 'th_vat' + | 'tr_tin' + | 'tw_vat' + | 'ua_vat' + | 'unknown' + | 'us_ein' + | 'za_vat'; + } + } + + interface Reversal { + /** + * The `id` of the reversed `Transaction` object. + */ + original_transaction: string | null; + } + + type Type = 'reversal' | 'transaction'; + } + } + } +} diff --git a/types/Tax/TransactionsResource.d.ts b/types/Tax/TransactionsResource.d.ts new file mode 100644 index 0000000000..c49a029fc6 --- /dev/null +++ b/types/Tax/TransactionsResource.d.ts @@ -0,0 +1,130 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace Tax { + interface TransactionCreateParams { + /** + * Tax Calculation ID to be used as input when creating the transaction. + */ + from_calculation: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * 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; + } + + interface TransactionRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface TransactionCreateReversalParams { + /** + * If `partial`, the provided line item amounts are reversed. If `full`, the original transaction is fully reversed. + */ + mode: TransactionCreateReversalParams.Mode; + + /** + * The ID of the Transaction to partially or fully reverse. + */ + original_transaction: string; + + /** + * A custom identifier for this reversal, such as 'myOrder_123-refund_1'. Must be unique across all transactions. + */ + reference: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The line item amounts to reverse. + */ + line_items?: Array; + + /** + * 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; + } + + namespace TransactionCreateReversalParams { + interface LineItem { + /** + * The amount to reverse, in negative integer cents. + */ + amount: number; + + /** + * The amount of tax to reverse, in negative integer cents. + */ + amount_tax: number; + + /** + * 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. + */ + metadata?: Stripe.MetadataParam; + + /** + * The `id` of the line item to reverse in the original transaction. + */ + original_line_item: string; + + /** + * The quantity reversed. + */ + quantity?: number; + + /** + * A custom identifier for this line item in the reversal transaction, such as 'L1-refund'. + */ + reference: string; + } + + type Mode = 'full' | 'partial'; + } + + class TransactionsResource { + /** + * Creates a Tax Transaction from a calculation. + */ + create( + params: TransactionCreateParams, + options?: RequestOptions + ): Promise>; + + /** + * Retrieves a Tax Transaction object. + */ + retrieve( + id: string, + params?: TransactionRetrieveParams, + options?: RequestOptions + ): Promise>; + retrieve( + id: string, + options?: RequestOptions + ): Promise>; + + /** + * Partially or fully reverses a previously created Transaction. + */ + createReversal( + params: TransactionCreateReversalParams, + options?: RequestOptions + ): Promise>; + } + } + } +} diff --git a/types/TaxCalculations.d.ts b/types/TaxCalculations.d.ts deleted file mode 100644 index e71c8e9da0..0000000000 --- a/types/TaxCalculations.d.ts +++ /dev/null @@ -1,228 +0,0 @@ -// File generated from our OpenAPI spec - -declare module 'stripe' { - namespace Stripe { - /** - * A Tax `Calculation` allows you to calculate the tax to collect from your customer. - */ - interface TaxCalculation { - /** - * Unique identifier for the calculation. - */ - id: string | null; - - /** - * String representing the object's type. Objects of the same type share the same value. - */ - object: 'tax.calculation'; - - /** - * Total after taxes. - */ - amount_total: number; - - /** - * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). - */ - currency: string; - - /** - * The ID of an existing [Customer](https://stripe.com/docs/api/customers/object) used for the resource. - */ - customer: string | null; - - customer_details: TaxCalculation.CustomerDetails; - - /** - * Timestamp of date at which the tax calculation will expire. Empty if the calculation is an unsaved preview. - */ - expires_at: number | null; - - /** - * The list of items the customer is purchasing. - */ - line_items: ApiList | null; - - /** - * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. - */ - 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. - */ - tax_amount_exclusive: number; - - /** - * The amount of tax already included in the line item prices. - */ - tax_amount_inclusive: number; - - /** - * Breakdown of individual tax amounts that add up to the total. - */ - tax_breakdown: Array; - - /** - * Timestamp of date at which the tax rules and rates in effect applies for the calculation. - */ - tax_date: number; - } - - namespace TaxCalculation { - interface CustomerDetails { - /** - * The customer's postal address (e.g., home or business location). - */ - address: Stripe.Address | null; - - /** - * The type of customer address provided. - */ - address_source: CustomerDetails.AddressSource | null; - - /** - * The customer's IP address (IPv4 or IPv6). - */ - ip_address: string | null; - - /** - * The customer's tax IDs (e.g., EU VAT numbers). - */ - tax_ids: Array; - } - - namespace CustomerDetails { - type AddressSource = 'billing' | 'shipping'; - - interface TaxId { - /** - * The type of the tax ID, one of `eu_vat`, `br_cnpj`, `br_cpf`, `eu_oss_vat`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, `ke_pin`, `tr_tin`, `eg_tin`, `ph_tin`, or `unknown` - */ - type: TaxId.Type; - - /** - * The value of the tax ID. - */ - value: string; - } - - namespace TaxId { - type Type = - | 'ae_trn' - | 'au_abn' - | 'au_arn' - | 'bg_uic' - | 'br_cnpj' - | 'br_cpf' - | 'ca_bn' - | 'ca_gst_hst' - | 'ca_pst_bc' - | 'ca_pst_mb' - | 'ca_pst_sk' - | 'ca_qst' - | 'ch_vat' - | 'cl_tin' - | 'eg_tin' - | 'es_cif' - | 'eu_oss_vat' - | 'eu_vat' - | 'gb_vat' - | 'ge_vat' - | 'hk_br' - | 'hu_tin' - | 'id_npwp' - | 'il_vat' - | 'in_gst' - | 'is_vat' - | 'jp_cn' - | 'jp_rn' - | 'jp_trn' - | 'ke_pin' - | 'kr_brn' - | 'li_uid' - | 'mx_rfc' - | 'my_frp' - | 'my_itn' - | 'my_sst' - | 'no_vat' - | 'nz_gst' - | 'ph_tin' - | 'ru_inn' - | 'ru_kpp' - | 'sa_vat' - | 'sg_gst' - | 'sg_uen' - | 'si_tin' - | 'th_vat' - | 'tr_tin' - | 'tw_vat' - | 'ua_vat' - | 'unknown' - | 'us_ein' - | 'za_vat'; - } - } - - interface TaxBreakdown { - /** - * The amount of tax, in integer cents. - */ - amount: number; - - /** - * Specifies whether the tax amount is included in the line item amount. - */ - inclusive: boolean; - - tax_rate_details: TaxBreakdown.TaxRateDetails; - - /** - * The amount on which tax is calculated, in integer cents. - */ - taxable_amount: number; - } - - namespace TaxBreakdown { - interface TaxRateDetails { - /** - * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - */ - country: string | null; - - /** - * The tax rate percentage as a string. For example, 8.5% is represented as `"8.5"`. - */ - percentage_decimal: string; - - /** - * State, county, province, or region. - */ - state: string | null; - - /** - * The tax type, such as `vat` or `sales_tax`. - */ - tax_type: TaxRateDetails.TaxType | null; - } - - namespace TaxRateDetails { - type TaxType = - | 'gst' - | 'hst' - | 'jct' - | 'pst' - | 'qst' - | 'rst' - | 'sales_tax' - | 'vat'; - } - } - } - } -} diff --git a/types/TaxCalculationsResource.d.ts b/types/TaxCalculationsResource.d.ts deleted file mode 100644 index 0af5123c65..0000000000 --- a/types/TaxCalculationsResource.d.ts +++ /dev/null @@ -1,240 +0,0 @@ -// File generated from our OpenAPI spec - -declare module 'stripe' { - namespace Stripe { - interface TaxCalculationCreateParams { - /** - * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). - */ - currency: string; - - /** - * A list of items the customer is purchasing. - */ - line_items: Array; - - /** - * The ID of an existing customer to use for this calculation. If provided, the customer's address and tax IDs are copied to `customer_details`. - */ - customer?: string; - - /** - * Details about the customer, including address and tax IDs. - */ - customer_details?: TaxCalculationCreateParams.CustomerDetails; - - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - - /** - * The boolean value that indicates if the calculation is a preview. If true, the calculation is not stored. If false, the calculation is stored for 48 hours. Defaults to true. - */ - 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. - */ - tax_date?: number; - } - - namespace TaxCalculationCreateParams { - interface CustomerDetails { - /** - * The customer's postal address (e.g., home or business location). - */ - address?: CustomerDetails.Address; - - /** - * The type of customer address provided. Required when using `address`. - */ - address_source?: CustomerDetails.AddressSource; - - /** - * The customer's IP address (IPv4 or IPv6). - */ - ip_address?: string; - - /** - * The customer's tax IDs. - */ - tax_ids?: Array; - } - - namespace CustomerDetails { - interface Address { - /** - * City, district, suburb, town, or village. - */ - city?: string; - - /** - * Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). - */ - country: string; - - /** - * Address line 1 (e.g., street, PO Box, or company name). - */ - line1?: string; - - /** - * Address line 2 (e.g., apartment, suite, unit, or building). - */ - line2?: string; - - /** - * ZIP or postal code. - */ - postal_code?: string; - - /** - * State/province as an [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) subdivision code, without country prefix. Example: "NY" or "TX". - */ - state?: string; - } - - type AddressSource = 'billing' | 'shipping'; - - interface TaxId { - /** - * Type of the tax ID, one of `ae_trn`, `au_abn`, `au_arn`, `bg_uic`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `ph_tin`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, or `za_vat` - */ - type: TaxId.Type; - - /** - * Value of the tax ID. - */ - value: string; - } - - namespace TaxId { - type Type = - | 'ae_trn' - | 'au_abn' - | 'au_arn' - | 'bg_uic' - | 'br_cnpj' - | 'br_cpf' - | 'ca_bn' - | 'ca_gst_hst' - | 'ca_pst_bc' - | 'ca_pst_mb' - | 'ca_pst_sk' - | 'ca_qst' - | 'ch_vat' - | 'cl_tin' - | 'eg_tin' - | 'es_cif' - | 'eu_oss_vat' - | 'eu_vat' - | 'gb_vat' - | 'ge_vat' - | 'hk_br' - | 'hu_tin' - | 'id_npwp' - | 'il_vat' - | 'in_gst' - | 'is_vat' - | 'jp_cn' - | 'jp_rn' - | 'jp_trn' - | 'ke_pin' - | 'kr_brn' - | 'li_uid' - | 'mx_rfc' - | 'my_frp' - | 'my_itn' - | 'my_sst' - | 'no_vat' - | 'nz_gst' - | 'ph_tin' - | 'ru_inn' - | 'ru_kpp' - | 'sa_vat' - | 'sg_gst' - | 'sg_uen' - | 'si_tin' - | 'th_vat' - | 'tr_tin' - | 'tw_vat' - | 'ua_vat' - | 'us_ein' - | 'za_vat'; - } - } - - interface LineItem { - /** - * A positive integer in cents representing the line item's total price. If `tax_behavior=inclusive`, then this amount includes taxes. Otherwise, taxes are calculated on top of this amount. - */ - amount: number; - - /** - * If provided, the product's `tax_code` will be used as the line item's `tax_code`. - */ - product?: string; - - /** - * The number of units of the item being purchased. The `amount` is a total amount for the whole line. Used to calculate the per-unit price, when required. - */ - quantity?: number; - - /** - * A custom identifier for this line item. Must be unique across the line items in the calculation. - */ - reference?: string; - - /** - * Specifies whether the `amount` includes taxes. If `tax_behavior=inclusive`, then the amount includes taxes. - */ - tax_behavior?: LineItem.TaxBehavior; - - /** - * A [tax code](https://stripe.com/docs/tax/tax-categories) ID to use for this line item. If not provided, we will use the tax code from the provided `product` param. If neither `tax_code` or `product` is provided, we will use the default tax code from your Tax Settings. - */ - tax_code?: string; - } - - namespace LineItem { - type TaxBehavior = 'exclusive' | 'inclusive'; - } - } - - interface TaxCalculationListLineItemsParams extends PaginationParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - } - - class TaxCalculationsResource { - /** - * Calculates tax based on input and returns a Tax Calculation object. - */ - create( - params: TaxCalculationCreateParams, - options?: RequestOptions - ): Promise>; - - /** - * Retrieves the line items of a persisted tax calculation as a collection. - */ - listLineItems( - id: string, - params?: TaxCalculationListLineItemsParams, - options?: RequestOptions - ): ApiListPromise; - listLineItems( - id: string, - options?: RequestOptions - ): ApiListPromise; - } - } -} diff --git a/types/TaxTransactions.d.ts b/types/TaxTransactions.d.ts deleted file mode 100644 index b1cbd61912..0000000000 --- a/types/TaxTransactions.d.ts +++ /dev/null @@ -1,177 +0,0 @@ -// File generated from our OpenAPI spec - -declare module 'stripe' { - namespace Stripe { - /** - * A Tax `Transaction` records the tax collected from or refunded to your customer. - */ - interface TaxTransaction { - /** - * Unique identifier for the transaction. - */ - id: string; - - /** - * String representing the object's type. Objects of the same type share the same value. - */ - object: 'tax.transaction'; - - /** - * Time at which the object was created. Measured in seconds since the Unix epoch. - */ - created: number; - - /** - * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). - */ - currency: string; - - /** - * The ID of an existing [Customer](https://stripe.com/docs/api/customers/object) used for the resource. - */ - customer: string | null; - - customer_details: TaxTransaction.CustomerDetails; - - /** - * The tax collected or refunded, by line item. - */ - line_items: ApiList | null; - - /** - * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. - */ - livemode: boolean; - - /** - * 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. - */ - metadata: Stripe.Metadata | null; - - /** - * A custom unique identifier, such as 'myOrder_123'. - */ - reference: string; - - /** - * If `type=reversal`, contains information about what was reversed. - */ - reversal: TaxTransaction.Reversal | null; - - /** - * Timestamp of date at which the tax rules and rates in effect applies for the calculation. - */ - tax_date: number; - - /** - * If `reversal`, this transaction reverses an earlier transaction. - */ - type: TaxTransaction.Type; - } - - namespace TaxTransaction { - interface CustomerDetails { - /** - * The customer's postal address (e.g., home or business location). - */ - address: Stripe.Address | null; - - /** - * The type of customer address provided. - */ - address_source: CustomerDetails.AddressSource | null; - - /** - * The customer's IP address (IPv4 or IPv6). - */ - ip_address: string | null; - - /** - * The customer's tax IDs (e.g., EU VAT numbers). - */ - tax_ids: Array; - } - - namespace CustomerDetails { - type AddressSource = 'billing' | 'shipping'; - - interface TaxId { - /** - * The type of the tax ID, one of `eu_vat`, `br_cnpj`, `br_cpf`, `eu_oss_vat`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, `ke_pin`, `tr_tin`, `eg_tin`, `ph_tin`, or `unknown` - */ - type: TaxId.Type; - - /** - * The value of the tax ID. - */ - value: string; - } - - namespace TaxId { - type Type = - | 'ae_trn' - | 'au_abn' - | 'au_arn' - | 'bg_uic' - | 'br_cnpj' - | 'br_cpf' - | 'ca_bn' - | 'ca_gst_hst' - | 'ca_pst_bc' - | 'ca_pst_mb' - | 'ca_pst_sk' - | 'ca_qst' - | 'ch_vat' - | 'cl_tin' - | 'eg_tin' - | 'es_cif' - | 'eu_oss_vat' - | 'eu_vat' - | 'gb_vat' - | 'ge_vat' - | 'hk_br' - | 'hu_tin' - | 'id_npwp' - | 'il_vat' - | 'in_gst' - | 'is_vat' - | 'jp_cn' - | 'jp_rn' - | 'jp_trn' - | 'ke_pin' - | 'kr_brn' - | 'li_uid' - | 'mx_rfc' - | 'my_frp' - | 'my_itn' - | 'my_sst' - | 'no_vat' - | 'nz_gst' - | 'ph_tin' - | 'ru_inn' - | 'ru_kpp' - | 'sa_vat' - | 'sg_gst' - | 'sg_uen' - | 'si_tin' - | 'th_vat' - | 'tr_tin' - | 'tw_vat' - | 'ua_vat' - | 'unknown' - | 'us_ein' - | 'za_vat'; - } - } - - interface Reversal { - /** - * The `id` of the `Transaction` object that this one reversed. - */ - original_transaction: string | null; - } - - type Type = 'reversal' | 'transaction'; - } - } -} diff --git a/types/TaxTransactionsResource.d.ts b/types/TaxTransactionsResource.d.ts deleted file mode 100644 index 658a13cb20..0000000000 --- a/types/TaxTransactionsResource.d.ts +++ /dev/null @@ -1,128 +0,0 @@ -// File generated from our OpenAPI spec - -declare module 'stripe' { - namespace Stripe { - interface TaxTransactionCreateParams { - /** - * Tax Calculation ID to be used as input when creating the transaction. - */ - from_calculation: string; - - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - - /** - * 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; - } - - interface TaxTransactionRetrieveParams { - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - } - - interface TaxTransactionCreateReversalParams { - /** - * If `partial`, the provided line item amounts are reversed. If `full`, the original transaction is fully reversed. - */ - mode: TaxTransactionCreateReversalParams.Mode; - - /** - * The ID of the transaction to partially or fully reverse. - */ - original_transaction: string; - - /** - * A custom identifier for this reversal, such as 'myOrder_123-refund_1'. Must be unique across all transactions. - */ - reference: string; - - /** - * Specifies which fields in the response should be expanded. - */ - expand?: Array; - - /** - * The line item amounts to reverse. - */ - line_items?: Array; - - /** - * 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; - } - - namespace TaxTransactionCreateReversalParams { - interface LineItem { - /** - * The amount to reverse, in negative integer cents. - */ - amount: number; - - /** - * The amount of tax to reverse, in negative integer cents. - */ - amount_tax: number; - - /** - * 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. - */ - metadata?: Stripe.MetadataParam; - - /** - * The `id` of the line item to reverse in the original transaction. - */ - original_line_item: string; - - /** - * The quantity reversed. - */ - quantity?: number; - - /** - * A custom identifier for this line item in the reversal transaction, such as 'L1-refund'. - */ - reference: string; - } - - type Mode = 'full' | 'partial'; - } - - class TaxTransactionsResource { - /** - * Creates a Tax Transaction from a calculation. - */ - create( - params: TaxTransactionCreateParams, - options?: RequestOptions - ): Promise>; - - /** - * Retrieves a Tax Transaction object. - */ - retrieve( - id: string, - params?: TaxTransactionRetrieveParams, - options?: RequestOptions - ): Promise>; - retrieve( - id: string, - options?: RequestOptions - ): Promise>; - - /** - * Creates a partial or full reversal of a previously created Transaction. - */ - createReversal( - params: TaxTransactionCreateReversalParams, - options?: RequestOptions - ): Promise>; - } - } -} diff --git a/types/index.d.ts b/types/index.d.ts index a5363fa825..c88983d797 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -49,8 +49,6 @@ /// /// /// -/// -/// /// /// /// @@ -81,6 +79,8 @@ /// /// /// +/// +/// /// /// /// @@ -193,12 +193,12 @@ /// /// /// -/// +/// +/// /// /// /// /// -/// /// /// /// @@ -278,8 +278,6 @@ declare module 'stripe' { subscriptions: Stripe.SubscriptionsResource; subscriptionItems: Stripe.SubscriptionItemsResource; subscriptionSchedules: Stripe.SubscriptionSchedulesResource; - taxCalculations: Stripe.TaxCalculationsResource; - taxTransactions: Stripe.TaxTransactionsResource; taxCodes: Stripe.TaxCodesResource; taxRates: Stripe.TaxRatesResource; tokens: Stripe.TokensResource; @@ -338,6 +336,10 @@ declare module 'stripe' { sigma: { scheduledQueryRuns: Stripe.Sigma.ScheduledQueryRunsResource; }; + tax: { + calculations: Stripe.Tax.CalculationsResource; + transactions: Stripe.Tax.TransactionsResource; + }; terminal: { configurations: Stripe.Terminal.ConfigurationsResource; connectionTokens: Stripe.Terminal.ConnectionTokensResource;