diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000000..312540b61f --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,11 @@ +### Why? + + +### What? + + +### See Also + diff --git a/CHANGELOG.md b/CHANGELOG.md index c1e683d60e..0fcb7c3974 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,141 @@ # Changelog +## 17.5.0 - 2024-12-18 +* [#2237](https://github.com/stripe/stripe-node/pull/2237) This release changes the pinned API version to `2024-12-18.acacia`. + * Change `Account.business_profile.annual_revenue` and `Account.business_profile.estimated_worker_count` to be optional + * Add support for `network_advice_code` and `network_decline_code` on `Charge.outcome`, `Invoice.last_finalization_error`, `PaymentIntent.last_payment_error`, `SetupAttempt.setup_error`, `SetupIntent.last_setup_error`, and `StripeError` + * Add support for new values `payout_minimum_balance_hold` and `payout_minimum_balance_release` on enum `BalanceTransaction.type` + * Add support for `credits_application_invoice_voided` on `Billing.CreditBalanceTransaction.credit` + * Change type of `Billing.CreditBalanceTransaction.credit.type` from `literal('credits_granted')` to `enum('credits_application_invoice_voided'|'credits_granted')` + * Change `BillingPortal.Configuration.features.subscription_update.schedule_at_period_end`, `Issuing.Authorization.verified_by_fraud_challenge`, `LineItem.description`, and `Payout.trace_id` to be required + * Add support for `allow_redisplay` on `Card` and `Source` + * Add support for `regulated_status` on `Card`, `Charge.payment_method_details.card`, `ConfirmationToken.payment_method_preview.card`, and `PaymentMethod.card` + * Add support for `funding` on `Charge.payment_method_details.amazon_pay` and `Charge.payment_method_details.revolut_pay` + * Add support for `network_transaction_id` on `Charge.payment_method_details.card` + * Add support for `reference_prefix` on `Checkout.Session.payment_method_options.bacs_debit.mandate_options`, `Checkout.Session.payment_method_options.sepa_debit.mandate_options`, `Checkout.SessionCreateParams.payment_method_options.bacs_debit.mandate_options`, `Checkout.SessionCreateParams.payment_method_options.sepa_debit.mandate_options`, `PaymentIntent.payment_method_options.bacs_debit.mandate_options`, `PaymentIntent.payment_method_options.sepa_debit.mandate_options`, `PaymentIntentConfirmParams.payment_method_options.bacs_debit.mandate_options`, `PaymentIntentConfirmParams.payment_method_options.sepa_debit.mandate_options`, `PaymentIntentCreateParams.payment_method_options.bacs_debit.mandate_options`, `PaymentIntentCreateParams.payment_method_options.sepa_debit.mandate_options`, `PaymentIntentUpdateParams.payment_method_options.bacs_debit.mandate_options`, `PaymentIntentUpdateParams.payment_method_options.sepa_debit.mandate_options`, `SetupIntent.payment_method_options.bacs_debit.mandate_options`, `SetupIntent.payment_method_options.sepa_debit.mandate_options`, `SetupIntentConfirmParams.payment_method_options.bacs_debit.mandate_options`, `SetupIntentConfirmParams.payment_method_options.sepa_debit.mandate_options`, `SetupIntentCreateParams.payment_method_options.bacs_debit.mandate_options`, `SetupIntentCreateParams.payment_method_options.sepa_debit.mandate_options`, `SetupIntentUpdateParams.payment_method_options.bacs_debit.mandate_options`, and `SetupIntentUpdateParams.payment_method_options.sepa_debit.mandate_options` + * Add support for new values `al_tin`, `am_tin`, `ao_tin`, `ba_tin`, `bb_tin`, `bs_tin`, `cd_nif`, `gn_nif`, `kh_tin`, `me_pib`, `mk_vat`, `mr_nif`, `np_pan`, `sn_ninea`, `sr_fin`, `tj_tin`, `ug_tin`, `zm_tin`, and `zw_tin` on enums `Checkout.Session.customer_details.tax_ids[].type`, `Invoice.customer_tax_ids[].type`, `Tax.Calculation.customer_details.tax_ids[].type`, `Tax.Transaction.customer_details.tax_ids[].type`, and `TaxId.type` + * Add support for new values `al_tin`, `am_tin`, `ao_tin`, `ba_tin`, `bb_tin`, `bs_tin`, `cd_nif`, `gn_nif`, `kh_tin`, `me_pib`, `mk_vat`, `mr_nif`, `np_pan`, `sn_ninea`, `sr_fin`, `tj_tin`, `ug_tin`, `zm_tin`, and `zw_tin` on enums `CustomerCreateParams.tax_id_data[].type`, `InvoiceCreatePreviewParams.customer_details.tax_ids[].type`, `InvoiceUpcomingLinesParams.customer_details.tax_ids[].type`, `InvoiceUpcomingParams.customer_details.tax_ids[].type`, `Tax.CalculationCreateParams.customer_details.tax_ids[].type`, and `TaxIdCreateParams.type` + * Add support for `visa_compliance` on `Dispute.evidence.enhanced_evidence`, `Dispute.evidence_details.enhanced_eligibility`, and `DisputeUpdateParams.evidence.enhanced_evidence` + * Add support for new value `request_signature` on enums `Forwarding.Request.replacements[]` and `Forwarding.RequestCreateParams.replacements[]` + * Add support for `account_holder_address` and `bank_address` on `FundingInstructions.bank_transfer.financial_addresses[].iban`, `FundingInstructions.bank_transfer.financial_addresses[].sort_code`, `FundingInstructions.bank_transfer.financial_addresses[].spei`, `FundingInstructions.bank_transfer.financial_addresses[].zengin`, `PaymentIntent.next_action.display_bank_transfer_instructions.financial_addresses[].iban`, `PaymentIntent.next_action.display_bank_transfer_instructions.financial_addresses[].sort_code`, `PaymentIntent.next_action.display_bank_transfer_instructions.financial_addresses[].spei`, and `PaymentIntent.next_action.display_bank_transfer_instructions.financial_addresses[].zengin` + * Add support for `account_holder_name` on `FundingInstructions.bank_transfer.financial_addresses[].spei` and `PaymentIntent.next_action.display_bank_transfer_instructions.financial_addresses[].spei` + * Add support for `disabled_reason` on `Invoice.automatic_tax`, `Subscription.automatic_tax`, `SubscriptionSchedule.default_settings.automatic_tax`, and `SubscriptionSchedule.phases[].automatic_tax` + * Add support for `tax_id` on `Issuing.Authorization.merchant_data` and `Issuing.Transaction.merchant_data` + * Change type of `LineItem.description` from `string` to `string | null` + * Add support for `trial_period_days` on `PaymentLinkUpdateParams.subscription_data` + * Add support for `al`, `am`, `ao`, `ba`, `bb`, `bs`, `cd`, `gn`, `kh`, `me`, `mk`, `mr`, `np`, `pe`, `sn`, `sr`, `tj`, `ug`, `uy`, `zm`, and `zw` on `Tax.Registration.country_options` and `Tax.RegistrationCreateParams.country_options` + * Add support for new value `2024-12-18.acacia` on enum `WebhookEndpointCreateParams.api_version` +* [#2238](https://github.com/stripe/stripe-node/pull/2238) add missing key warning to README + +## 17.4.0 - 2024-11-20 +* [#2222](https://github.com/stripe/stripe-node/pull/2222) This release changes the pinned API version to `2024-11-20.acacia`. + * Add support for `respond` test helper method on resource `Issuing.Authorization` + * Add support for `authorizer` on `AccountPersonsParams.relationship` and `TokenCreateParams.person.relationship` + * Change type of `Account.future_requirements.disabled_reason` and `Account.requirements.disabled_reason` from `string` to `enum` + * Change `AccountSession.components.account_management.features.disable_stripe_user_authentication`, `AccountSession.components.account_onboarding.features.disable_stripe_user_authentication`, `AccountSession.components.balances.features.disable_stripe_user_authentication`, `AccountSession.components.notification_banner.features.disable_stripe_user_authentication`, and `AccountSession.components.payouts.features.disable_stripe_user_authentication` to be required + * Add support for `adaptive_pricing` on `Checkout.SessionCreateParams` and `Checkout.Session` + * Add support for `mandate_options` on `Checkout.Session.payment_method_options.bacs_debit`, `Checkout.Session.payment_method_options.sepa_debit`, `Checkout.SessionCreateParams.payment_method_options.bacs_debit`, and `Checkout.SessionCreateParams.payment_method_options.sepa_debit` + * Add support for `request_extended_authorization`, `request_incremental_authorization`, `request_multicapture`, and `request_overcapture` on `Checkout.Session.payment_method_options.card` and `Checkout.SessionCreateParams.payment_method_options.card` + * Add support for `capture_method` on `Checkout.SessionCreateParams.payment_method_options.kakao_pay`, `Checkout.SessionCreateParams.payment_method_options.kr_card`, `Checkout.SessionCreateParams.payment_method_options.naver_pay`, `Checkout.SessionCreateParams.payment_method_options.payco`, and `Checkout.SessionCreateParams.payment_method_options.samsung_pay` + * Add support for new value `subscribe` on enums `Checkout.Session.submit_type`, `Checkout.SessionCreateParams.submit_type`, `PaymentLink.submit_type`, and `PaymentLinkCreateParams.submit_type` + * Add support for new value `li_vat` on enums `Checkout.Session.customer_details.tax_ids[].type`, `Invoice.customer_tax_ids[].type`, `Tax.Calculation.customer_details.tax_ids[].type`, `Tax.Transaction.customer_details.tax_ids[].type`, and `TaxId.type` + * Add support for new value `li_vat` on enums `CustomerCreateParams.tax_id_data[].type`, `InvoiceCreatePreviewParams.customer_details.tax_ids[].type`, `InvoiceUpcomingLinesParams.customer_details.tax_ids[].type`, `InvoiceUpcomingParams.customer_details.tax_ids[].type`, `Tax.CalculationCreateParams.customer_details.tax_ids[].type`, and `TaxIdCreateParams.type` + * Add support for new value `financial_account_statement` on enums `File.purpose` and `FileListParams.purpose` + * Add support for `account_holder_address`, `account_holder_name`, `account_type`, and `bank_address` on `FundingInstructions.bank_transfer.financial_addresses[].aba`, `FundingInstructions.bank_transfer.financial_addresses[].swift`, `PaymentIntent.next_action.display_bank_transfer_instructions.financial_addresses[].aba`, and `PaymentIntent.next_action.display_bank_transfer_instructions.financial_addresses[].swift` + * Add support for new value `service_tax` on enums `InvoiceAddLinesParams.lines[].tax_amounts[].tax_rate_data.tax_type`, `InvoiceUpdateLinesParams.lines[].tax_amounts[].tax_rate_data.tax_type`, `Tax.Calculation.shipping_cost.tax_breakdown[].tax_rate_details.tax_type`, `Tax.Calculation.tax_breakdown[].tax_rate_details.tax_type`, `Tax.CalculationLineItem.tax_breakdown[].tax_rate_details.tax_type`, `Tax.Transaction.shipping_cost.tax_breakdown[].tax_rate_details.tax_type`, `TaxRate.tax_type`, `TaxRateCreateParams.tax_type`, and `TaxRateUpdateParams.tax_type` + * Add support for `merchant_amount` and `merchant_currency` on `Issuing.AuthorizationCreateParams.testHelpers` + * Change `Issuing.AuthorizationCreateParams.testHelpers.amount` to be optional + * Add support for `fraud_challenges` and `verified_by_fraud_challenge` on `Issuing.Authorization` + * Add support for new value `link` on enums `PaymentIntent.payment_method_options.card.network`, `PaymentIntentConfirmParams.payment_method_options.card.network`, `PaymentIntentCreateParams.payment_method_options.card.network`, `PaymentIntentUpdateParams.payment_method_options.card.network`, `SetupIntent.payment_method_options.card.network`, `SetupIntentConfirmParams.payment_method_options.card.network`, `SetupIntentCreateParams.payment_method_options.card.network`, `SetupIntentUpdateParams.payment_method_options.card.network`, `Subscription.payment_settings.payment_method_options.card.network`, `SubscriptionCreateParams.payment_settings.payment_method_options.card.network`, and `SubscriptionUpdateParams.payment_settings.payment_method_options.card.network` + * Add support for `submit_type` on `PaymentLinkUpdateParams` + * Add support for `trace_id` on `Payout` + * Add support for `network_decline_code` on `Refund.destination_details.blik` and `Refund.destination_details.swish` + * Change type of `Treasury.InboundTransfer.origin_payment_method` from `string` to `string | null` + * Add support for new value `2024-11-20.acacia` on enum `WebhookEndpointCreateParams.api_version` +* [#2215](https://github.com/stripe/stripe-node/pull/2215) Remove empty resources created for service groupings + * Remove `Stripe.V2.BillingResource`, `Stripe.V2.CoreResource`, and `Stripe.V2Resource` types from the public interface as they are no longer needed. SDK usage will not be affected but any references to these types in your application will need to be removed. + +## 17.3.1 - 2024-11-01 +* [#2218](https://github.com/stripe/stripe-node/pull/2218) Fixed a bug where `latestapiversion` was not updated to `2024-10-28.acacia` in the last release. + +## 17.3.0 - 2024-10-29 +* [#2204](https://github.com/stripe/stripe-node/pull/2204) This release changes the pinned API version to `2024-10-28.acacia`. + * Add support for new resource `V2.EventDestinations` + * Add support for `create`, `retrieve`, `update`, `list`, `del`, `disable`, `enable` and `ping` methods on resource `V2.EventDestinations` + * Add support for `submit_card` test helper method on resource `Issuing.Card` + * Add support for `groups` on `AccountCreateParams`, `AccountUpdateParams`, and `Account` + * Add support for `alma_payments`, `kakao_pay_payments`, `kr_card_payments`, `naver_pay_payments`, `payco_payments`, and `samsung_pay_payments` on `Account.capabilities`, `AccountCreateParams.capabilities`, and `AccountUpdateParams.capabilities` + * Add support for `disable_stripe_user_authentication` on `AccountSession.components.account_management.features`, `AccountSession.components.account_onboarding.features`, `AccountSession.components.balances.features`, `AccountSession.components.notification_banner.features`, `AccountSession.components.payouts.features`, `AccountSessionCreateParams.components.account_management.features`, `AccountSessionCreateParams.components.account_onboarding.features`, `AccountSessionCreateParams.components.balances.features`, `AccountSessionCreateParams.components.notification_banner.features`, and `AccountSessionCreateParams.components.payouts.features` + * Add support for `schedule_at_period_end` on `BillingPortal.Configuration.features.subscription_update`, `BillingPortal.ConfigurationCreateParams.features.subscription_update`, and `BillingPortal.ConfigurationUpdateParams.features.subscription_update` + * Change `BillingPortal.ConfigurationCreateParams.business_profile` and `Refund.next_action.display_details` to be optional + * Add support for `alma` on `Charge.payment_method_details`, `ConfirmationToken.payment_method_preview`, `ConfirmationTokenCreateParams.testHelpers.payment_method_data`, `PaymentIntent.payment_method_options`, `PaymentIntentConfirmParams.payment_method_data`, `PaymentIntentConfirmParams.payment_method_options`, `PaymentIntentCreateParams.payment_method_data`, `PaymentIntentCreateParams.payment_method_options`, `PaymentIntentUpdateParams.payment_method_data`, `PaymentIntentUpdateParams.payment_method_options`, `PaymentMethodConfigurationCreateParams`, `PaymentMethodConfigurationUpdateParams`, `PaymentMethodConfiguration`, `PaymentMethodCreateParams`, `PaymentMethod`, `Refund.destination_details`, `SetupIntentConfirmParams.payment_method_data`, `SetupIntentCreateParams.payment_method_data`, and `SetupIntentUpdateParams.payment_method_data` + * Add support for `kakao_pay` and `kr_card` on `Charge.payment_method_details`, `Checkout.Session.payment_method_options`, `Checkout.SessionCreateParams.payment_method_options`, `ConfirmationToken.payment_method_preview`, `ConfirmationTokenCreateParams.testHelpers.payment_method_data`, `Mandate.payment_method_details`, `PaymentIntent.payment_method_options`, `PaymentIntentConfirmParams.payment_method_data`, `PaymentIntentConfirmParams.payment_method_options`, `PaymentIntentCreateParams.payment_method_data`, `PaymentIntentCreateParams.payment_method_options`, `PaymentIntentUpdateParams.payment_method_data`, `PaymentIntentUpdateParams.payment_method_options`, `PaymentMethodCreateParams`, `PaymentMethod`, `SetupAttempt.payment_method_details`, `SetupIntentConfirmParams.payment_method_data`, `SetupIntentCreateParams.payment_method_data`, and `SetupIntentUpdateParams.payment_method_data` + * Add support for `naver_pay` on `Charge.payment_method_details`, `Checkout.Session.payment_method_options`, `Checkout.SessionCreateParams.payment_method_options`, `ConfirmationToken.payment_method_preview`, `ConfirmationTokenCreateParams.testHelpers.payment_method_data`, `PaymentIntent.payment_method_options`, `PaymentIntentConfirmParams.payment_method_data`, `PaymentIntentConfirmParams.payment_method_options`, `PaymentIntentCreateParams.payment_method_data`, `PaymentIntentCreateParams.payment_method_options`, `PaymentIntentUpdateParams.payment_method_data`, `PaymentIntentUpdateParams.payment_method_options`, `PaymentMethodCreateParams`, `PaymentMethodUpdateParams`, `PaymentMethod`, `SetupIntentConfirmParams.payment_method_data`, `SetupIntentCreateParams.payment_method_data`, and `SetupIntentUpdateParams.payment_method_data` + * Add support for `payco` and `samsung_pay` on `Charge.payment_method_details`, `Checkout.Session.payment_method_options`, `Checkout.SessionCreateParams.payment_method_options`, `ConfirmationToken.payment_method_preview`, `ConfirmationTokenCreateParams.testHelpers.payment_method_data`, `PaymentIntent.payment_method_options`, `PaymentIntentConfirmParams.payment_method_data`, `PaymentIntentConfirmParams.payment_method_options`, `PaymentIntentCreateParams.payment_method_data`, `PaymentIntentCreateParams.payment_method_options`, `PaymentIntentUpdateParams.payment_method_data`, `PaymentIntentUpdateParams.payment_method_options`, `PaymentMethodCreateParams`, `PaymentMethod`, `SetupIntentConfirmParams.payment_method_data`, `SetupIntentCreateParams.payment_method_data`, and `SetupIntentUpdateParams.payment_method_data` + * Add support for new values `alma`, `kakao_pay`, `kr_card`, `naver_pay`, `payco`, and `samsung_pay` on enums `Checkout.SessionCreateParams.payment_method_types[]`, `CustomerListPaymentMethodsParams.type`, `PaymentMethodCreateParams.type`, and `PaymentMethodListParams.type` + * Add support for new values `by_tin`, `ma_vat`, `md_vat`, `tz_vat`, `uz_tin`, and `uz_vat` on enums `Checkout.Session.customer_details.tax_ids[].type`, `Invoice.customer_tax_ids[].type`, `Tax.Calculation.customer_details.tax_ids[].type`, `Tax.Transaction.customer_details.tax_ids[].type`, and `TaxId.type` + * Add support for new values `alma`, `kakao_pay`, `kr_card`, `naver_pay`, `payco`, and `samsung_pay` on enums `ConfirmationTokenCreateParams.testHelpers.payment_method_data.type`, `PaymentIntentConfirmParams.payment_method_data.type`, `PaymentIntentCreateParams.payment_method_data.type`, `PaymentIntentUpdateParams.payment_method_data.type`, `SetupIntentConfirmParams.payment_method_data.type`, `SetupIntentCreateParams.payment_method_data.type`, and `SetupIntentUpdateParams.payment_method_data.type` + * Add support for new values `alma`, `kakao_pay`, `kr_card`, `naver_pay`, `payco`, and `samsung_pay` on enums `ConfirmationToken.payment_method_preview.type` and `PaymentMethod.type` + * Add support for new value `auto` on enum `CustomerUpdateParams.tax.validate_location` + * Add support for new values `by_tin`, `ma_vat`, `md_vat`, `tz_vat`, `uz_tin`, and `uz_vat` on enums `CustomerCreateParams.tax_id_data[].type`, `InvoiceCreatePreviewParams.customer_details.tax_ids[].type`, `InvoiceUpcomingLinesParams.customer_details.tax_ids[].type`, `InvoiceUpcomingParams.customer_details.tax_ids[].type`, `Tax.CalculationCreateParams.customer_details.tax_ids[].type`, and `TaxIdCreateParams.type` + * Add support for `enhanced_evidence` on `Dispute.evidence` and `DisputeUpdateParams.evidence` + * Add support for `enhanced_eligibility_types` on `Dispute` + * Add support for `enhanced_eligibility` on `Dispute.evidence_details` + * Add support for new values `issuing_transaction.purchase_details_receipt_updated` and `refund.failed` on enum `Event.type` + * Add support for `metadata` on `Forwarding.RequestCreateParams` and `Forwarding.Request` + * Add support for `automatically_finalizes_at` on `InvoiceCreateParams` and `InvoiceUpdateParams` + * Add support for new values `jp_credit_transfer`, `kakao_pay`, `kr_card`, `naver_pay`, and `payco` on enums `Invoice.payment_settings.payment_method_types[]`, `InvoiceCreateParams.payment_settings.payment_method_types[]`, `InvoiceUpdateParams.payment_settings.payment_method_types[]`, `Subscription.payment_settings.payment_method_types[]`, `SubscriptionCreateParams.payment_settings.payment_method_types[]`, and `SubscriptionUpdateParams.payment_settings.payment_method_types[]` + * Add support for new value `retail_delivery_fee` on enums `InvoiceAddLinesParams.lines[].tax_amounts[].tax_rate_data.tax_type`, `InvoiceUpdateLinesParams.lines[].tax_amounts[].tax_rate_data.tax_type`, `Tax.Calculation.shipping_cost.tax_breakdown[].tax_rate_details.tax_type`, `Tax.Calculation.tax_breakdown[].tax_rate_details.tax_type`, `Tax.CalculationLineItem.tax_breakdown[].tax_rate_details.tax_type`, `Tax.Transaction.shipping_cost.tax_breakdown[].tax_rate_details.tax_type`, `TaxRate.tax_type`, `TaxRateCreateParams.tax_type`, and `TaxRateUpdateParams.tax_type` + * Add support for new value `alma` on enums `PaymentLink.payment_method_types[]`, `PaymentLinkCreateParams.payment_method_types[]`, and `PaymentLinkUpdateParams.payment_method_types[]` + * Add support for `amazon_pay` on `PaymentMethodDomain` + * Change type of `Refund.next_action.display_details` from `RefundNextActionDisplayDetails | null` to `RefundNextActionDisplayDetails` + * Add support for `flat_amount` and `rate_type` on `Tax.Calculation.tax_breakdown[].tax_rate_details` and `TaxRate` + * Add support for `by`, `cr`, `ec`, `ma`, `md`, `rs`, `ru`, `tz`, and `uz` on `Tax.Registration.country_options` and `Tax.RegistrationCreateParams.country_options` + * Add support for new value `state_retail_delivery_fee` on enums `Tax.Registration.country_options.us.type` and `Tax.RegistrationCreateParams.country_options.us.type` + * Add support for `pln` on `Terminal.Configuration.tipping`, `Terminal.ConfigurationCreateParams.tipping`, and `Terminal.ConfigurationUpdateParams.tipping` + * Add support for new values `issuing_transaction.purchase_details_receipt_updated` and `refund.failed` on enums `WebhookEndpointCreateParams.enabled_events[]` and `WebhookEndpointUpdateParams.enabled_events[]` + * Add support for new value `2024-10-28.acacia` on enum `WebhookEndpointCreateParams.api_version` + +## 17.2.1 - 2024-10-18 +* [#2210](https://github.com/stripe/stripe-node/pull/2210) update object tags for meter-related classes + + - fixes a bug where the `object` property of the `MeterEvent`, `MeterEventAdjustment`, and `MeterEventSession` didn't match the server. +* [#2208](https://github.com/stripe/stripe-node/pull/2208) Update signature verification docs link + +## 17.2.0 - 2024-10-09 +* [#2201](https://github.com/stripe/stripe-node/pull/2201) Add fetchRelatedObject to V2 Events if needed + * `fetchRelatedObject` is added to events retrieved using `stripe.v2.core.events` and can be used to easily fetch the Stripe object related to a retrieved event + +## 17.1.0 - 2024-10-03 +* [#2199](https://github.com/stripe/stripe-node/pull/2199) Update generated code + * Remove the support for resource `Margin` that was accidentally made public in the last release + +## 17.0.0 - 2024-10-01 +* [#2192](https://github.com/stripe/stripe-node/pull/2192) Support for APIs in the new API version 2024-09-30.acacia + + This release changes the pinned API version to `2024-09-30.acacia`. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-09-30.acacia) and carefully review the API changes before upgrading. + + ### ⚠️ Breaking changes due to changes in the Stripe API + - Rename `usage_threshold_config` to `usage_threshold` on `Billing.AlertCreateParams` and `Billing.Alert` + - Remove support for `filter` on `Billing.AlertCreateParams` and `Billing.Alert`. Use the filters on the `usage_threshold` instead + - Remove support for `customer_consent_collected` on `Terminal.ReaderProcessSetupIntentParams`. + + ### ⚠️ Other Breaking changes in the SDK + - Adjusted default values around reties for HTTP requests. You can use the old defaults by setting them explicitly. New values are: + - max retries: `1` -> `2` + - max timeout (seconds): `2` -> `5` + + + ### Additions + * Add support for `custom_unit_amount` on `ProductCreateParams.default_price_data` + * Add support for `allow_redisplay` on `Terminal.ReaderProcessPaymentIntentParams.process_config` and `Terminal.ReaderProcessSetupIntentParams` + * Add support for new value `international_transaction` on enum `Treasury.ReceivedCredit.failure_code` + * Add support for new value `2024-09-30.acacia` on enum `WebhookEndpointCreateParams.api_version` + * Add support for new Usage Billing APIs `Billing.MeterEvent`, `Billing.MeterEventAdjustments`, `Billing.MeterEventSession`, `Billing.MeterEventStream` and the new Events API `Core.Events` in the [v2 namespace ](https://docs.corp.stripe.com/api-v2-overview) + * Add method `parseThinEvent()` on the `Stripe` class to parse [thin events](https://docs.corp.stripe.com/event-destinations#events-overview). + * Add method [rawRequest()](https://github.com/stripe/stripe-node/tree/master?tab=readme-ov-file#custom-requests) on the `Stripe` class that takes a HTTP method type, url and relevant parameters to make requests to the Stripe API that are not yet supported in the SDK. + + ### Changes + * Change `BillingPortal.ConfigurationCreateParams.features.subscription_update.default_allowed_updates` and `BillingPortal.ConfigurationCreateParams.features.subscription_update.products` to be optional ## 16.12.0 - 2024-09-18 * [#2177](https://github.com/stripe/stripe-node/pull/2177) Update generated code diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 5f5b311191..bf0daa66a7 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1267 \ No newline at end of file +v1412 \ No newline at end of file diff --git a/README.md b/README.md index 5adfcd7f5a..174c0d38e6 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,39 @@ const customer = await stripe.customers.create({ console.log(customer.id); ``` +> [!WARNING] +> If you're using `v17.x.x` or later and getting an error about a missing API key despite being sure it's available, it's likely you're importing the file that instantiates `Stripe` while the key isn't present (for instance, during a build step). +> If that's the case, consider instantiating the client lazily: +> +> ```ts +> import Stripe from 'stripe'; +> +> let _stripe: Stripe | null = null; +> const getStripe = (): Stripe => { +> if (!_stripe) { +> _stripe = new Stripe(process.env.STRIPE_SECRET_KEY as string, { +> // ... +> }); +> } +> return _stripe; +> }; +> +> const getCustomers = () => getStripe().customers.list(); +> ``` +> +> Alternatively, you can provide a placeholder for the real key (which will be enough to get the code through a build step): +> +> ```ts +> import Stripe from 'stripe'; +> +> export const stripe = new Stripe( +> process.env.STRIPE_SECRET_KEY || 'api_key_placeholder', +> { +> // ... +> } +> ); +> ``` + ### Usage with TypeScript As of 8.0.1, Stripe maintains types for the latest [API version][api-versions]. @@ -197,7 +230,7 @@ const stripe = Stripe('sk_test_...', { | `host` | `'api.stripe.com'` | Host that requests are made to. | | `port` | 443 | Port that requests are made to. | | `protocol` | `'https'` | `'https'` or `'http'`. `http` is never appropriate for sending requests to Stripe servers, and we strongly discourage `http`, even in local testing scenarios, as this can result in your credentials being transmitted over an insecure channel. | -| `telemetry` | `true` | Allow Stripe to send [telemetry](#telemetry). | +| `telemetry` | `true` | Allow Stripe to send [telemetry](#telemetry). | > **Note** > Both `maxNetworkRetries` and `timeout` can be overridden on a per-request basis. @@ -517,6 +550,39 @@ const stripe = new Stripe('sk_test_...', { }); ``` +### Custom requests + +If you would like to send a request to an undocumented API (for example you are in a private beta), or if you prefer to bypass the method definitions in the library and specify your request details directly, you can use the `rawRequest` method on the StripeClient object. + +```javascript +const client = new Stripe('sk_test_...'); + +client.rawRequest( + 'POST', + '/v1/beta_endpoint', + { param: 123 }, + { apiVersion: '2022-11-15; feature_beta=v3' } + ) + .then((response) => /* handle response */ ) + .catch((error) => console.error(error)); +``` + +Or using ES modules and `async`/`await`: + +```javascript +import Stripe from 'stripe'; +const stripe = new Stripe('sk_test_...'); + +const response = await stripe.rawRequest( + 'POST', + '/v1/beta_endpoint', + {param: 123}, + {apiVersion: '2022-11-15; feature_beta=v3'} +); + +// handle response +``` + ## Support New features and bug fixes are released on the latest major version of the `stripe` package. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates. diff --git a/VERSION b/VERSION index ccefa10045..6f0844e02b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -16.12.0 +17.5.0 diff --git a/examples/snippets/README.md b/examples/snippets/README.md new file mode 100644 index 0000000000..13a6732562 --- /dev/null +++ b/examples/snippets/README.md @@ -0,0 +1,27 @@ +## Setup + +1. From the stripe-node root folder, run `yarn build` to build the modules. +2. Then, from this snippets folder, run `yarn` to install node dependencies for the example snippets. This will reference the local Stripe SDK modules created in step 1. + +If on step 2 you see an error `Error: unsure how to copy this: /Users/jar/stripe/sdks/node/.git/fsmonitor--daemon.ipc`: +run `rm /path/to/node/sdk/.git/fsmonitor--daemon.ipc && yarn` +This file is used by a file monitor built into git. Removing it temporarily does not seem to affect its operation, and this one liner will let `yarn` succeed. + +Note that if you modify the stripe-node code, rerun step 1 and then run `yarn upgrade stripe` from this folder to pull in the new built package. + +## Running an example + +If your example is in typescript, run: +`yarn run ts-node your_example.ts` + +If your example is in javascript, run: +`node your_example.js` +or +`node your_example.mjs` + +## Adding a new example + +1. Clone new_example.ts +2. Implement your example +3. Run it (as per above) +4. 👍 diff --git a/examples/snippets/example_template.ts b/examples/snippets/example_template.ts new file mode 100644 index 0000000000..08c1fe65c3 --- /dev/null +++ b/examples/snippets/example_template.ts @@ -0,0 +1,21 @@ +/** + * example_template.py - This is a template for defining new examples. It is not intended to be used directly. + + * + + * In this example, we: + * - + * - + */ + +import {Stripe} from 'stripe'; + +const apiKey = '{{API_KEY}}'; + +console.log('Hello World'); +// const client = new Stripe(apiKey); +// client.v2.... diff --git a/examples/snippets/meter_event_stream.ts b/examples/snippets/meter_event_stream.ts new file mode 100644 index 0000000000..fec60cce78 --- /dev/null +++ b/examples/snippets/meter_event_stream.ts @@ -0,0 +1,51 @@ +/** + * meter_event_stream.ts - Use the high-throughput meter event stream to report create billing meter events. + * + * In this example, we: + * - create a meter event session and store the session's authentication token + * - define an event with a payload + * - use the meterEventStream service to create an event stream that reports this event + * + * This example expects a billing meter with an event_name of 'alpaca_ai_tokens'. If you have + * a different meter event name, you can change it before running this example. + */ + +import {Stripe} from 'stripe'; + +const apiKey = '{{API_KEY}}'; +const customerId = '{{CUSTOMER_ID}}'; + +let meterEventSession: null | any = null; + +async function refreshMeterEventSession() { + if ( + meterEventSession === null || + new Date(meterEventSession.expires_at * 1000) <= new Date() + ) { + // Create a new meter event session in case the existing session expired + const client = new Stripe(apiKey); + meterEventSession = await client.v2.billing.meterEventSession.create(); + } +} + +async function sendMeterEvent(meterEvent: any) { + // Refresh the meter event session, if necessary + await refreshMeterEventSession(); + + // Create a meter event + const client = new Stripe(meterEventSession.authentication_token); + await client.v2.billing.meterEventStream.create({ + events: [meterEvent], + }); +} + +// Send meter events +sendMeterEvent({ + event_name: 'alpaca_ai_tokens', + payload: { + stripe_customer_id: customerId, // Replace with actual customer ID + value: '27', + }, +}).catch((error) => { + console.error('Error sending meter event:', error); +}); diff --git a/examples/snippets/package.json b/examples/snippets/package.json new file mode 100644 index 0000000000..386c40adb4 --- /dev/null +++ b/examples/snippets/package.json @@ -0,0 +1,13 @@ +{ + "name": "snippets", + "version": "1.0.0", + "description": "example Stripe SDK code snippets", + "main": "index.js", + "license": "ISC", + "dependencies": { + "express": "^4.21.0", + "stripe": "file:../..", + "ts-node": "^10.9.2", + "typescript": "^5.6.2" + } +} diff --git a/examples/snippets/thinevent_webhook_handler.js b/examples/snippets/thinevent_webhook_handler.js new file mode 100644 index 0000000000..86c56f1b66 --- /dev/null +++ b/examples/snippets/thinevent_webhook_handler.js @@ -0,0 +1,50 @@ +/** + * thinevent_webhook_handler.js - receive and process thin events like the + * v1.billing.meter.error_report_triggered event. + * In this example, we: + * - create a Stripe client object called client + * - use client.parseThinEvent to parse the received thin event webhook body + * - call client.v2.core.events.retrieve to retrieve the full event object + * - if it is a v1.billing.meter.error_report_triggered event type, call + * event.fetchRelatedObject to retrieve the Billing Meter object associated + * with the event. + */ + +const express = require('express'); +const {Stripe} = require('stripe'); + +const app = express(); + +const apiKey = process.env.STRIPE_API_KEY; +const webhookSecret = process.env.WEBHOOK_SECRET; + +const client = new Stripe(apiKey); + +app.post( + '/webhook', + express.raw({type: 'application/json'}), + async (req, res) => { + const sig = req.headers['stripe-signature']; + + try { + const thinEvent = client.parseThinEvent(req.body, sig, webhookSecret); + + // Fetch the event data to understand the failure + const event = await client.v2.core.events.retrieve(thinEvent.id); + if (event.type == 'v1.billing.meter.error_report_triggered') { + const meter = await event.fetchRelatedObject(); + const meterId = meter.id; + console.log(`Success! ${meterId}`); + + // Record the failures and alert your team + // Add your logic here + } + res.sendStatus(200); + } catch (err) { + console.log(`Webhook Error: ${err.stack}`); + res.status(400).send(`Webhook Error: ${err.message}`); + } + } +); + +app.listen(4242, () => console.log('Running on port 4242')); diff --git a/examples/snippets/yarn.lock b/examples/snippets/yarn.lock new file mode 100644 index 0000000000..31868864fa --- /dev/null +++ b/examples/snippets/yarn.lock @@ -0,0 +1,597 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== + dependencies: + "@jridgewell/trace-mapping" "0.3.9" + +"@jridgewell/resolve-uri@^3.0.3": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== + +"@jridgewell/sourcemap-codec@^1.4.10": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== + +"@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + +"@tsconfig/node10@^1.0.7": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.11.tgz#6ee46400685f130e278128c7b38b7e031ff5b2f2" + integrity sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw== + +"@tsconfig/node12@^1.0.7": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== + +"@tsconfig/node14@^1.0.0": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== + +"@tsconfig/node16@^1.0.2": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" + integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== + +"@types/node@>=8.1.0": + version "22.7.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.5.tgz#cfde981727a7ab3611a481510b473ae54442b92b" + integrity sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ== + dependencies: + undici-types "~6.19.2" + +accepts@~1.3.8: + version "1.3.8" + resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" + integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== + dependencies: + mime-types "~2.1.34" + negotiator "0.6.3" + +acorn-walk@^8.1.1: + version "8.3.4" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" + integrity sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g== + dependencies: + acorn "^8.11.0" + +acorn@^8.11.0, acorn@^8.4.1: + version "8.12.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" + integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== + +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + +array-flatten@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" + integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== + +body-parser@1.20.3: + version "1.20.3" + resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.20.3.tgz#1953431221c6fb5cd63c4b36d53fab0928e548c6" + integrity sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g== + dependencies: + bytes "3.1.2" + content-type "~1.0.5" + debug "2.6.9" + depd "2.0.0" + destroy "1.2.0" + http-errors "2.0.0" + iconv-lite "0.4.24" + on-finished "2.4.1" + qs "6.13.0" + raw-body "2.5.2" + type-is "~1.6.18" + unpipe "1.0.0" + +bytes@3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" + integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== + +call-bind@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" + integrity sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + set-function-length "^1.2.1" + +content-disposition@0.5.4: + version "0.5.4" + resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" + integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== + dependencies: + safe-buffer "5.2.1" + +content-type@~1.0.4, content-type@~1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" + integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== + +cookie-signature@1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" + integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== + +cookie@0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051" + integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw== + +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + +debug@2.6.9: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +define-data-property@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" + integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + gopd "^1.0.1" + +depd@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" + integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== + +destroy@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" + integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== + +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + +ee-first@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" + integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== + +encodeurl@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" + integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== + +encodeurl@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-2.0.0.tgz#7b8ea898077d7e409d3ac45474ea38eaf0857a58" + integrity sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg== + +es-define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.0.tgz#c7faefbdff8b2696cf5f46921edfb77cc4ba3845" + integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ== + dependencies: + get-intrinsic "^1.2.4" + +es-errors@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" + integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== + +escape-html@~1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" + integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== + +etag@~1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" + integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== + +express@^4.21.0: + version "4.21.0" + resolved "https://registry.yarnpkg.com/express/-/express-4.21.0.tgz#d57cb706d49623d4ac27833f1cbc466b668eb915" + integrity sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng== + dependencies: + accepts "~1.3.8" + array-flatten "1.1.1" + body-parser "1.20.3" + content-disposition "0.5.4" + content-type "~1.0.4" + cookie "0.6.0" + cookie-signature "1.0.6" + debug "2.6.9" + depd "2.0.0" + encodeurl "~2.0.0" + escape-html "~1.0.3" + etag "~1.8.1" + finalhandler "1.3.1" + fresh "0.5.2" + http-errors "2.0.0" + merge-descriptors "1.0.3" + methods "~1.1.2" + on-finished "2.4.1" + parseurl "~1.3.3" + path-to-regexp "0.1.10" + proxy-addr "~2.0.7" + qs "6.13.0" + range-parser "~1.2.1" + safe-buffer "5.2.1" + send "0.19.0" + serve-static "1.16.2" + setprototypeof "1.2.0" + statuses "2.0.1" + type-is "~1.6.18" + utils-merge "1.0.1" + vary "~1.1.2" + +finalhandler@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.3.1.tgz#0c575f1d1d324ddd1da35ad7ece3df7d19088019" + integrity sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ== + dependencies: + debug "2.6.9" + encodeurl "~2.0.0" + escape-html "~1.0.3" + on-finished "2.4.1" + parseurl "~1.3.3" + statuses "2.0.1" + unpipe "~1.0.0" + +forwarded@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" + integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== + +fresh@0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" + integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== + +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + +get-intrinsic@^1.1.3, get-intrinsic@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd" + integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ== + dependencies: + es-errors "^1.3.0" + function-bind "^1.1.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" + +has-property-descriptors@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854" + integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg== + dependencies: + es-define-property "^1.0.0" + +has-proto@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.3.tgz#b31ddfe9b0e6e9914536a6ab286426d0214f77fd" + integrity sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q== + +has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== + +hasown@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== + dependencies: + function-bind "^1.1.2" + +http-errors@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" + integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== + dependencies: + depd "2.0.0" + inherits "2.0.4" + setprototypeof "1.2.0" + statuses "2.0.1" + toidentifier "1.0.1" + +iconv-lite@0.4.24: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +inherits@2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +ipaddr.js@1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" + integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== + +make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + +media-typer@0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" + integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== + +merge-descriptors@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.3.tgz#d80319a65f3c7935351e5cfdac8f9318504dbed5" + integrity sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ== + +methods@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" + integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== + +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@~2.1.24, mime-types@~2.1.34: + version "2.1.35" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + +mime@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" + integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== + +ms@2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +negotiator@0.6.3: + version "0.6.3" + resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" + integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== + +object-inspect@^1.13.1: + version "1.13.2" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.2.tgz#dea0088467fb991e67af4058147a24824a3043ff" + integrity sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g== + +on-finished@2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" + integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== + dependencies: + ee-first "1.1.1" + +parseurl@~1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" + integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== + +path-to-regexp@0.1.10: + version "0.1.10" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.10.tgz#67e9108c5c0551b9e5326064387de4763c4d5f8b" + integrity sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w== + +proxy-addr@~2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" + integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== + dependencies: + forwarded "0.2.0" + ipaddr.js "1.9.1" + +qs@6.13.0, qs@^6.11.0: + version "6.13.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.13.0.tgz#6ca3bd58439f7e245655798997787b0d88a51906" + integrity sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg== + dependencies: + side-channel "^1.0.6" + +range-parser@~1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" + integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== + +raw-body@2.5.2: + version "2.5.2" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" + integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== + dependencies: + bytes "3.1.2" + http-errors "2.0.0" + iconv-lite "0.4.24" + unpipe "1.0.0" + +safe-buffer@5.2.1: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +"safer-buffer@>= 2.1.2 < 3": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +send@0.19.0: + version "0.19.0" + resolved "https://registry.yarnpkg.com/send/-/send-0.19.0.tgz#bbc5a388c8ea6c048967049dbeac0e4a3f09d7f8" + integrity sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw== + dependencies: + debug "2.6.9" + depd "2.0.0" + destroy "1.2.0" + encodeurl "~1.0.2" + escape-html "~1.0.3" + etag "~1.8.1" + fresh "0.5.2" + http-errors "2.0.0" + mime "1.6.0" + ms "2.1.3" + on-finished "2.4.1" + range-parser "~1.2.1" + statuses "2.0.1" + +serve-static@1.16.2: + version "1.16.2" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.16.2.tgz#b6a5343da47f6bdd2673848bf45754941e803296" + integrity sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw== + dependencies: + encodeurl "~2.0.0" + escape-html "~1.0.3" + parseurl "~1.3.3" + send "0.19.0" + +set-function-length@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" + integrity sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg== + dependencies: + define-data-property "^1.1.4" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + gopd "^1.0.1" + has-property-descriptors "^1.0.2" + +setprototypeof@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" + integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== + +side-channel@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.6.tgz#abd25fb7cd24baf45466406b1096b7831c9215f2" + integrity sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA== + dependencies: + call-bind "^1.0.7" + es-errors "^1.3.0" + get-intrinsic "^1.2.4" + object-inspect "^1.13.1" + +statuses@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" + integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== + +"stripe@file:../..": + version "17.0.0" + dependencies: + "@types/node" ">=8.1.0" + qs "^6.11.0" + +toidentifier@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" + integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== + +ts-node@^10.9.2: + version "10.9.2" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f" + integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + +type-is@~1.6.18: + version "1.6.18" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" + integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== + dependencies: + media-typer "0.3.0" + mime-types "~2.1.24" + +typescript@^5.6.2: + version "5.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.2.tgz#d1de67b6bef77c41823f822df8f0b3bcff60a5a0" + integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== + +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== + +unpipe@1.0.0, unpipe@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" + integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== + +utils-merge@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" + integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== + +v8-compile-cache-lib@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" + integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== + +vary@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" + integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== + +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== diff --git a/package.json b/package.json index 448455dbc2..a527bf6426 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stripe", - "version": "16.12.0", + "version": "17.5.0", "description": "Stripe API wrapper", "keywords": [ "stripe", diff --git a/scripts/updateAPIVersion.js b/scripts/updateAPIVersion.js index f70683852e..20eeb9780c 100755 --- a/scripts/updateAPIVersion.js +++ b/scripts/updateAPIVersion.js @@ -8,7 +8,7 @@ const read = (file) => fs.readFileSync(path.resolve(file)).toString(); const write = (file, str) => fs.writeFileSync(path.resolve(file), str); const edit = (file, cb) => write(file, cb(read(file))); -const API_VERSION = '2[0-9][2-9][0-9]-[0-9]{2}-[0-9]{2}'; +const API_VERSION = '2[0-9][2-9][0-9]-[0-9]{2}-[0-9]{2}.[a-z]+'; const main = () => { const matches = [ @@ -36,9 +36,6 @@ const main = () => { ); }); - replaceAPIVersion('README.md', 'apiVersion: [\'"]API_VERSION[\'"]'); - replaceAPIVersion('package.json', '"types": "types/API_VERSION/index.d.ts'); - replaceAPIVersion( 'types/lib.d.ts', 'export type LatestApiVersion = [\'"]API_VERSION[\'"]' diff --git a/src/Error.ts b/src/Error.ts index aa094c0952..bfe2aee00a 100644 --- a/src/Error.ts +++ b/src/Error.ts @@ -1,8 +1,11 @@ /* eslint-disable camelcase */ +/* eslint-disable no-warning-comments */ import {RawErrorType, StripeRawError} from './Types.js'; -export const generate = (rawStripeError: StripeRawError): StripeError => { +export const generateV1Error = ( + rawStripeError: StripeRawError +): StripeError => { switch (rawStripeError.type) { case 'card_error': return new StripeCardError(rawStripeError); @@ -23,12 +26,34 @@ export const generate = (rawStripeError: StripeRawError): StripeError => { } }; +// eslint-disable-next-line complexity +export const generateV2Error = ( + rawStripeError: StripeRawError +): StripeError => { + switch (rawStripeError.type) { + // switchCases: The beginning of the section generated from our OpenAPI spec + case 'temporary_session_expired': + return new TemporarySessionExpiredError(rawStripeError); + // switchCases: The end of the section generated from our OpenAPI spec + } + + // Special handling for requests with missing required fields in V2 APIs. + // invalid_field response in V2 APIs returns the field 'code' instead of 'type'. + switch (rawStripeError.code) { + case 'invalid_fields': + return new StripeInvalidRequestError(rawStripeError); + } + + return generateV1Error(rawStripeError); +}; + /** * StripeError is the base error from which all other more specific Stripe errors derive. * Specifically for errors returned from Stripe's REST API. */ export class StripeError extends Error { readonly message: string; + readonly userMessage?: string; readonly type: string; readonly raw: unknown; readonly rawType?: RawErrorType; @@ -64,7 +89,7 @@ export class StripeError extends Error { this.statusCode = raw.statusCode; // @ts-ignore this.message = raw.message; - + this.userMessage = raw.user_message; this.charge = raw.charge; this.decline_code = raw.decline_code; this.payment_intent = raw.payment_intent; @@ -77,7 +102,7 @@ export class StripeError extends Error { /** * Helper factory which takes raw stripe errors and outputs wrapping instances */ - static generate = generate; + static generate = generateV1Error; } // Specific Stripe Error types: @@ -205,3 +230,11 @@ export class StripeUnknownError extends StripeError { super(raw, 'StripeUnknownError'); } } + +// classDefinitions: The beginning of the section generated from our OpenAPI spec +export class TemporarySessionExpiredError extends StripeError { + constructor(rawStripeError: StripeRawError = {}) { + super(rawStripeError, 'TemporarySessionExpiredError'); + } +} +// classDefinitions: The end of the section generated from our OpenAPI spec diff --git a/src/RequestSender.ts b/src/RequestSender.ts index d69c3c0b87..59bbaf5d2b 100644 --- a/src/RequestSender.ts +++ b/src/RequestSender.ts @@ -5,14 +5,9 @@ import { StripeError, StripePermissionError, StripeRateLimitError, + generateV1Error, + generateV2Error, } from './Error.js'; -import { - emitWarning, - normalizeHeaders, - removeNullish, - stringifyRequestData, -} from './utils.js'; -import {HttpClient, HttpClientResponseInterface} from './net/HttpClient.js'; import { StripeObject, RequestHeaders, @@ -20,11 +15,27 @@ import { ResponseEvent, RequestCallback, RequestCallbackReturn, - RequestSettings, RequestData, - RequestOptions, RequestDataProcessor, + RequestOptions, + RequestSettings, + StripeRequest, + RequestOpts, + RequestArgs, + RequestAuthenticator, + ApiMode, } from './Types.js'; +import {HttpClient, HttpClientResponseInterface} from './net/HttpClient.js'; +import { + emitWarning, + jsonStringifyRequestData, + normalizeHeaders, + queryStringifyRequestData, + removeNullish, + getAPIMode, + getOptionsFromArgs, + getDataFromArgs, +} from './utils.js'; export type HttpClientResponseError = {code: string}; @@ -126,6 +137,7 @@ export class RequestSender { */ _jsonResponseHandler( requestEvent: RequestEvent, + apiMode: 'v1' | 'v2', usage: Array, callback: RequestCallback ) { @@ -167,8 +179,10 @@ export class RequestSender { err = new StripePermissionError(jsonResponse.error); } else if (statusCode === 429) { err = new StripeRateLimitError(jsonResponse.error); + } else if (apiMode === 'v2') { + err = generateV2Error(jsonResponse.error); } else { - err = StripeError.generate(jsonResponse.error); + err = generateV1Error(jsonResponse.error); } throw err; @@ -272,7 +286,7 @@ export class RequestSender { // number of numRetries so far as inputs. Do not allow the number to exceed // maxNetworkRetryDelay. let sleepSeconds = Math.min( - initialNetworkRetryDelay * Math.pow(numRetries - 1, 2), + initialNetworkRetryDelay * Math.pow(2, numRetries - 1), maxNetworkRetryDelay ); @@ -301,39 +315,65 @@ export class RequestSender { _defaultIdempotencyKey( method: string, - settings: RequestSettings + settings: RequestSettings, + apiMode: ApiMode ): string | null { // If this is a POST and we allow multiple retries, ensure an idempotency key. const maxRetries = this._getMaxNetworkRetries(settings); - if (method === 'POST' && maxRetries > 0) { - return `stripe-node-retry-${this._stripe._platformFunctions.uuid4()}`; + const genKey = (): string => + `stripe-node-retry-${this._stripe._platformFunctions.uuid4()}`; + + // more verbose than it needs to be, but gives clear separation between V1 and V2 behavior + if (apiMode === 'v2') { + if (method === 'POST' || method === 'DELETE') { + return genKey(); + } + } else if (apiMode === 'v1') { + if (method === 'POST' && maxRetries > 0) { + return genKey(); + } } + return null; } - _makeHeaders( - auth: string | null, - contentLength: number, - apiVersion: string, - clientUserAgent: string, - method: string, - userSuppliedHeaders: RequestHeaders | null, - userSuppliedSettings: RequestSettings - ): RequestHeaders { + _makeHeaders({ + contentType, + contentLength, + apiVersion, + clientUserAgent, + method, + userSuppliedHeaders, + userSuppliedSettings, + stripeAccount, + stripeContext, + apiMode, + }: { + contentType: string; + contentLength: number; + apiVersion: string | null; + clientUserAgent: string; + method: string; + userSuppliedHeaders: RequestHeaders | null; + userSuppliedSettings: RequestSettings; + stripeAccount: string | null; + stripeContext: string | null; + apiMode: ApiMode; + }): RequestHeaders { const defaultHeaders = { - // Use specified auth token or use default from this stripe instance: - Authorization: auth ? `Bearer ${auth}` : this._stripe.getApiField('auth'), Accept: 'application/json', - 'Content-Type': 'application/x-www-form-urlencoded', - 'User-Agent': this._getUserAgentString(), + 'Content-Type': contentType, + 'User-Agent': this._getUserAgentString(apiMode), 'X-Stripe-Client-User-Agent': clientUserAgent, 'X-Stripe-Client-Telemetry': this._getTelemetryHeader(), 'Stripe-Version': apiVersion, - 'Stripe-Account': this._stripe.getApiField('stripeAccount'), + 'Stripe-Account': stripeAccount, + 'Stripe-Context': stripeContext, 'Idempotency-Key': this._defaultIdempotencyKey( method, - userSuppliedSettings + userSuppliedSettings, + apiMode ), } as RequestHeaders; @@ -372,13 +412,13 @@ export class RequestSender { ); } - _getUserAgentString(): string { + _getUserAgentString(apiMode: string): string { const packageVersion = this._stripe.getConstant('PACKAGE_VERSION'); const appInfo = this._stripe._appInfo ? this._stripe.getAppInfoAsString() : ''; - return `Stripe/v1 NodeBindings/${packageVersion} ${appInfo}`.trim(); + return `Stripe/${apiMode} NodeBindings/${packageVersion} ${appInfo}`.trim(); } _getTelemetryHeader(): string | undefined { @@ -422,19 +462,96 @@ export class RequestSender { } } + _rawRequest( + method: string, + path: string, + params?: RequestData, + options?: RequestOptions + ): Promise { + const requestPromise = new Promise((resolve, reject) => { + let opts: RequestOpts; + try { + const requestMethod = method.toUpperCase(); + if ( + requestMethod !== 'POST' && + params && + Object.keys(params).length !== 0 + ) { + throw new Error( + 'rawRequest only supports params on POST requests. Please pass null and add your parameters to path.' + ); + } + const args: RequestArgs = [].slice.call([params, options]); + + // Pull request data and options (headers, auth) from args. + const dataFromArgs = getDataFromArgs(args); + const data = Object.assign({}, dataFromArgs); + const calculatedOptions = getOptionsFromArgs(args); + + const headers = calculatedOptions.headers; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const authenticator: RequestAuthenticator = calculatedOptions.authenticator!; + opts = { + requestMethod, + requestPath: path, + bodyData: data, + queryData: {}, + authenticator, + headers, + host: null, + streaming: false, + settings: {}, + usage: ['raw_request'], + }; + } catch (err) { + reject(err); + return; + } + + function requestCallback( + err: any, + response: HttpClientResponseInterface + ): void { + if (err) { + reject(err); + } else { + resolve(response); + } + } + + const {headers, settings} = opts; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const authenticator: RequestAuthenticator = opts.authenticator!; + + this._request( + opts.requestMethod, + opts.host, + path, + opts.bodyData, + authenticator, + {headers, settings, streaming: opts.streaming}, + opts.usage, + requestCallback + ); + }); + + return requestPromise; + } + _request( method: string, host: string | null, path: string, - data: RequestData, - auth: string | null, - options: RequestOptions = {}, + data: RequestData | null, + authenticator: RequestAuthenticator, + options: RequestOptions, usage: Array = [], callback: RequestCallback, requestDataProcessor: RequestDataProcessor | null = null ): void { let requestData: string; - + authenticator = authenticator ?? this._stripe._authenticator ?? null; + const apiMode: ApiMode = getAPIMode(path); const retryRequest = ( requestFn: typeof makeRequest, apiVersion: string, @@ -465,88 +582,113 @@ export class RequestSender { ? options.settings.timeout : this._stripe.getApiField('timeout'); - const req = this._stripe - .getApiField('httpClient') - .makeRequest( - host || this._stripe.getApiField('host'), - this._stripe.getApiField('port'), - path, - method, - headers, - requestData, - this._stripe.getApiField('protocol'), - timeout - ); - - const requestStartTime = Date.now(); - - // @ts-ignore - const requestEvent: RequestEvent = removeNullish({ - api_version: apiVersion, - account: headers['Stripe-Account'], - idempotency_key: headers['Idempotency-Key'], - method, - path, - request_start_time: requestStartTime, - }); + const request = { + host: host || this._stripe.getApiField('host'), + port: this._stripe.getApiField('port'), + path: path, + method: method, + headers: Object.assign({}, headers), + body: requestData, + protocol: this._stripe.getApiField('protocol'), + }; - const requestRetries = numRetries || 0; - - const maxRetries = this._getMaxNetworkRetries(options.settings || {}); - this._stripe._emitter.emit('request', requestEvent); - - req - .then((res: HttpClientResponseInterface) => { - if (RequestSender._shouldRetry(res, requestRetries, maxRetries)) { - return retryRequest( - makeRequest, - apiVersion, - headers, - requestRetries, - // @ts-ignore - res.getHeaders()['retry-after'] + authenticator(request) + .then(() => { + const req = this._stripe + .getApiField('httpClient') + .makeRequest( + request.host, + request.port, + request.path, + request.method, + request.headers, + request.body, + request.protocol, + timeout ); - } else if (options.streaming && res.getStatusCode() < 400) { - return this._streamingResponseHandler( - requestEvent, - usage, - callback - )(res); - } else { - return this._jsonResponseHandler( - requestEvent, - usage, - callback - )(res); - } + + const requestStartTime = Date.now(); + + // @ts-ignore + const requestEvent: RequestEvent = removeNullish({ + api_version: apiVersion, + account: headers['Stripe-Account'], + idempotency_key: headers['Idempotency-Key'], + method, + path, + request_start_time: requestStartTime, + }); + + const requestRetries = numRetries || 0; + + const maxRetries = this._getMaxNetworkRetries(options.settings || {}); + this._stripe._emitter.emit('request', requestEvent); + + req + .then((res: HttpClientResponseInterface) => { + if (RequestSender._shouldRetry(res, requestRetries, maxRetries)) { + return retryRequest( + makeRequest, + apiVersion, + headers, + requestRetries, + // @ts-ignore + res.getHeaders()['retry-after'] + ); + } else if (options.streaming && res.getStatusCode() < 400) { + return this._streamingResponseHandler( + requestEvent, + usage, + callback + )(res); + } else { + return this._jsonResponseHandler( + requestEvent, + apiMode, + usage, + callback + )(res); + } + }) + .catch((error: HttpClientResponseError) => { + if ( + RequestSender._shouldRetry( + null, + requestRetries, + maxRetries, + error + ) + ) { + return retryRequest( + makeRequest, + apiVersion, + headers, + requestRetries, + null + ); + } else { + const isTimeoutError = + error.code && error.code === HttpClient.TIMEOUT_ERROR_CODE; + + return callback( + new StripeConnectionError({ + message: isTimeoutError + ? `Request aborted due to timeout being reached (${timeout}ms)` + : RequestSender._generateConnectionErrorMessage( + requestRetries + ), + // @ts-ignore + detail: error, + }) + ); + } + }); }) - .catch((error: HttpClientResponseError) => { - if ( - RequestSender._shouldRetry(null, requestRetries, maxRetries, error) - ) { - return retryRequest( - makeRequest, - apiVersion, - headers, - requestRetries, - null - ); - } else { - const isTimeoutError = - error.code && error.code === HttpClient.TIMEOUT_ERROR_CODE; - - return callback( - new StripeConnectionError({ - message: isTimeoutError - ? `Request aborted due to timeout being reached (${timeout}ms)` - : RequestSender._generateConnectionErrorMessage( - requestRetries - ), - // @ts-ignore - detail: error, - }) - ); - } + .catch((e: any) => { + throw new StripeError({ + message: 'Unable to authenticate the request', + exception: e, + }); }); }; @@ -559,15 +701,23 @@ export class RequestSender { this._stripe.getClientUserAgent((clientUserAgent: string) => { const apiVersion = this._stripe.getApiField('version'); - const headers = this._makeHeaders( - auth, - requestData.length, - apiVersion, + const headers = this._makeHeaders({ + contentType: + apiMode == 'v2' + ? 'application/json' + : 'application/x-www-form-urlencoded', + contentLength: requestData.length, + apiVersion: apiVersion, clientUserAgent, method, - options.headers ?? null, - options.settings ?? {} - ); + userSuppliedHeaders: options.headers, + userSuppliedSettings: options.settings, + stripeAccount: + apiMode == 'v2' ? null : this._stripe.getApiField('stripeAccount'), + stripeContext: + apiMode == 'v2' ? this._stripe.getApiField('stripeContext') : null, + apiMode: apiMode, + }); makeRequest(apiVersion, headers, 0); }); @@ -581,7 +731,15 @@ export class RequestSender { prepareAndMakeRequest ); } else { - prepareAndMakeRequest(null, stringifyRequestData(data || {})); + let stringifiedData: string; + + if (apiMode == 'v2') { + stringifiedData = data ? jsonStringifyRequestData(data) : ''; + } else { + stringifiedData = queryStringifyRequestData(data || {}, apiMode); + } + + prepareAndMakeRequest(null, stringifiedData); } } } diff --git a/src/StripeResource.ts b/src/StripeResource.ts index 59dc3fbe77..12da1fa007 100644 --- a/src/StripeResource.ts +++ b/src/StripeResource.ts @@ -3,7 +3,8 @@ import { getOptionsFromArgs, makeURLInterpolator, protoExtend, - stringifyRequestData, + queryStringifyRequestData, + getAPIMode, } from './utils.js'; import {stripeMethod} from './StripeMethod.js'; import { @@ -186,7 +187,7 @@ StripeResource.prototype = { requestPath, bodyData, queryData, - auth: options.auth, + authenticator: options.authenticator ?? null, headers, host: host ?? null, streaming, @@ -228,7 +229,7 @@ StripeResource.prototype = { const path = [ opts.requestPath, emptyQuery ? '' : '?', - stringifyRequestData(opts.queryData), + queryStringifyRequestData(opts.queryData, getAPIMode(opts.requestPath)), ].join(''); const {headers, settings} = opts; @@ -238,8 +239,12 @@ StripeResource.prototype = { opts.host, path, opts.bodyData, - opts.auth, - {headers, settings, streaming: opts.streaming}, + opts.authenticator, + { + headers, + settings, + streaming: opts.streaming, + }, opts.usage, requestCallback, this.requestDataProcessor?.bind(this) diff --git a/src/Types.d.ts b/src/Types.d.ts index 6bb97a4ff1..48f0ba9d85 100644 --- a/src/Types.d.ts +++ b/src/Types.d.ts @@ -7,6 +7,7 @@ import { import {PlatformFunctions} from './platform/PlatformFunctions.js'; export type AppInfo = {name?: string} & Record; +export type ApiMode = 'v1' | 'v2'; export type BufferedFile = { name: string; type: string; @@ -27,6 +28,7 @@ export type MethodSpec = { usage?: Array; }; export type MultipartRequestData = RequestData | StreamingFile | BufferedFile; +// rawErrorTypeEnum: The beginning of the section generated from our OpenAPI spec export type RawErrorType = | 'card_error' | 'invalid_request_error' @@ -34,8 +36,20 @@ export type RawErrorType = | 'idempotency_error' | 'rate_limit_error' | 'authentication_error' - | 'invalid_grant'; + | 'invalid_grant' + | 'temporary_session_expired'; +// rawErrorTypeEnum: The end of the section generated from our OpenAPI spec export type RequestArgs = Array; +export type StripeRequest = { + host: string; + port: string; + path: string; + method: string; + headers: RequestHeaders; + body: string; + protocol: string; +}; +export type RequestAuthenticator = (request: StripeRequest) => Promise; export type RequestCallback = ( this: void, error: Error | null, @@ -54,16 +68,16 @@ export type RequestEvent = { }; export type RequestHeaders = Record; export type RequestOptions = { - settings?: RequestSettings; - streaming?: boolean; - headers?: RequestHeaders; + settings: RequestSettings; + streaming: boolean; + headers: RequestHeaders; }; export type RequestOpts = { + authenticator: RequestAuthenticator | null; requestMethod: string; requestPath: string; bodyData: RequestData | null; queryData: RequestData; - auth: string | null; headers: RequestHeaders; host: string | null; streaming: boolean; @@ -124,13 +138,11 @@ export type StripeObject = { webhooks: any; _prepResources: () => void; _setAppInfo: (appInfo: AppInfo) => void; - _setApiKey: (apiKey: string) => void; _prevRequestMetrics: Array<{ request_id: string; request_duration_ms: number; }>; _api: { - auth: string | null; host: string; port: string | number; protocol: string; @@ -139,24 +151,42 @@ export type StripeObject = { timeout: number; maxNetworkRetries: number; agent: string; - httpClient: any; + httpClient: HttpClientInterface; dev: boolean; stripeAccount: string | null; + stripeContext: string | null; }; + _authenticator?: RequestAuthenticator; _emitter: EventEmitter; _enableTelemetry: boolean; _requestSender: RequestSender; _getPropsFromConfig: (config: Record) => UserProvidedConfig; _clientId?: string; _platformFunctions: PlatformFunctions; + _setAuthenticator: ( + key: string, + authenticator: RequestAuthenticator | undefined + ) => void; + rawRequest: ( + method: string, + path: string, + data: RequestData, + options: RequestOptions + ) => Promise; }; export type RequestSender = { + _rawRequest( + method: string, + path: string, + params?: RequestData, + options?: RequestOptions + ): Promise; _request( method: string, host: string | null, path: string, data: RequestData | null, - auth: string | null, + authenticator: RequestAuthenticator | null, options: RequestOptions, usage: Array, callback: RequestCallback, @@ -165,6 +195,7 @@ export type RequestSender = { }; export type StripeRawError = { message?: string; + user_message?: string; type?: RawErrorType; headers?: {[header: string]: string}; statusCode?: number; @@ -211,12 +242,13 @@ export type StripeResourceObject = { }; export type RequestDataProcessor = ( method: string, - data: RequestData, + data: RequestData | null, headers: RequestHeaders | undefined, prepareAndMakeRequest: (error: Error | null, data: string) => void ) => void; export type UrlInterpolator = (params: Record) => string; export type UserProvidedConfig = { + authenticator?: RequestAuthenticator; apiVersion?: string; protocol?: string; host?: string; @@ -226,6 +258,7 @@ export type UserProvidedConfig = { maxNetworkRetries?: number; httpClient?: HttpClientInterface; stripeAccount?: string; + stripeContext?: string; typescript?: boolean; telemetry?: boolean; appInfo?: AppInfo; diff --git a/src/Webhooks.ts b/src/Webhooks.ts index fc3dec8907..7e31f23698 100644 --- a/src/Webhooks.ts +++ b/src/Webhooks.ts @@ -25,7 +25,7 @@ type WebhookTestHeaderOptions = { cryptoProvider: CryptoProvider; }; -type WebhookEvent = Record; +export type WebhookEvent = Record; type WebhookPayload = string | Uint8Array; type WebhookSignatureObject = { verifyHeader: ( @@ -358,7 +358,7 @@ export function createWebhooks( const docsLocation = '\nLearn more about webhook signing and explore webhook integration examples for various frameworks at ' + - 'https://github.com/stripe/stripe-node#webhook-signing'; + 'https://docs.stripe.com/webhooks/signature'; const whitespaceMessage = secretContainsWhitespace ? '\n\nNote: The provided signing secret contains whitespace. This often indicates an extra newline or space is in the value' diff --git a/src/apiVersion.ts b/src/apiVersion.ts index 1966b582c5..f65da0438b 100644 --- a/src/apiVersion.ts +++ b/src/apiVersion.ts @@ -1,3 +1,3 @@ // File generated from our OpenAPI spec -export const ApiVersion = '2024-06-20'; +export const ApiVersion = '2024-12-18.acacia'; diff --git a/src/autoPagination.ts b/src/autoPagination.ts index 19cb4a8984..c8e3704c86 100644 --- a/src/autoPagination.ts +++ b/src/autoPagination.ts @@ -1,5 +1,9 @@ import {MethodSpec, RequestArgs, StripeResourceObject} from './Types.js'; -import {callbackifyPromiseWithTimeout, getDataFromArgs} from './utils.js'; +import { + callbackifyPromiseWithTimeout, + getDataFromArgs, + getAPIMode, +} from './utils.js'; type PromiseCache = { currentPromise: Promise | undefined | null; @@ -31,9 +35,10 @@ type AutoPaginationMethods = { type PageResult = { data: Array; has_more: boolean; - next_page: string | null; + next_page?: string | null; + next_page_url?: string | null; }; -class StripeIterator implements AsyncIterator { +class V1Iterator implements AsyncIterator { private index: number; private pagePromise: Promise>; private promiseCache: PromiseCache; @@ -117,7 +122,7 @@ class StripeIterator implements AsyncIterator { } } -class ListIterator extends StripeIterator { +class V1ListIterator extends V1Iterator { getNextPage(pageResult: PageResult): Promise> { const reverseIteration = isReverseIteration(this.requestArgs); const lastId = getLastId(pageResult, reverseIteration); @@ -127,7 +132,7 @@ class ListIterator extends StripeIterator { } } -class SearchIterator extends StripeIterator { +class V1SearchIterator extends V1Iterator { getNextPage(pageResult: PageResult): Promise> { if (!pageResult.next_page) { throw Error( @@ -140,6 +145,56 @@ class SearchIterator extends StripeIterator { } } +class V2ListIterator implements AsyncIterator { + private currentPageIterator: Promise>; + private nextPageUrl: Promise; + private requestArgs: RequestArgs; + private spec: MethodSpec; + private stripeResource: StripeResourceObject; + constructor( + firstPagePromise: Promise>, + requestArgs: RequestArgs, + spec: MethodSpec, + stripeResource: StripeResourceObject + ) { + this.currentPageIterator = (async (): Promise> => { + const page = await firstPagePromise; + return page.data[Symbol.iterator](); + })(); + + this.nextPageUrl = (async (): Promise => { + const page = await firstPagePromise; + return page.next_page_url || null; + })(); + + this.requestArgs = requestArgs; + this.spec = spec; + this.stripeResource = stripeResource; + } + private async turnPage(): Promise | null> { + const nextPageUrl = await this.nextPageUrl; + if (!nextPageUrl) return null; + this.spec.fullPath = nextPageUrl; + const page = await this.stripeResource._makeRequest([], this.spec, {}); + this.nextPageUrl = Promise.resolve(page.next_page_url); + this.currentPageIterator = Promise.resolve(page.data[Symbol.iterator]()); + return this.currentPageIterator; + } + async next(): Promise> { + { + const result = (await this.currentPageIterator).next(); + if (!result.done) return {done: false, value: result.value}; + } + const nextPageIterator = await this.turnPage(); + if (!nextPageIterator) { + return {done: true, value: undefined}; + } + const result = nextPageIterator.next(); + if (!result.done) return {done: false, value: result.value}; + return {done: true, value: undefined}; + } +} + export const makeAutoPaginationMethods = < TMethodSpec extends MethodSpec, TItem extends {id: string} @@ -149,14 +204,20 @@ export const makeAutoPaginationMethods = < spec: TMethodSpec, firstPagePromise: Promise> ): AutoPaginationMethods | null => { - if (spec.methodType === 'search') { + const apiMode = getAPIMode(spec.fullPath || spec.path); + if (apiMode !== 'v2' && spec.methodType === 'search') { + return makeAutoPaginationMethodsFromIterator( + new V1SearchIterator(firstPagePromise, requestArgs, spec, stripeResource) + ); + } + if (apiMode !== 'v2' && spec.methodType === 'list') { return makeAutoPaginationMethodsFromIterator( - new SearchIterator(firstPagePromise, requestArgs, spec, stripeResource) + new V1ListIterator(firstPagePromise, requestArgs, spec, stripeResource) ); } - if (spec.methodType === 'list') { + if (apiMode === 'v2' && spec.methodType === 'list') { return makeAutoPaginationMethodsFromIterator( - new ListIterator(firstPagePromise, requestArgs, spec, stripeResource) + new V2ListIterator(firstPagePromise, requestArgs, spec, stripeResource) ); } return null; diff --git a/src/crypto/CryptoProvider.ts b/src/crypto/CryptoProvider.ts index f362061c42..5d11947bb8 100644 --- a/src/crypto/CryptoProvider.ts +++ b/src/crypto/CryptoProvider.ts @@ -29,6 +29,13 @@ export class CryptoProvider { computeHMACSignatureAsync(payload: string, secret: string): Promise { throw new Error('computeHMACSignatureAsync not implemented.'); } + + /** + * Computes a SHA-256 hash of the data. + */ + computeSHA256Async(data: Uint8Array): Promise { + throw new Error('computeSHA256 not implemented.'); + } } /** diff --git a/src/crypto/NodeCryptoProvider.ts b/src/crypto/NodeCryptoProvider.ts index 477ce41039..fa86682151 100644 --- a/src/crypto/NodeCryptoProvider.ts +++ b/src/crypto/NodeCryptoProvider.ts @@ -21,4 +21,14 @@ export class NodeCryptoProvider extends CryptoProvider { const signature = await this.computeHMACSignature(payload, secret); return signature; } + + /** @override */ + async computeSHA256Async(data: Uint8Array): Promise { + return new Uint8Array( + await crypto + .createHash('sha256') + .update(data) + .digest() + ); + } } diff --git a/src/crypto/SubtleCryptoProvider.ts b/src/crypto/SubtleCryptoProvider.ts index 51ef0e9caa..db3b51a2c8 100644 --- a/src/crypto/SubtleCryptoProvider.ts +++ b/src/crypto/SubtleCryptoProvider.ts @@ -63,6 +63,11 @@ export class SubtleCryptoProvider extends CryptoProvider { return signatureHexCodes.join(''); } + + /** @override */ + async computeSHA256Async(data: Uint8Array): Promise { + return new Uint8Array(await this.subtleCrypto.digest('SHA-256', data)); + } } // Cached mapping of byte to hex representation. We do this once to avoid re- diff --git a/src/multipart.ts b/src/multipart.ts index 1e28eb44f9..85b6ce024b 100644 --- a/src/multipart.ts +++ b/src/multipart.ts @@ -4,7 +4,7 @@ import { RequestHeaders, StripeResourceObject, } from './Types.js'; -import {flattenAndStringify, stringifyRequestData} from './utils.js'; +import {flattenAndStringify, queryStringifyRequestData} from './utils.js'; type MultipartCallbackReturn = any; type MultipartCallback = ( @@ -87,7 +87,7 @@ export function multipartRequestDataProcessor( data = data || {}; if (method !== 'POST') { - return callback(null, stringifyRequestData(data)); + return callback(null, queryStringifyRequestData(data)); } this._stripe._platformFunctions diff --git a/src/net/FetchHttpClient.ts b/src/net/FetchHttpClient.ts index bea479b463..df5b3cf6b4 100644 --- a/src/net/FetchHttpClient.ts +++ b/src/net/FetchHttpClient.ts @@ -115,7 +115,7 @@ export class FetchHttpClient extends HttpClient implements HttpClientInterface { path: string, method: string, headers: RequestHeaders, - requestData: RequestData, + requestData: string, protocol: string, timeout: number ): Promise { diff --git a/src/net/HttpClient.ts b/src/net/HttpClient.ts index 3e886b6358..673be72a2e 100644 --- a/src/net/HttpClient.ts +++ b/src/net/HttpClient.ts @@ -10,7 +10,7 @@ export interface HttpClientInterface { path: string, method: string, headers: RequestHeaders, - requestData: RequestData, + requestData: string, protocol: string, timeout: number ) => Promise; @@ -48,7 +48,7 @@ export class HttpClient implements HttpClientInterface { path: string, method: string, headers: RequestHeaders, - requestData: RequestData, + requestData: string, protocol: string, timeout: number ): Promise { diff --git a/src/net/NodeHttpClient.ts b/src/net/NodeHttpClient.ts index e6f94f3a4b..562051582b 100644 --- a/src/net/NodeHttpClient.ts +++ b/src/net/NodeHttpClient.ts @@ -43,7 +43,7 @@ export class NodeHttpClient extends HttpClient { path: string, method: string, headers: RequestHeaders, - requestData: RequestData, + requestData: string, protocol: string, timeout: number ): Promise { diff --git a/src/resources.ts b/src/resources.ts index 109e6e9eb8..8a4fb310a7 100644 --- a/src/resources.ts +++ b/src/resources.ts @@ -14,18 +14,27 @@ import {Configurations as BillingPortalConfigurations} from './resources/Billing import {Configurations as TerminalConfigurations} from './resources/Terminal/Configurations.js'; import {ConfirmationTokens as TestHelpersConfirmationTokens} from './resources/TestHelpers/ConfirmationTokens.js'; import {ConnectionTokens as TerminalConnectionTokens} from './resources/Terminal/ConnectionTokens.js'; +import {CreditBalanceSummary as BillingCreditBalanceSummary} from './resources/Billing/CreditBalanceSummary.js'; +import {CreditBalanceTransactions as BillingCreditBalanceTransactions} from './resources/Billing/CreditBalanceTransactions.js'; +import {CreditGrants as BillingCreditGrants} from './resources/Billing/CreditGrants.js'; import {CreditReversals as TreasuryCreditReversals} from './resources/Treasury/CreditReversals.js'; import {Customers as TestHelpersCustomers} from './resources/TestHelpers/Customers.js'; import {DebitReversals as TreasuryDebitReversals} from './resources/Treasury/DebitReversals.js'; import {Disputes as IssuingDisputes} from './resources/Issuing/Disputes.js'; import {EarlyFraudWarnings as RadarEarlyFraudWarnings} from './resources/Radar/EarlyFraudWarnings.js'; +import {EventDestinations as V2CoreEventDestinations} from './resources/V2/Core/EventDestinations.js'; +import {Events as V2CoreEvents} from './resources/V2/Core/Events.js'; import {Features as EntitlementsFeatures} from './resources/Entitlements/Features.js'; import {FinancialAccounts as TreasuryFinancialAccounts} from './resources/Treasury/FinancialAccounts.js'; import {InboundTransfers as TestHelpersTreasuryInboundTransfers} from './resources/TestHelpers/Treasury/InboundTransfers.js'; import {InboundTransfers as TreasuryInboundTransfers} from './resources/Treasury/InboundTransfers.js'; import {Locations as TerminalLocations} from './resources/Terminal/Locations.js'; import {MeterEventAdjustments as BillingMeterEventAdjustments} from './resources/Billing/MeterEventAdjustments.js'; +import {MeterEventAdjustments as V2BillingMeterEventAdjustments} from './resources/V2/Billing/MeterEventAdjustments.js'; +import {MeterEventSession as V2BillingMeterEventSession} from './resources/V2/Billing/MeterEventSession.js'; +import {MeterEventStream as V2BillingMeterEventStream} from './resources/V2/Billing/MeterEventStream.js'; import {MeterEvents as BillingMeterEvents} from './resources/Billing/MeterEvents.js'; +import {MeterEvents as V2BillingMeterEvents} from './resources/V2/Billing/MeterEvents.js'; import {Meters as BillingMeters} from './resources/Billing/Meters.js'; import {Orders as ClimateOrders} from './resources/Climate/Orders.js'; import {OutboundPayments as TestHelpersTreasuryOutboundPayments} from './resources/TestHelpers/Treasury/OutboundPayments.js'; @@ -122,6 +131,9 @@ export {WebhookEndpoints} from './resources/WebhookEndpoints.js'; export const Apps = resourceNamespace('apps', {Secrets: AppsSecrets}); export const Billing = resourceNamespace('billing', { Alerts: BillingAlerts, + CreditBalanceSummary: BillingCreditBalanceSummary, + CreditBalanceTransactions: BillingCreditBalanceTransactions, + CreditGrants: BillingCreditGrants, MeterEventAdjustments: BillingMeterEventAdjustments, MeterEvents: BillingMeterEvents, Meters: BillingMeters, @@ -222,3 +234,15 @@ export const Treasury = resourceNamespace('treasury', { TransactionEntries: TreasuryTransactionEntries, Transactions: TreasuryTransactions, }); +export const V2 = resourceNamespace('v2', { + Billing: resourceNamespace('billing', { + MeterEventAdjustments: V2BillingMeterEventAdjustments, + MeterEventSession: V2BillingMeterEventSession, + MeterEventStream: V2BillingMeterEventStream, + MeterEvents: V2BillingMeterEvents, + }), + Core: resourceNamespace('core', { + EventDestinations: V2CoreEventDestinations, + Events: V2CoreEvents, + }), +}); diff --git a/src/resources/Billing/CreditBalanceSummary.ts b/src/resources/Billing/CreditBalanceSummary.ts new file mode 100644 index 0000000000..0258a0ec98 --- /dev/null +++ b/src/resources/Billing/CreditBalanceSummary.ts @@ -0,0 +1,10 @@ +// File generated from our OpenAPI spec + +import {StripeResource} from '../../StripeResource.js'; +const stripeMethod = StripeResource.method; +export const CreditBalanceSummary = StripeResource.extend({ + retrieve: stripeMethod({ + method: 'GET', + fullPath: '/v1/billing/credit_balance_summary', + }), +}); diff --git a/src/resources/Billing/CreditBalanceTransactions.ts b/src/resources/Billing/CreditBalanceTransactions.ts new file mode 100644 index 0000000000..5f4cca0d2e --- /dev/null +++ b/src/resources/Billing/CreditBalanceTransactions.ts @@ -0,0 +1,15 @@ +// File generated from our OpenAPI spec + +import {StripeResource} from '../../StripeResource.js'; +const stripeMethod = StripeResource.method; +export const CreditBalanceTransactions = StripeResource.extend({ + retrieve: stripeMethod({ + method: 'GET', + fullPath: '/v1/billing/credit_balance_transactions/{id}', + }), + list: stripeMethod({ + method: 'GET', + fullPath: '/v1/billing/credit_balance_transactions', + methodType: 'list', + }), +}); diff --git a/src/resources/Billing/CreditGrants.ts b/src/resources/Billing/CreditGrants.ts new file mode 100644 index 0000000000..19622cb64f --- /dev/null +++ b/src/resources/Billing/CreditGrants.ts @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec + +import {StripeResource} from '../../StripeResource.js'; +const stripeMethod = StripeResource.method; +export const CreditGrants = StripeResource.extend({ + create: stripeMethod({method: 'POST', fullPath: '/v1/billing/credit_grants'}), + retrieve: stripeMethod({ + method: 'GET', + fullPath: '/v1/billing/credit_grants/{id}', + }), + update: stripeMethod({ + method: 'POST', + fullPath: '/v1/billing/credit_grants/{id}', + }), + list: stripeMethod({ + method: 'GET', + fullPath: '/v1/billing/credit_grants', + methodType: 'list', + }), + expire: stripeMethod({ + method: 'POST', + fullPath: '/v1/billing/credit_grants/{id}/expire', + }), + voidGrant: stripeMethod({ + method: 'POST', + fullPath: '/v1/billing/credit_grants/{id}/void', + }), +}); diff --git a/src/resources/OAuth.ts b/src/resources/OAuth.ts index 318d49835c..78f046a992 100644 --- a/src/resources/OAuth.ts +++ b/src/resources/OAuth.ts @@ -1,7 +1,7 @@ 'use strict'; import {StripeResource} from '../StripeResource.js'; -import {stringifyRequestData} from '../utils.js'; +import {queryStringifyRequestData} from '../utils.js'; type OAuthAuthorizeUrlParams = { response_type?: 'code'; @@ -48,7 +48,7 @@ export const OAuth = StripeResource.extend({ params.scope = 'read_write'; } - return `https://${oAuthHost}/${path}?${stringifyRequestData(params)}`; + return `https://${oAuthHost}/${path}?${queryStringifyRequestData(params)}`; }, token: stripeMethod({ diff --git a/src/resources/TestHelpers/Issuing/Authorizations.ts b/src/resources/TestHelpers/Issuing/Authorizations.ts index 5da1fda25b..18b5212cc1 100644 --- a/src/resources/TestHelpers/Issuing/Authorizations.ts +++ b/src/resources/TestHelpers/Issuing/Authorizations.ts @@ -25,6 +25,11 @@ export const Authorizations = StripeResource.extend({ fullPath: '/v1/test_helpers/issuing/authorizations/{authorization}/increment', }), + respond: stripeMethod({ + method: 'POST', + fullPath: + '/v1/test_helpers/issuing/authorizations/{authorization}/fraud_challenges/respond', + }), reverse: stripeMethod({ method: 'POST', fullPath: '/v1/test_helpers/issuing/authorizations/{authorization}/reverse', diff --git a/src/resources/TestHelpers/Issuing/Cards.ts b/src/resources/TestHelpers/Issuing/Cards.ts index a7393836fc..e0e5cdb778 100644 --- a/src/resources/TestHelpers/Issuing/Cards.ts +++ b/src/resources/TestHelpers/Issuing/Cards.ts @@ -19,4 +19,8 @@ export const Cards = StripeResource.extend({ method: 'POST', fullPath: '/v1/test_helpers/issuing/cards/{card}/shipping/ship', }), + submitCard: stripeMethod({ + method: 'POST', + fullPath: '/v1/test_helpers/issuing/cards/{card}/shipping/submit', + }), }); diff --git a/src/resources/V2/Billing/MeterEventAdjustments.ts b/src/resources/V2/Billing/MeterEventAdjustments.ts new file mode 100644 index 0000000000..e6bc084da5 --- /dev/null +++ b/src/resources/V2/Billing/MeterEventAdjustments.ts @@ -0,0 +1,10 @@ +// File generated from our OpenAPI spec + +import {StripeResource} from '../../../StripeResource.js'; +const stripeMethod = StripeResource.method; +export const MeterEventAdjustments = StripeResource.extend({ + create: stripeMethod({ + method: 'POST', + fullPath: '/v2/billing/meter_event_adjustments', + }), +}); diff --git a/src/resources/V2/Billing/MeterEventSession.ts b/src/resources/V2/Billing/MeterEventSession.ts new file mode 100644 index 0000000000..2fa6fb9f8e --- /dev/null +++ b/src/resources/V2/Billing/MeterEventSession.ts @@ -0,0 +1,10 @@ +// File generated from our OpenAPI spec + +import {StripeResource} from '../../../StripeResource.js'; +const stripeMethod = StripeResource.method; +export const MeterEventSession = StripeResource.extend({ + create: stripeMethod({ + method: 'POST', + fullPath: '/v2/billing/meter_event_session', + }), +}); diff --git a/src/resources/V2/Billing/MeterEventStream.ts b/src/resources/V2/Billing/MeterEventStream.ts new file mode 100644 index 0000000000..c74537f037 --- /dev/null +++ b/src/resources/V2/Billing/MeterEventStream.ts @@ -0,0 +1,11 @@ +// File generated from our OpenAPI spec + +import {StripeResource} from '../../../StripeResource.js'; +const stripeMethod = StripeResource.method; +export const MeterEventStream = StripeResource.extend({ + create: stripeMethod({ + method: 'POST', + fullPath: '/v2/billing/meter_event_stream', + host: 'meter-events.stripe.com', + }), +}); diff --git a/src/resources/V2/Billing/MeterEvents.ts b/src/resources/V2/Billing/MeterEvents.ts new file mode 100644 index 0000000000..ae425b29b5 --- /dev/null +++ b/src/resources/V2/Billing/MeterEvents.ts @@ -0,0 +1,7 @@ +// File generated from our OpenAPI spec + +import {StripeResource} from '../../../StripeResource.js'; +const stripeMethod = StripeResource.method; +export const MeterEvents = StripeResource.extend({ + create: stripeMethod({method: 'POST', fullPath: '/v2/billing/meter_events'}), +}); diff --git a/src/resources/V2/Core/EventDestinations.ts b/src/resources/V2/Core/EventDestinations.ts new file mode 100644 index 0000000000..b857691e05 --- /dev/null +++ b/src/resources/V2/Core/EventDestinations.ts @@ -0,0 +1,39 @@ +// File generated from our OpenAPI spec + +import {StripeResource} from '../../../StripeResource.js'; +const stripeMethod = StripeResource.method; +export const EventDestinations = StripeResource.extend({ + create: stripeMethod({ + method: 'POST', + fullPath: '/v2/core/event_destinations', + }), + retrieve: stripeMethod({ + method: 'GET', + fullPath: '/v2/core/event_destinations/{id}', + }), + update: stripeMethod({ + method: 'POST', + fullPath: '/v2/core/event_destinations/{id}', + }), + list: stripeMethod({ + method: 'GET', + fullPath: '/v2/core/event_destinations', + methodType: 'list', + }), + del: stripeMethod({ + method: 'DELETE', + fullPath: '/v2/core/event_destinations/{id}', + }), + disable: stripeMethod({ + method: 'POST', + fullPath: '/v2/core/event_destinations/{id}/disable', + }), + enable: stripeMethod({ + method: 'POST', + fullPath: '/v2/core/event_destinations/{id}/enable', + }), + ping: stripeMethod({ + method: 'POST', + fullPath: '/v2/core/event_destinations/{id}/ping', + }), +}); diff --git a/src/resources/V2/Core/Events.ts b/src/resources/V2/Core/Events.ts new file mode 100644 index 0000000000..cbfa40a317 --- /dev/null +++ b/src/resources/V2/Core/Events.ts @@ -0,0 +1,64 @@ +// This file is manually maintained +import {StripeResource} from '../../../StripeResource.js'; + +const stripeMethod = StripeResource.method; + +export const Events = StripeResource.extend({ + retrieve(...args: any[]) { + const transformResponseData = (response: any): any => { + return this.addFetchRelatedObjectIfNeeded(response); + }; + return stripeMethod({ + method: 'GET', + fullPath: '/v2/core/events/{id}', + transformResponseData, + }).apply(this, args); + }, + + list(...args: any[]) { + const transformResponseData = (response: any): any => { + return { + ...response, + data: response.data.map(this.addFetchRelatedObjectIfNeeded.bind(this)), + }; + }; + return stripeMethod({ + method: 'GET', + fullPath: '/v2/core/events', + methodType: 'list', + transformResponseData, + }).apply(this, args); + }, + + /** + * @private + * + * For internal use in stripe-node. + * + * @param pulledEvent The retrieved event object + * @returns The retrieved event object with a fetchRelatedObject method, + * if pulledEvent.related_object is valid (non-null and has a url) + */ + addFetchRelatedObjectIfNeeded(pulledEvent: any) { + if (!pulledEvent.related_object || !pulledEvent.related_object.url) { + return pulledEvent; + } + return { + ...pulledEvent, + fetchRelatedObject: (): Promise => + // call stripeMethod with 'this' resource to fetch + // the related object. 'this' is needed to construct + // and send the request, but the method spec controls + // the url endpoint and method, so it doesn't matter + // that 'this' is an Events resource object here + stripeMethod({ + method: 'GET', + fullPath: pulledEvent.related_object.url, + }).apply(this, [ + { + stripeAccount: pulledEvent.context, + }, + ]), + }; + }, +}); diff --git a/src/stripe.core.ts b/src/stripe.core.ts index b777ce7cdb..6d0d85af87 100644 --- a/src/stripe.core.ts +++ b/src/stripe.core.ts @@ -1,14 +1,22 @@ import * as _Error from './Error.js'; import {RequestSender} from './RequestSender.js'; import {StripeResource} from './StripeResource.js'; -import {AppInfo, StripeObject, UserProvidedConfig} from './Types.js'; -import {WebhookObject, createWebhooks} from './Webhooks.js'; -import * as apiVersion from './apiVersion.js'; +import { + AppInfo, + RequestAuthenticator, + StripeObject, + UserProvidedConfig, + RequestData, + RequestOptions, +} from './Types.js'; +import {WebhookObject, WebhookEvent, createWebhooks} from './Webhooks.js'; +import {ApiVersion} from './apiVersion.js'; import {CryptoProvider} from './crypto/CryptoProvider.js'; import {HttpClient, HttpClientResponse} from './net/HttpClient.js'; import {PlatformFunctions} from './platform/PlatformFunctions.js'; import * as resources from './resources.js'; import { + createApiKeyAuthenticator, determineProcessUserAgentProperties, pascalToCamelCase, validateInteger, @@ -17,15 +25,16 @@ import { const DEFAULT_HOST = 'api.stripe.com'; const DEFAULT_PORT = '443'; const DEFAULT_BASE_PATH = '/v1/'; -const DEFAULT_API_VERSION = apiVersion.ApiVersion; +const DEFAULT_API_VERSION = ApiVersion; const DEFAULT_TIMEOUT = 80000; -const MAX_NETWORK_RETRY_DELAY_SEC = 2; +const MAX_NETWORK_RETRY_DELAY_SEC = 5; const INITIAL_NETWORK_RETRY_DELAY_SEC = 0.5; const APP_INFO_PROPERTIES = ['name', 'version', 'url', 'partner_id']; const ALLOWED_CONFIG_PROPERTIES = [ + 'authenticator', 'apiVersion', 'typescript', 'maxNetworkRetries', @@ -38,6 +47,7 @@ const ALLOWED_CONFIG_PROPERTIES = [ 'telemetry', 'appInfo', 'stripeAccount', + 'stripeContext', ]; type RequestSenderFactory = (stripe: StripeObject) => RequestSender; @@ -49,7 +59,7 @@ export function createStripe( platformFunctions: PlatformFunctions, requestSender: RequestSenderFactory = defaultRequestSenderFactory ): typeof Stripe { - Stripe.PACKAGE_VERSION = '16.12.0'; + Stripe.PACKAGE_VERSION = '17.5.0'; Stripe.USER_AGENT = { bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', @@ -107,7 +117,6 @@ export function createStripe( const agent = props.httpAgent || null; this._api = { - auth: null, host: props.host || DEFAULT_HOST, port: props.port || DEFAULT_PORT, protocol: props.protocol || 'https', @@ -117,7 +126,7 @@ export function createStripe( maxNetworkRetries: validateInteger( 'maxNetworkRetries', props.maxNetworkRetries, - 1 + 2 ), agent: agent, httpClient: @@ -127,6 +136,7 @@ export function createStripe( : this._platformFunctions.createDefaultHttpClient()), dev: false, stripeAccount: props.stripeAccount || null, + stripeContext: props.stripeContext || null, }; const typescript = props.typescript || false; @@ -143,7 +153,7 @@ export function createStripe( } this._prepResources(); - this._setApiKey(key); + this._setAuthenticator(key, props.authenticator); this.errors = _Error; @@ -208,13 +218,33 @@ export function createStripe( _requestSender: null!, _platformFunctions: null!, + rawRequest( + method: string, + path: string, + params?: RequestData, + options?: RequestOptions + ): Promise { + return this._requestSender._rawRequest(method, path, params, options); + }, + /** * @private */ - _setApiKey(key: string): void { - if (key) { - this._setApiField('auth', `Bearer ${key}`); + _setAuthenticator( + key: string, + authenticator: RequestAuthenticator | undefined + ): void { + if (key && authenticator) { + throw new Error("Can't specify both apiKey and authenticator"); + } + + if (!key && !authenticator) { + throw new Error('Neither apiKey nor config.authenticator provided'); } + + this._authenticator = key + ? createApiKeyAuthenticator(key) + : authenticator; }, /** @@ -469,6 +499,25 @@ export function createStripe( return config; }, + + parseThinEvent( + payload: string | Uint8Array, + header: string | Uint8Array, + secret: string, + tolerance?: number, + cryptoProvider?: CryptoProvider, + receivedAt?: number + ): WebhookEvent { + // parses and validates the event payload all in one go + return this.webhooks.constructEvent( + payload, + header, + secret, + tolerance, + cryptoProvider, + receivedAt + ); + }, } as StripeObject; return Stripe; diff --git a/src/utils.ts b/src/utils.ts index 005256d56e..a9dfe7b143 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -6,6 +6,9 @@ import { StripeResourceObject, RequestHeaders, MultipartRequestData, + RequestAuthenticator, + StripeRequest, + ApiMode, } from './Types.js'; const OPTIONS_KEYS = [ @@ -16,6 +19,9 @@ const OPTIONS_KEYS = [ 'maxNetworkRetries', 'timeout', 'host', + 'authenticator', + 'stripeContext', + 'additionalHeaders', ]; type Settings = { @@ -24,11 +30,11 @@ type Settings = { }; type Options = { - auth: string | null; + authenticator?: RequestAuthenticator | null; host: string | null; settings: Settings; streaming?: boolean; - headers: Record; + headers: RequestHeaders; }; export function isOptionsHash(o: unknown): boolean | unknown { @@ -43,11 +49,15 @@ export function isOptionsHash(o: unknown): boolean | unknown { * Stringifies an Object, accommodating nested objects * (forming the conventional key 'parent[child]=value') */ -export function stringifyRequestData(data: RequestData | string): string { +export function queryStringifyRequestData( + data: RequestData | string, + apiMode?: ApiMode +): string { return ( qs .stringify(data, { serializeDate: (d: Date) => Math.floor(d.getTime() / 1000).toString(), + arrayFormat: apiMode == 'v2' ? 'repeat' : 'indices', }) // Don't use strict form encoding by changing the square bracket control // characters back to their literals. This is fine by the server, and @@ -132,7 +142,6 @@ export function getDataFromArgs(args: RequestArgs): RequestData { */ export function getOptionsFromArgs(args: RequestArgs): Options { const opts: Options = { - auth: null, host: null, headers: {}, settings: {}, @@ -140,7 +149,7 @@ export function getOptionsFromArgs(args: RequestArgs): Options { if (args.length > 0) { const arg = args[args.length - 1]; if (typeof arg === 'string') { - opts.auth = args.pop() as string; + opts.authenticator = createApiKeyAuthenticator(args.pop() as string); } else if (isOptionsHash(arg)) { const params = {...(args.pop() as Record)}; @@ -155,16 +164,24 @@ export function getOptionsFromArgs(args: RequestArgs): Options { } if (params.apiKey) { - opts.auth = params.apiKey as string; + opts.authenticator = createApiKeyAuthenticator(params.apiKey as string); } if (params.idempotencyKey) { - opts.headers['Idempotency-Key'] = params.idempotencyKey; + opts.headers['Idempotency-Key'] = params.idempotencyKey as string; } if (params.stripeAccount) { - opts.headers['Stripe-Account'] = params.stripeAccount; + opts.headers['Stripe-Account'] = params.stripeAccount as string; + } + if (params.stripeContext) { + if (opts.headers['Stripe-Account']) { + throw new Error( + "Can't specify both stripeAccount and stripeContext." + ); + } + opts.headers['Stripe-Context'] = params.stripeContext as string; } if (params.apiVersion) { - opts.headers['Stripe-Version'] = params.apiVersion; + opts.headers['Stripe-Version'] = params.apiVersion as string; } if (Number.isInteger(params.maxNetworkRetries)) { opts.settings.maxNetworkRetries = params.maxNetworkRetries as number; @@ -175,6 +192,23 @@ export function getOptionsFromArgs(args: RequestArgs): Options { if (params.host) { opts.host = params.host as string; } + if (params.authenticator) { + if (params.apiKey) { + throw new Error("Can't specify both apiKey and authenticator."); + } + if (typeof params.authenticator !== 'function') { + throw new Error( + 'The authenticator must be a function ' + + 'receiving a request as the first parameter.' + ); + } + opts.authenticator = params.authenticator as RequestAuthenticator; + } + if (params.additionalHeaders) { + opts.headers = params.additionalHeaders as { + [headerName: string]: string; + }; + } } } return opts; @@ -361,6 +395,20 @@ export function determineProcessUserAgentProperties(): Record { }; } +export function createApiKeyAuthenticator( + apiKey: string +): RequestAuthenticator { + const authenticator = (request: StripeRequest): Promise => { + request.headers.Authorization = 'Bearer ' + apiKey; + return Promise.resolve(); + }; + + // For testing + authenticator._apiKey = apiKey; + + return authenticator; +} + /** * Joins an array of Uint8Arrays into a single Uint8Array */ @@ -376,3 +424,31 @@ export function concat(arrays: Array): Uint8Array { return merged; } + +/** + * Replaces Date objects with Unix timestamps + */ +function dateTimeReplacer(this: any, key: string, value: any): string { + if (this[key] instanceof Date) { + return Math.floor(this[key].getTime() / 1000).toString(); + } + + return value; +} + +/** + * JSON stringifies an Object, replacing Date objects with Unix timestamps + */ +export function jsonStringifyRequestData(data: RequestData | string): string { + return JSON.stringify(data, dateTimeReplacer); +} + +/** + * Inspects the given path to determine if the endpoint is for v1 or v2 API + */ +export function getAPIMode(path?: string): ApiMode { + if (!path) { + return 'v1'; + } + return path.startsWith('/v2') ? 'v2' : 'v1'; +} diff --git a/test/Error.spec.ts b/test/Error.spec.ts index a899766a7a..7efa021179 100644 --- a/test/Error.spec.ts +++ b/test/Error.spec.ts @@ -23,6 +23,29 @@ describe('Error', () => { ).to.be.instanceOf(Error.StripeUnknownError); }); + it('Generates specific instance of v2 errors depending on error-type', () => { + // Falls back to V1 parsing logic if code is absent + expect(Error.generateV2Error({type: 'card_error'})).to.be.instanceOf( + Error.StripeCardError + ); + // Falls back to V1 parsing logic if code is unrecognized + expect( + Error.generateV2Error({type: 'card_error', code: 'no_such_error'}) + ).to.be.instanceOf(Error.StripeCardError); + expect( + Error.generateV2Error({ + code: 'invalid_fields', + }) + ).to.be.instanceOf(Error.StripeInvalidRequestError); + expect( + Error.generateV2Error({type: 'temporary_session_expired'}) + ).to.be.instanceOf(Error.TemporarySessionExpiredError); + + expect(Error.generateV2Error({code: 'invalid_fields'})).to.be.instanceOf( + Error.StripeInvalidRequestError + ); + }); + it('copies whitelisted properties', () => { const e = new Error.StripeError({ charge: 'foo', diff --git a/test/RequestSender.spec.ts b/test/RequestSender.spec.ts index 9ccf7b1ea3..6927803959 100644 --- a/test/RequestSender.spec.ts +++ b/test/RequestSender.spec.ts @@ -1,5 +1,7 @@ // @ts-nocheck import {expect} from 'chai'; +import nock = require('nock'); + import { StripeAuthenticationError, StripeConnectionError, @@ -7,15 +9,17 @@ import { StripeIdempotencyError, StripePermissionError, StripeRateLimitError, + StripeUnknownError, + TemporarySessionExpiredError, } from '../src/Error.js'; -import {HttpClientResponse} from '../src/net/HttpClient.js'; import {RequestSender} from '../src/RequestSender.js'; +import {ApiVersion} from '../src/apiVersion.js'; +import {HttpClientResponse} from '../src/net/HttpClient.js'; import { FAKE_API_KEY, getSpyableStripe, getTestServerStripe, } from './testUtils.js'; -import nock = require('nock'); const stripe = getSpyableStripe(); @@ -23,22 +27,46 @@ describe('RequestSender', () => { const sender = new RequestSender(stripe, 0); describe('_makeHeaders', () => { - it('sets the Authorization header with Bearer auth using the global API key', () => { - const headers = sender._makeHeaders(null, 0, null); - expect(headers.Authorization).to.equal(`Bearer ${FAKE_API_KEY}`); - }); - it('sets the Authorization header with Bearer auth using the specified API key', () => { - const headers = sender._makeHeaders('anotherFakeAuthToken', 0, null); - expect(headers.Authorization).to.equal('Bearer anotherFakeAuthToken'); - }); it('sets the Stripe-Version header if an API version is provided', () => { - const headers = sender._makeHeaders(null, 0, '1970-01-01'); + const headers = sender._makeHeaders({apiVersion: '1970-01-01'}); expect(headers['Stripe-Version']).to.equal('1970-01-01'); }); it('does not the set the Stripe-Version header if no API version is provided', () => { - const headers = sender._makeHeaders(null, 0, null); + const headers = sender._makeHeaders({}); expect(headers).to.not.include.keys('Stripe-Version'); }); + describe('idempotency keys', () => { + it('only creates creates an idempotency key if a v1 request wil retry', () => { + const headers = sender._makeHeaders({ + method: 'POST', + userSuppliedSettings: {maxNetworkRetries: 3}, + apiMode: 'v1', + }); + expect(headers['Idempotency-Key']).matches(/^stripe-node-retry/); + }); + // should probably always create an IK; until then, codify the behavior + it("skips idempotency genration for v1 reqeust if we're not retrying the request", () => { + const headers = sender._makeHeaders({ + method: 'POST', + userSuppliedSettings: {maxNetworkRetries: 0}, + apiMode: 'v1', + }); + expect(headers['Idempotency-Key']).equals(undefined); + }); + it('always creates an idempotency key for v2 POST requests', () => { + const headers = sender._makeHeaders({method: 'POST', apiMode: 'v2'}); + expect(headers['Idempotency-Key']).matches(/^stripe-node-retry/); + }); + it('always creates an idempotency key for v2 DELETE requests', () => { + const headers = sender._makeHeaders({method: 'DELETE', apiMode: 'v2'}); + expect(headers['Idempotency-Key']).matches(/^stripe-node-retry/); + }); + it('generates a new key every time', () => { + expect(sender._defaultIdempotencyKey('POST', {}, 'v2')).not.to.equal( + sender._defaultIdempotencyKey('POST', {}, 'v2') + ); + }); + }); }); describe('_shouldRetry', () => { @@ -90,7 +118,7 @@ describe('RequestSender', () => { describe('Parameter encoding', () => { // Use a real instance of stripe as we're mocking the http.request responses. - const realStripe = require('../src/stripe.cjs.node.js')('sk_test_xyz'); + const realStripe = require('../src/stripe.cjs.node.js')(FAKE_API_KEY); afterEach(() => { nock.cleanAll(); @@ -268,9 +296,12 @@ describe('RequestSender', () => { const scope = nock( `https://${options.host}`, - // Content-Length should be present for POST. + // Content-Length and Content-Type should be present for POST. { - reqheaders: {'Content-Length': options.body.length}, + reqheaders: { + 'Content-Length': options.body.length, + 'Content-Type': 'application/x-www-form-urlencoded', + }, } ) .post(options.path, options.body) @@ -286,6 +317,89 @@ describe('RequestSender', () => { ); }); + it('encodes the body in POST requests as JSON for v2', (done) => { + const options = { + host: stripe.getConstant('DEFAULT_HOST'), + path: '/v2/billing/meter_event_session', + data: { + name: 'llama', + }, + body: '{"name":"llama"}', + }; + + const scope = nock( + `https://${options.host}`, + // Content-Length and Content-Type should be present for POST. + { + reqheaders: { + 'Content-Length': options.body.length, + 'Content-Type': 'application/json', + }, + } + ) + .post(options.path, options.body) + .reply(200, '{}'); + + realStripe.v2.billing.meterEventSession.create( + options.data, + (err, response) => { + done(err); + scope.done(); + } + ); + }); + + it('encodes null values in the body in POST correctly for v2', (done) => { + const options = { + host: stripe.getConstant('DEFAULT_HOST'), + path: '/v2/billing/meter_event_session', + data: { + name: null, + }, + body: '{"name":null}', + }; + + const scope = nock( + `https://${options.host}`, + // Content-Length and Content-Type should be present for POST. + { + reqheaders: { + 'Content-Length': options.body.length, + 'Content-Type': 'application/json', + }, + } + ) + .post(options.path, options.body) + .reply(200, '{}'); + + realStripe.v2.billing.meterEventSession.create( + options.data, + (err, response) => { + done(err); + scope.done(); + } + ); + }); + + it('encodes data for GET requests as query params for v2', (done) => { + const host = stripe.getConstant('DEFAULT_HOST'); + const scope = nock(`https://${host}`) + .get( + `/v2/core/events/event_123?include=defaults&include=configuration`, + '' + ) + .reply(200, '{}'); + + realStripe.v2.core.events.retrieve( + 'event_123', + {include: ['defaults', 'configuration']}, + (err, response) => { + done(err); + scope.done(); + } + ); + }); + it('always includes Content-Length in POST requests even when empty', (done) => { const options = { host: stripe.getConstant('DEFAULT_HOST'), @@ -315,6 +429,38 @@ describe('RequestSender', () => { ); }); + it('encodes Date objects in POST requests as JSON for v2', (done) => { + const options = { + host: stripe.getConstant('DEFAULT_HOST'), + path: '/v2/billing/meter_event_session', + data: { + created: new Date('2009-02-13T23:31:30Z'), + }, + body: '{"created":"1234567890"}', + }; + + const scope = nock( + `https://${options.host}`, + // Content-Length and Content-Type should be present for POST. + { + reqheaders: { + 'Content-Length': options.body.length, + 'Content-Type': 'application/json', + }, + } + ) + .post(options.path, options.body) + .reply(200, '{}'); + + realStripe.v2.billing.meterEventSession.create( + options.data, + (err, response) => { + done(err); + scope.done(); + } + ); + }); + it('allows overriding host', (done) => { const scope = nock('https://myhost') .get('/v1/accounts/acct_123') @@ -332,6 +478,20 @@ describe('RequestSender', () => { } ); }); + + it('sends with APIVersion in header', (done) => { + const host = stripe.getConstant('DEFAULT_HOST'); + const scope = nock(`https://${host}`, { + reqheaders: {'Stripe-Version': ApiVersion}, + }) + .get('/v1/subscriptions') + .reply(200, '{}'); + + realStripe.subscriptions.list((err, response) => { + done(err); + scope.done(); + }); + }); }); }); @@ -509,6 +669,47 @@ describe('RequestSender', () => { }); }); + it('throws a v2 StripeError based on the underlying error "code" for v2 APIs', (done) => { + const error = { + type: 'temporary_session_expired', + message: 'you messed up', + }; + + nock(`https://${options.host}`) + .post('/v2/billing/meter_event_session', {}) + .reply(400, { + error, + }); + + realStripe.v2.billing.meterEventSession.create({}, (err) => { + expect(err).to.be.an.instanceOf(TemporarySessionExpiredError); + expect(err.message).to.equal('you messed up'); + done(); + }); + }); + + it('throws a v1 StripeError for v1 APIs', (done) => { + const error = { + type: 'temporary_session_expired', + message: 'you messed up', + }; + + nock(`https://${options.host}`) + .post('/v1/customers', {}) + .reply(400, { + error, + }); + + realStripe.customers.create({}, (err) => { + expect(err).to.be.an.instanceOf(StripeError); + expect(err).to.be.an.instanceOf(StripeUnknownError); + expect(err).not.to.be.an.instanceOf(TemporarySessionExpiredError); + expect(err.message).to.equal('you messed up'); + expect(err.raw.message).to.equal('you messed up'); + done(); + }); + }); + it('retries connection timeout errors', (done) => { let nRequestsReceived = 0; return getTestServerStripe( diff --git a/test/autoPagination.spec.ts b/test/autoPagination.spec.ts index 1c5f99db1e..063aad5211 100644 --- a/test/autoPagination.spec.ts +++ b/test/autoPagination.spec.ts @@ -5,6 +5,7 @@ import {expect} from 'chai'; import {makeAutoPaginationMethods} from '../src/autoPagination.js'; import {StripeResource} from '../src/StripeResource.js'; import {getMockStripe} from './testUtils.js'; +import {MethodSpec} from '../src/Types.js'; describe('auto pagination', () => { const testCase = (mockPaginationFn) => ({ @@ -36,7 +37,6 @@ describe('auto pagination', () => { method: 'GET', fullPath: '/v1/items', methodType: 'list', - apiMode: 'v1', }; const mockStripe = getMockStripe( @@ -544,7 +544,7 @@ describe('auto pagination', () => { }); }); - describe('foward pagination', () => { + describe('forward pagination', () => { it('paginates forwards through a page', () => { return testCaseV1List({ pages: [ @@ -647,7 +647,6 @@ describe('auto pagination', () => { const spec = { method: 'GET', methodType: 'search', - apiMode: 'v1', }; const addNextPage = (props) => { @@ -746,6 +745,103 @@ describe('auto pagination', () => { }); }); }); + describe('V2 list pagination', () => { + const mockPaginationV2List = (pages, initialArgs) => { + let i = 1; + const paramsLog = []; + const spec = { + method: 'GET', + fullPath: '/v2/items', + methodType: 'list', + }; + + const mockStripe = getMockStripe( + {}, + (_1, _2, path, _4, _5, _6, _7, callback) => { + paramsLog.push(path.slice(path.indexOf('?'))); + callback( + null, + Promise.resolve({ + data: pages[i].ids.map((id) => ({id})), + next_page_url: pages[i].next_page_url, + }) + ); + i += 1; + } + ); + const resource = new StripeResource(mockStripe); + + const paginator = makeAutoPaginationMethods( + resource, + initialArgs || {}, + spec, + Promise.resolve({ + data: pages[0].ids.map((id) => ({id})), + next_page_url: pages[0].next_page_url, + }) + ); + return {paginator, paramsLog}; + }; + + const testCaseV2List = testCase(mockPaginationV2List); + it('paginates forwards through a page', () => { + return testCaseV2List({ + pages: [ + {ids: [1, 2], next_page_url: '/v2/items?page=foo'}, + {ids: [3, 4]}, + ], + limit: 10, + expectedIds: [1, 2, 3, 4], + expectedParamsLog: ['?page=foo'], + }); + }); + + it('paginates forwards through uneven-sized pages', () => { + return testCaseV2List({ + pages: [ + {ids: [1, 2], next_page_url: '/v2/items?page=foo'}, + {ids: [3, 4], next_page_url: '/v2/items?page=bar'}, + {ids: [5]}, + ], + limit: 10, + expectedIds: [1, 2, 3, 4, 5], + expectedParamsLog: ['?page=foo', '?page=bar'], + }); + }); + + it('respects limit even when paginating', () => { + return testCaseV2List({ + pages: [ + {ids: [1, 2], next_page_url: '/v2/items?limit=5&page=a'}, + {ids: [3, 4], next_page_url: '/v2/items?limit=5&page=b'}, + {ids: [5, 6]}, + ], + limit: 5, + expectedIds: [1, 2, 3, 4, 5], + expectedParamsLog: ['?limit=5&page=a', '?limit=5&page=b'], + }); + }); + + it('paginates through multiple full pages', () => { + return testCaseV2List({ + pages: [ + {ids: [1, 2], next_page_url: '/v2/items?limit=10&page=wibble'}, + {ids: [3, 4], next_page_url: '/v2/items?limit=10&page=wobble'}, + {ids: [5, 6], next_page_url: '/v2/items?limit=10&page=weeble'}, + {ids: [7, 8], next_page_url: '/v2/items?limit=10&page=blubble'}, + {ids: [9, 10]}, + ], + limit: 10, + expectedIds: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], + expectedParamsLog: [ + '?limit=10&page=wibble', + '?limit=10&page=wobble', + '?limit=10&page=weeble', + '?limit=10&page=blubble', + ], + }); + }); + }); }); export {}; diff --git a/test/crypto/helpers.ts b/test/crypto/helpers.ts index a056283c6c..3e5a905224 100644 --- a/test/crypto/helpers.ts +++ b/test/crypto/helpers.ts @@ -57,5 +57,16 @@ export const createCryptoProviderTestSuite = ( }); } }); + + describe('computeSHA256Async', () => { + it('computes the hash', async () => { + const signature = await cryptoProvider.computeSHA256Async( + new Uint8Array([1, 2, 3, 4, 5]) + ); + expect(Buffer.from(signature).toString('base64')).to.equal( + 'dPgf4WfZm0y0HW0MzagieMrunz4vJdXlo5Nv89zsYNA=' + ); + }); + }); }); }; diff --git a/test/net/helpers.ts b/test/net/helpers.ts index 6154b86473..cdec2b0e5f 100644 --- a/test/net/helpers.ts +++ b/test/net/helpers.ts @@ -101,7 +101,7 @@ export const createHttpClientTestSuite = (createHttpClientFn, extraTestsFn) => { }); it('sends request data (POST)', (done) => { - const expectedData = utils.stringifyRequestData({id: 'test'}); + const expectedData = utils.queryStringifyRequestData({id: 'test'}); nock('http://stripe.com') .post('/test') diff --git a/test/resources/V2/Core/Events.spec.js b/test/resources/V2/Core/Events.spec.js new file mode 100644 index 0000000000..c565b22626 --- /dev/null +++ b/test/resources/V2/Core/Events.spec.js @@ -0,0 +1,209 @@ +'use strict'; + +const testUtils = require('../../../testUtils.js'); +const expect = require('chai').expect; + +const stripe = testUtils.getSpyableStripe(); + +const v2EventPayloadWithoutRelatedObject = ` + { + "context": "context", + "created": "1970-01-12T21:42:34.472Z", + "id": "obj_123", + "livemode": true, + "object":"v2.core.event", + "reason": + { + "type": "request", + "request": + { + "id": "obj_123", + "idempotency_key": "idempotency_key" + } + }, + "type": "type" + } +`; + +const v2EventPayloadWithRelatedObject = ` + { + "context": "context", + "created": "1970-01-12T21:42:34.472Z", + "id": "obj_123", + "livemode": true, + "object":"v2.core.event", + "reason": + { + "type": "request", + "request": + { + "id": "obj_123", + "idempotency_key": "idempotency_key" + } + }, + "type": "type", + "related_object": + { + "id": "obj_123", + "type": "thing", + "url": "/v1/things/obj_123" + } + } +`; + +describe('V2 Core Events Resource', () => { + describe('retrieve', () => { + it('Sends the correct request', () => { + stripe.v2.core.events.retrieve('eventIdBaz'); + expect(stripe.LAST_REQUEST).to.deep.equal({ + method: 'GET', + url: '/v2/core/events/eventIdBaz', + headers: {}, + data: null, + settings: {}, + }); + }); + + it('Does not have fetchRelatedObject if not needed', async () => { + const mockStripe = testUtils.createMockClient([ + { + method: 'GET', + path: '/v2/core/events/ll_123', + response: v2EventPayloadWithoutRelatedObject, + }, + ]); + const event = await mockStripe.v2.core.events.retrieve('ll_123'); + expect(event).ok; + expect(event.fetchRelatedObject).to.be.undefined; + }); + + it('Has fetchRelatedObject if needed', async () => { + const mockStripe = testUtils.createMockClient([ + { + method: 'GET', + path: '/v2/core/events/ll_123', + response: v2EventPayloadWithRelatedObject, + }, + ]); + const event = await mockStripe.v2.core.events.retrieve('ll_123'); + expect(event).ok; + expect(event.fetchRelatedObject).ok; + }); + + it('Can call fetchRelatedObject', async () => { + const mockStripe = testUtils.createMockClient([ + { + method: 'GET', + path: '/v2/core/events/ll_123', + response: v2EventPayloadWithRelatedObject, + }, + { + method: 'GET', + path: '/v1/things/obj_123', + response: '{"id": "obj_123"}', + }, + ]); + const event = await mockStripe.v2.core.events.retrieve('ll_123'); + expect(event).ok; + expect(event.fetchRelatedObject).ok; + const obj = await event.fetchRelatedObject(); + expect(obj.id).to.equal('obj_123'); + }); + }); + + describe('list', () => { + it('Sends the correct request', () => { + stripe.v2.core.events.list({object_id: 'foo'}); + expect(stripe.LAST_REQUEST).to.deep.equal({ + method: 'GET', + url: '/v2/core/events?object_id=foo', + headers: {}, + data: null, + settings: {}, + }); + }); + + it('Does not have fetchRelatedObject if not needed', async () => { + const mockStripe = testUtils.createMockClient([ + { + method: 'GET', + path: '/v2/core/events?object_id=foo', + response: `{ + "data": [ + ${v2EventPayloadWithoutRelatedObject}, + ${v2EventPayloadWithoutRelatedObject}, + ${v2EventPayloadWithoutRelatedObject} + ], + "next_page_url": null + }`, + }, + ]); + const resp = await mockStripe.v2.core.events.list({object_id: 'foo'}); + expect(resp).ok; + expect(resp.data.length).is.equal(3); + for (const event of resp.data) { + expect(event.fetchRelatedObject).not.ok; + } + }); + + it('Has fetchRelatedObject if needed', async () => { + const mockStripe = testUtils.createMockClient([ + { + method: 'GET', + path: '/v2/core/events?object_id=foo', + response: `{ + "data": [ + ${v2EventPayloadWithRelatedObject}, + ${v2EventPayloadWithRelatedObject}, + ${v2EventPayloadWithRelatedObject} + ], + "next_page_url": null + }`, + }, + ]); + const resp = await mockStripe.v2.core.events.list({object_id: 'foo'}); + expect(resp).ok; + expect(resp.data.length).is.equal(3); + for (const event of resp.data) { + expect(event.fetchRelatedObject).ok; + } + }); + + it('Has fetchRelatedObject added to autoPaginate results', async () => { + const mockStripe = testUtils.createMockClient([ + { + method: 'GET', + path: '/v2/core/events?object_id=foo', + response: `{ + "data": [ + ${v2EventPayloadWithRelatedObject}, + ${v2EventPayloadWithRelatedObject}, + ${v2EventPayloadWithRelatedObject} + ], + "next_page_url": "/next_page" + }`, + }, + { + method: 'GET', + path: '/next_page', + response: `{ + "data": [ + ${v2EventPayloadWithRelatedObject}, + ${v2EventPayloadWithRelatedObject}, + ${v2EventPayloadWithRelatedObject} + ], + "next_page_url": null + }`, + }, + ]); + const respProm = mockStripe.v2.core.events.list({object_id: 'foo'}); + expect(respProm).ok; + let totalEvents = 0; + await respProm.autoPagingEach(function(event) { + totalEvents += 1; + expect(event.fetchRelatedObject).ok; + }); + expect(totalEvents).is.equal(6); + }); + }); +}); diff --git a/test/resources/generated_examples_test.spec.js b/test/resources/generated_examples_test.spec.js index 8a87f2869d..823360d5bc 100644 --- a/test/resources/generated_examples_test.spec.js +++ b/test/resources/generated_examples_test.spec.js @@ -176,7 +176,7 @@ describe('Generated tests', function() { method: 'GET', path: '/v1/accounts/acc_123', response: - '{"business_profile":{"annual_revenue":{"amount":1413853096,"currency":"currency","fiscal_year_end":"fiscal_year_end"},"estimated_worker_count":884794319,"mcc":"mcc","monthly_estimated_revenue":{"amount":1413853096,"currency":"currency"},"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","amazon_pay_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","gb_bank_transfer_payments":"pending","giropay_payments":"active","grabpay_payments":"pending","ideal_payments":"inactive","india_international_payments":"inactive","jcb_payments":"inactive","jp_bank_transfer_payments":"pending","klarna_payments":"active","konbini_payments":"active","legacy_payments":"active","link_payments":"inactive","mobilepay_payments":"pending","multibanco_payments":"inactive","mx_bank_transfer_payments":"pending","oxxo_payments":"pending","p24_payments":"inactive","paynow_payments":"active","promptpay_payments":"active","revolut_pay_payments":"inactive","sepa_bank_transfer_payments":"pending","sepa_debit_payments":"inactive","sofort_payments":"active","swish_payments":"inactive","tax_reporting_us_1099_k":"inactive","tax_reporting_us_1099_misc":"pending","transfers":"inactive","treasury":"pending","twint_payments":"inactive","us_bank_account_ach_payments":"pending","us_bank_transfer_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,"export_license_id":"export_license_id","export_purpose_code":"export_purpose_code","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":"single_member_llc","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":"business_icon","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":"business_icon","size":3530753,"title":"title","type":"type","url":"url"}}}},"controller":{"fees":{"payer":"application"},"is_controller":true,"losses":{"payments":"stripe"},"requirement_collection":"application","stripe_dashboard":{"type":"express"},"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_failed_residential_address","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"id":"obj_123","individual":{"account":"account","additional_tos_acceptances":{"account":{"date":"3076014","ip":"ip","user_agent":"user_agent"}},"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_failed_residential_address","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,"legal_guardian":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_failed_residential_address","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":"business_icon","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":"business_icon","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":"business_icon","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":"business_icon","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_failed_residential_address","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"settings":{"bacs_debit_payments":{"display_name":"display_name","service_user_number":"service_user_number"},"branding":{"icon":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"business_icon","size":3530753,"title":"title","type":"type","url":"url"},"logo":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"business_icon","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"},"invoices":{"default_account_tax_ids":[{"country":"country","created":"1028554472","customer":{"address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"balance":339185956,"cash_balance":{"available":{"undefined":733902135},"customer":"customer","livemode":true,"object":"cash_balance","settings":{"reconciliation_mode":"manual","using_merchant_default":true}},"created":"1028554472","currency":"currency","default_source":null,"delinquent":true,"description":"description","discount":{"checkout_session":"checkout_session","coupon":null,"customer":null,"end":"100571","id":"obj_123","invoice":"invoice","invoice_item":"invoice_item","object":"discount","promotion_code":null,"start":"109757538","subscription":"subscription","subscription_item":"subscription_item"},"email":"email","id":"obj_123","invoice_credit_balance":{"undefined":1267696360},"invoice_prefix":"invoice_prefix","invoice_settings":{"custom_fields":[{"name":"name","value":"value"}],"default_payment_method":{"acss_debit":{"bank_name":"bank_name","fingerprint":"fingerprint","institution_number":"institution_number","last4":"last4","transit_number":"transit_number"},"affirm":{},"afterpay_clearpay":{},"alipay":{},"allow_redisplay":"unspecified","amazon_pay":{},"au_becs_debit":{"bsb_number":"bsb_number","fingerprint":"fingerprint","last4":"last4"},"bacs_debit":{"fingerprint":"fingerprint","last4":"last4","sort_code":"sort_code"},"bancontact":{},"billing_details":{"address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"email":"email","name":"name","phone":"phone"},"blik":{},"boleto":{"tax_id":"tax_id"},"card":{"brand":"brand","checks":{"address_line1_check":"address_line1_check","address_postal_code_check":"address_postal_code_check","cvc_check":"cvc_check"},"country":"country","description":"description","display_brand":"display_brand","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","generated_from":{"charge":"charge","payment_method_details":{"card_present":{"amount_authorized":1406151710,"brand":"brand","brand_product":"brand_product","capture_before":"2079401320","cardholder_name":"cardholder_name","country":"country","description":"description","emv_auth_data":"emv_auth_data","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","generated_card":"generated_card","iin":"iin","incremental_authorization_supported":true,"issuer":"issuer","last4":"last4","network":"network","network_transaction_id":"network_transaction_id","offline":{"stored_at":"1692436047","type":"deferred"},"overcapture_supported":true,"preferred_locales":["preferred_locales"],"read_method":"magnetic_stripe_track2","receipt":{"account_type":"checking","application_cryptogram":"application_cryptogram","application_preferred_name":"application_preferred_name","authorization_code":"authorization_code","authorization_response_code":"authorization_response_code","cardholder_verification_method":"cardholder_verification_method","dedicated_file_name":"dedicated_file_name","terminal_verification_results":"terminal_verification_results","transaction_status_information":"transaction_status_information"},"wallet":{"type":"samsung_pay"}},"type":"type"},"setup_attempt":null},"iin":"iin","issuer":"issuer","last4":"last4","networks":{"available":["available"],"preferred":"preferred"},"three_d_secure_usage":{"supported":true},"wallet":{"amex_express_checkout":{},"apple_pay":{},"dynamic_last4":"dynamic_last4","google_pay":{},"link":{},"masterpass":{"billing_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"email":"email","name":"name","shipping_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"}},"samsung_pay":{},"type":"link","visa_checkout":{"billing_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"email":"email","name":"name","shipping_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"}}}},"card_present":{"brand":"brand","brand_product":"brand_product","cardholder_name":"cardholder_name","country":"country","description":"description","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","iin":"iin","issuer":"issuer","last4":"last4","networks":{"available":["available"],"preferred":"preferred"},"offline":{"stored_at":"1692436047","type":"deferred"},"preferred_locales":["preferred_locales"],"read_method":"magnetic_stripe_track2","wallet":{"type":"samsung_pay"}},"cashapp":{"buyer_id":"buyer_id","cashtag":"cashtag"},"created":"1028554472","customer":null,"customer_balance":{},"eps":{"bank":"btv_vier_lander_bank"},"fpx":{"account_holder_type":"individual","bank":"bsn"},"giropay":{},"grabpay":{},"id":"obj_123","ideal":{"bank":"sns_bank","bic":"BUNQNL2A"},"interac_present":{"brand":"brand","cardholder_name":"cardholder_name","country":"country","description":"description","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","iin":"iin","issuer":"issuer","last4":"last4","networks":{"available":["available"],"preferred":"preferred"},"preferred_locales":["preferred_locales"],"read_method":"magnetic_stripe_track2"},"klarna":{"dob":{"day":99228,"month":104080000,"year":3704893}},"konbini":{},"link":{"email":"email","persistent_token":"persistent_token"},"livemode":true,"metadata":{"undefined":"metadata"},"mobilepay":{},"multibanco":{},"object":"payment_method","oxxo":{},"p24":{"bank":"noble_pay"},"paynow":{},"paypal":{"payer_email":"payer_email","payer_id":"payer_id"},"pix":{},"promptpay":{},"radar_options":{"session":"session"},"revolut_pay":{},"sepa_debit":{"bank_code":"bank_code","branch_code":"branch_code","country":"country","fingerprint":"fingerprint","generated_from":{"charge":null,"setup_attempt":null},"last4":"last4"},"sofort":{"country":"country"},"swish":{},"twint":{},"type":"cashapp","us_bank_account":{"account_holder_type":"individual","account_type":"checking","bank_name":"bank_name","financial_connections_account":"financial_connections_account","fingerprint":"fingerprint","last4":"last4","networks":{"preferred":"preferred","supported":["ach"]},"routing_number":"routing_number","status_details":{"blocked":{"network_code":"R29","reason":"bank_account_unusable"}}},"wechat_pay":{},"zip":{}},"footer":"footer","rendering_options":{"amount_tax_display":"amount_tax_display","template":"template"}},"livemode":true,"metadata":{"undefined":"metadata"},"name":"name","next_invoice_sequence":1356358751,"object":"customer","phone":"phone","preferred_locales":["preferred_locales"],"shipping":{"address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"carrier":"carrier","name":"name","phone":"phone","tracking_number":"tracking_number"},"sources":null,"subscriptions":null,"tax":{"automatic_tax":"unrecognized_location","ip_address":"ip_address","location":{"country":"country","source":"ip_address","state":"state"}},"tax_exempt":"reverse","tax_ids":null,"test_clock":{"created":"1028554472","deletes_after":"73213179","frozen_time":"2033541876","id":"obj_123","livemode":true,"name":"name","object":"test_helpers.test_clock","status":"advancing","status_details":{"advancing":{"target_frozen_time":"833971362"}}}},"id":"obj_123","livemode":true,"object":"tax_id","owner":{"account":{"business_profile":{"annual_revenue":{"amount":1413853096,"currency":"currency","fiscal_year_end":"fiscal_year_end"},"estimated_worker_count":884794319,"mcc":"mcc","monthly_estimated_revenue":{"amount":1413853096,"currency":"currency"},"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","amazon_pay_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","gb_bank_transfer_payments":"pending","giropay_payments":"active","grabpay_payments":"pending","ideal_payments":"inactive","india_international_payments":"inactive","jcb_payments":"inactive","jp_bank_transfer_payments":"pending","klarna_payments":"active","konbini_payments":"active","legacy_payments":"active","link_payments":"inactive","mobilepay_payments":"pending","multibanco_payments":"inactive","mx_bank_transfer_payments":"pending","oxxo_payments":"pending","p24_payments":"inactive","paynow_payments":"active","promptpay_payments":"active","revolut_pay_payments":"inactive","sepa_bank_transfer_payments":"pending","sepa_debit_payments":"inactive","sofort_payments":"active","swish_payments":"inactive","tax_reporting_us_1099_k":"inactive","tax_reporting_us_1099_misc":"pending","transfers":"inactive","treasury":"pending","twint_payments":"inactive","us_bank_account_ach_payments":"pending","us_bank_transfer_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,"export_license_id":"export_license_id","export_purpose_code":"export_purpose_code","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":"single_member_llc","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":"business_icon","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":"business_icon","size":3530753,"title":"title","type":"type","url":"url"}}}},"controller":{"fees":{"payer":"application"},"is_controller":true,"losses":{"payments":"stripe"},"requirement_collection":"application","stripe_dashboard":{"type":"express"},"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_failed_residential_address","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"id":"obj_123","individual":{"account":"account","additional_tos_acceptances":{"account":{"date":"3076014","ip":"ip","user_agent":"user_agent"}},"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_failed_residential_address","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,"legal_guardian":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_failed_residential_address","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":null,"details":"details","details_code":"details_code","front":null},"details":"details","details_code":"details_code","document":{"back":null,"details":"details","details_code":"details_code","front":null},"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_failed_residential_address","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"settings":{"bacs_debit_payments":{"display_name":"display_name","service_user_number":"service_user_number"},"branding":{"icon":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"business_icon","size":3530753,"title":"title","type":"type","url":"url"},"logo":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"business_icon","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"},"invoices":{"default_account_tax_ids":[{"country":"country","created":"1028554472","customer":null,"id":"obj_123","livemode":true,"object":"tax_id","owner":{"account":null,"application":null,"customer":null,"type":"customer"},"type":"sa_vat","value":"value","verification":{"status":"unverified","verified_address":"verified_address","verified_name":"verified_name"}}]},"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":"none"},"application":{"id":"obj_123","name":"name","object":"application"},"customer":{"address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"balance":339185956,"cash_balance":{"available":{"undefined":733902135},"customer":"customer","livemode":true,"object":"cash_balance","settings":{"reconciliation_mode":"manual","using_merchant_default":true}},"created":"1028554472","currency":"currency","default_source":null,"delinquent":true,"description":"description","discount":{"checkout_session":"checkout_session","coupon":null,"customer":null,"end":"100571","id":"obj_123","invoice":"invoice","invoice_item":"invoice_item","object":"discount","promotion_code":null,"start":"109757538","subscription":"subscription","subscription_item":"subscription_item"},"email":"email","id":"obj_123","invoice_credit_balance":{"undefined":1267696360},"invoice_prefix":"invoice_prefix","invoice_settings":{"custom_fields":[{"name":"name","value":"value"}],"default_payment_method":{"acss_debit":{"bank_name":"bank_name","fingerprint":"fingerprint","institution_number":"institution_number","last4":"last4","transit_number":"transit_number"},"affirm":{},"afterpay_clearpay":{},"alipay":{},"allow_redisplay":"unspecified","amazon_pay":{},"au_becs_debit":{"bsb_number":"bsb_number","fingerprint":"fingerprint","last4":"last4"},"bacs_debit":{"fingerprint":"fingerprint","last4":"last4","sort_code":"sort_code"},"bancontact":{},"billing_details":{"address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"email":"email","name":"name","phone":"phone"},"blik":{},"boleto":{"tax_id":"tax_id"},"card":{"brand":"brand","checks":{"address_line1_check":"address_line1_check","address_postal_code_check":"address_postal_code_check","cvc_check":"cvc_check"},"country":"country","description":"description","display_brand":"display_brand","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","generated_from":{"charge":"charge","payment_method_details":{"card_present":{"amount_authorized":1406151710,"brand":"brand","brand_product":"brand_product","capture_before":"2079401320","cardholder_name":"cardholder_name","country":"country","description":"description","emv_auth_data":"emv_auth_data","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","generated_card":"generated_card","iin":"iin","incremental_authorization_supported":true,"issuer":"issuer","last4":"last4","network":"network","network_transaction_id":"network_transaction_id","offline":{"stored_at":"1692436047","type":"deferred"},"overcapture_supported":true,"preferred_locales":["preferred_locales"],"read_method":"magnetic_stripe_track2","receipt":{"account_type":"checking","application_cryptogram":"application_cryptogram","application_preferred_name":"application_preferred_name","authorization_code":"authorization_code","authorization_response_code":"authorization_response_code","cardholder_verification_method":"cardholder_verification_method","dedicated_file_name":"dedicated_file_name","terminal_verification_results":"terminal_verification_results","transaction_status_information":"transaction_status_information"},"wallet":{"type":"samsung_pay"}},"type":"type"},"setup_attempt":null},"iin":"iin","issuer":"issuer","last4":"last4","networks":{"available":["available"],"preferred":"preferred"},"three_d_secure_usage":{"supported":true},"wallet":{"amex_express_checkout":{},"apple_pay":{},"dynamic_last4":"dynamic_last4","google_pay":{},"link":{},"masterpass":{"billing_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"email":"email","name":"name","shipping_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"}},"samsung_pay":{},"type":"link","visa_checkout":{"billing_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"email":"email","name":"name","shipping_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"}}}},"card_present":{"brand":"brand","brand_product":"brand_product","cardholder_name":"cardholder_name","country":"country","description":"description","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","iin":"iin","issuer":"issuer","last4":"last4","networks":{"available":["available"],"preferred":"preferred"},"offline":{"stored_at":"1692436047","type":"deferred"},"preferred_locales":["preferred_locales"],"read_method":"magnetic_stripe_track2","wallet":{"type":"samsung_pay"}},"cashapp":{"buyer_id":"buyer_id","cashtag":"cashtag"},"created":"1028554472","customer":null,"customer_balance":{},"eps":{"bank":"btv_vier_lander_bank"},"fpx":{"account_holder_type":"individual","bank":"bsn"},"giropay":{},"grabpay":{},"id":"obj_123","ideal":{"bank":"sns_bank","bic":"BUNQNL2A"},"interac_present":{"brand":"brand","cardholder_name":"cardholder_name","country":"country","description":"description","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","iin":"iin","issuer":"issuer","last4":"last4","networks":{"available":["available"],"preferred":"preferred"},"preferred_locales":["preferred_locales"],"read_method":"magnetic_stripe_track2"},"klarna":{"dob":{"day":99228,"month":104080000,"year":3704893}},"konbini":{},"link":{"email":"email","persistent_token":"persistent_token"},"livemode":true,"metadata":{"undefined":"metadata"},"mobilepay":{},"multibanco":{},"object":"payment_method","oxxo":{},"p24":{"bank":"noble_pay"},"paynow":{},"paypal":{"payer_email":"payer_email","payer_id":"payer_id"},"pix":{},"promptpay":{},"radar_options":{"session":"session"},"revolut_pay":{},"sepa_debit":{"bank_code":"bank_code","branch_code":"branch_code","country":"country","fingerprint":"fingerprint","generated_from":{"charge":null,"setup_attempt":null},"last4":"last4"},"sofort":{"country":"country"},"swish":{},"twint":{},"type":"cashapp","us_bank_account":{"account_holder_type":"individual","account_type":"checking","bank_name":"bank_name","financial_connections_account":"financial_connections_account","fingerprint":"fingerprint","last4":"last4","networks":{"preferred":"preferred","supported":["ach"]},"routing_number":"routing_number","status_details":{"blocked":{"network_code":"R29","reason":"bank_account_unusable"}}},"wechat_pay":{},"zip":{}},"footer":"footer","rendering_options":{"amount_tax_display":"amount_tax_display","template":"template"}},"livemode":true,"metadata":{"undefined":"metadata"},"name":"name","next_invoice_sequence":1356358751,"object":"customer","phone":"phone","preferred_locales":["preferred_locales"],"shipping":{"address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"carrier":"carrier","name":"name","phone":"phone","tracking_number":"tracking_number"},"sources":null,"subscriptions":null,"tax":{"automatic_tax":"unrecognized_location","ip_address":"ip_address","location":{"country":"country","source":"ip_address","state":"state"}},"tax_exempt":"reverse","tax_ids":null,"test_clock":{"created":"1028554472","deletes_after":"73213179","frozen_time":"2033541876","id":"obj_123","livemode":true,"name":"name","object":"test_helpers.test_clock","status":"advancing","status_details":{"advancing":{"target_frozen_time":"833971362"}}}},"type":"customer"},"type":"sa_vat","value":"value","verification":{"status":"unverified","verified_address":"verified_address","verified_name":"verified_name"}}]},"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":"none"}', + '{"business_profile":{"annual_revenue":{"amount":1413853096,"currency":"currency","fiscal_year_end":"fiscal_year_end"},"estimated_worker_count":884794319,"mcc":"mcc","monthly_estimated_revenue":{"amount":1413853096,"currency":"currency"},"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","alma_payments":"pending","amazon_pay_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","gb_bank_transfer_payments":"pending","giropay_payments":"active","grabpay_payments":"pending","ideal_payments":"inactive","india_international_payments":"inactive","jcb_payments":"inactive","jp_bank_transfer_payments":"pending","kakao_pay_payments":"active","klarna_payments":"active","konbini_payments":"active","kr_card_payments":"inactive","legacy_payments":"active","link_payments":"inactive","mobilepay_payments":"pending","multibanco_payments":"inactive","mx_bank_transfer_payments":"pending","naver_pay_payments":"active","oxxo_payments":"pending","p24_payments":"inactive","payco_payments":"inactive","paynow_payments":"active","promptpay_payments":"active","revolut_pay_payments":"inactive","samsung_pay_payments":"pending","sepa_bank_transfer_payments":"pending","sepa_debit_payments":"inactive","sofort_payments":"active","swish_payments":"inactive","tax_reporting_us_1099_k":"inactive","tax_reporting_us_1099_misc":"pending","transfers":"inactive","treasury":"pending","twint_payments":"inactive","us_bank_account_ach_payments":"pending","us_bank_transfer_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,"export_license_id":"export_license_id","export_purpose_code":"export_purpose_code","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":"single_member_llc","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":"dispute_evidence","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":"dispute_evidence","size":3530753,"title":"title","type":"type","url":"url"}}}},"controller":{"fees":{"payer":"application"},"is_controller":true,"losses":{"payments":"stripe"},"requirement_collection":"application","stripe_dashboard":{"type":"express"},"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":"rejected.listed","errors":[{"code":"verification_failed_residential_address","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"groups":{"payments_pricing":"payments_pricing"},"id":"obj_123","individual":{"account":"account","additional_tos_acceptances":{"account":{"date":"3076014","ip":"ip","user_agent":"user_agent"}},"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_failed_residential_address","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":{"authorizer":true,"director":true,"executive":true,"legal_guardian":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_failed_residential_address","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":"dispute_evidence","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":"dispute_evidence","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":"dispute_evidence","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":"dispute_evidence","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":"rejected.listed","errors":[{"code":"verification_failed_residential_address","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"settings":{"bacs_debit_payments":{"display_name":"display_name","service_user_number":"service_user_number"},"branding":{"icon":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"dispute_evidence","size":3530753,"title":"title","type":"type","url":"url"},"logo":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"dispute_evidence","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"},"invoices":{"default_account_tax_ids":[{"country":"country","created":"1028554472","customer":{"address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"balance":339185956,"cash_balance":{"available":{"undefined":733902135},"customer":"customer","livemode":true,"object":"cash_balance","settings":{"reconciliation_mode":"manual","using_merchant_default":true}},"created":"1028554472","currency":"currency","default_source":null,"delinquent":true,"description":"description","discount":{"checkout_session":"checkout_session","coupon":null,"customer":null,"end":"100571","id":"obj_123","invoice":"invoice","invoice_item":"invoice_item","object":"discount","promotion_code":null,"start":"109757538","subscription":"subscription","subscription_item":"subscription_item"},"email":"email","id":"obj_123","invoice_credit_balance":{"undefined":1267696360},"invoice_prefix":"invoice_prefix","invoice_settings":{"custom_fields":[{"name":"name","value":"value"}],"default_payment_method":{"acss_debit":{"bank_name":"bank_name","fingerprint":"fingerprint","institution_number":"institution_number","last4":"last4","transit_number":"transit_number"},"affirm":{},"afterpay_clearpay":{},"alipay":{},"allow_redisplay":"unspecified","alma":{},"amazon_pay":{},"au_becs_debit":{"bsb_number":"bsb_number","fingerprint":"fingerprint","last4":"last4"},"bacs_debit":{"fingerprint":"fingerprint","last4":"last4","sort_code":"sort_code"},"bancontact":{},"billing_details":{"address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"email":"email","name":"name","phone":"phone"},"blik":{},"boleto":{"tax_id":"tax_id"},"card":{"brand":"brand","checks":{"address_line1_check":"address_line1_check","address_postal_code_check":"address_postal_code_check","cvc_check":"cvc_check"},"country":"country","description":"description","display_brand":"display_brand","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","generated_from":{"charge":"charge","payment_method_details":{"card_present":{"amount_authorized":1406151710,"brand":"brand","brand_product":"brand_product","capture_before":"2079401320","cardholder_name":"cardholder_name","country":"country","description":"description","emv_auth_data":"emv_auth_data","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","generated_card":"generated_card","iin":"iin","incremental_authorization_supported":true,"issuer":"issuer","last4":"last4","network":"network","network_transaction_id":"network_transaction_id","offline":{"stored_at":"1692436047","type":"deferred"},"overcapture_supported":true,"preferred_locales":["preferred_locales"],"read_method":"magnetic_stripe_track2","receipt":{"account_type":"checking","application_cryptogram":"application_cryptogram","application_preferred_name":"application_preferred_name","authorization_code":"authorization_code","authorization_response_code":"authorization_response_code","cardholder_verification_method":"cardholder_verification_method","dedicated_file_name":"dedicated_file_name","terminal_verification_results":"terminal_verification_results","transaction_status_information":"transaction_status_information"},"wallet":{"type":"samsung_pay"}},"type":"type"},"setup_attempt":null},"iin":"iin","issuer":"issuer","last4":"last4","networks":{"available":["available"],"preferred":"preferred"},"regulated_status":"regulated","three_d_secure_usage":{"supported":true},"wallet":{"amex_express_checkout":{},"apple_pay":{},"dynamic_last4":"dynamic_last4","google_pay":{},"link":{},"masterpass":{"billing_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"email":"email","name":"name","shipping_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"}},"samsung_pay":{},"type":"link","visa_checkout":{"billing_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"email":"email","name":"name","shipping_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"}}}},"card_present":{"brand":"brand","brand_product":"brand_product","cardholder_name":"cardholder_name","country":"country","description":"description","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","iin":"iin","issuer":"issuer","last4":"last4","networks":{"available":["available"],"preferred":"preferred"},"offline":{"stored_at":"1692436047","type":"deferred"},"preferred_locales":["preferred_locales"],"read_method":"magnetic_stripe_track2","wallet":{"type":"samsung_pay"}},"cashapp":{"buyer_id":"buyer_id","cashtag":"cashtag"},"created":"1028554472","customer":null,"customer_balance":{},"eps":{"bank":"btv_vier_lander_bank"},"fpx":{"account_holder_type":"individual","bank":"bsn"},"giropay":{},"grabpay":{},"id":"obj_123","ideal":{"bank":"sns_bank","bic":"BUNQNL2A"},"interac_present":{"brand":"brand","cardholder_name":"cardholder_name","country":"country","description":"description","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","iin":"iin","issuer":"issuer","last4":"last4","networks":{"available":["available"],"preferred":"preferred"},"preferred_locales":["preferred_locales"],"read_method":"magnetic_stripe_track2"},"kakao_pay":{},"klarna":{"dob":{"day":99228,"month":104080000,"year":3704893}},"konbini":{},"kr_card":{"brand":"lotte","last4":"last4"},"link":{"email":"email","persistent_token":"persistent_token"},"livemode":true,"metadata":{"undefined":"metadata"},"mobilepay":{},"multibanco":{},"naver_pay":{"funding":"points"},"object":"payment_method","oxxo":{},"p24":{"bank":"noble_pay"},"payco":{},"paynow":{},"paypal":{"payer_email":"payer_email","payer_id":"payer_id"},"pix":{},"promptpay":{},"radar_options":{"session":"session"},"revolut_pay":{},"samsung_pay":{},"sepa_debit":{"bank_code":"bank_code","branch_code":"branch_code","country":"country","fingerprint":"fingerprint","generated_from":{"charge":null,"setup_attempt":null},"last4":"last4"},"sofort":{"country":"country"},"swish":{},"twint":{},"type":"acss_debit","us_bank_account":{"account_holder_type":"individual","account_type":"checking","bank_name":"bank_name","financial_connections_account":"financial_connections_account","fingerprint":"fingerprint","last4":"last4","networks":{"preferred":"preferred","supported":["ach"]},"routing_number":"routing_number","status_details":{"blocked":{"network_code":"R29","reason":"bank_account_unusable"}}},"wechat_pay":{},"zip":{}},"footer":"footer","rendering_options":{"amount_tax_display":"amount_tax_display","template":"template"}},"livemode":true,"metadata":{"undefined":"metadata"},"name":"name","next_invoice_sequence":1356358751,"object":"customer","phone":"phone","preferred_locales":["preferred_locales"],"shipping":{"address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"carrier":"carrier","name":"name","phone":"phone","tracking_number":"tracking_number"},"sources":null,"subscriptions":null,"tax":{"automatic_tax":"unrecognized_location","ip_address":"ip_address","location":{"country":"country","source":"ip_address","state":"state"}},"tax_exempt":"reverse","tax_ids":null,"test_clock":{"created":"1028554472","deletes_after":"73213179","frozen_time":"2033541876","id":"obj_123","livemode":true,"name":"name","object":"test_helpers.test_clock","status":"advancing","status_details":{"advancing":{"target_frozen_time":"833971362"}}}},"id":"obj_123","livemode":true,"object":"tax_id","owner":{"account":{"business_profile":{"annual_revenue":{"amount":1413853096,"currency":"currency","fiscal_year_end":"fiscal_year_end"},"estimated_worker_count":884794319,"mcc":"mcc","monthly_estimated_revenue":{"amount":1413853096,"currency":"currency"},"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","alma_payments":"pending","amazon_pay_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","gb_bank_transfer_payments":"pending","giropay_payments":"active","grabpay_payments":"pending","ideal_payments":"inactive","india_international_payments":"inactive","jcb_payments":"inactive","jp_bank_transfer_payments":"pending","kakao_pay_payments":"active","klarna_payments":"active","konbini_payments":"active","kr_card_payments":"inactive","legacy_payments":"active","link_payments":"inactive","mobilepay_payments":"pending","multibanco_payments":"inactive","mx_bank_transfer_payments":"pending","naver_pay_payments":"active","oxxo_payments":"pending","p24_payments":"inactive","payco_payments":"inactive","paynow_payments":"active","promptpay_payments":"active","revolut_pay_payments":"inactive","samsung_pay_payments":"pending","sepa_bank_transfer_payments":"pending","sepa_debit_payments":"inactive","sofort_payments":"active","swish_payments":"inactive","tax_reporting_us_1099_k":"inactive","tax_reporting_us_1099_misc":"pending","transfers":"inactive","treasury":"pending","twint_payments":"inactive","us_bank_account_ach_payments":"pending","us_bank_transfer_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,"export_license_id":"export_license_id","export_purpose_code":"export_purpose_code","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":"single_member_llc","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":"dispute_evidence","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":"dispute_evidence","size":3530753,"title":"title","type":"type","url":"url"}}}},"controller":{"fees":{"payer":"application"},"is_controller":true,"losses":{"payments":"stripe"},"requirement_collection":"application","stripe_dashboard":{"type":"express"},"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":"rejected.listed","errors":[{"code":"verification_failed_residential_address","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"groups":{"payments_pricing":"payments_pricing"},"id":"obj_123","individual":{"account":"account","additional_tos_acceptances":{"account":{"date":"3076014","ip":"ip","user_agent":"user_agent"}},"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_failed_residential_address","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":{"authorizer":true,"director":true,"executive":true,"legal_guardian":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_failed_residential_address","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":null,"details":"details","details_code":"details_code","front":null},"details":"details","details_code":"details_code","document":{"back":null,"details":"details","details_code":"details_code","front":null},"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":"rejected.listed","errors":[{"code":"verification_failed_residential_address","reason":"reason","requirement":"requirement"}],"eventually_due":["eventually_due"],"past_due":["past_due"],"pending_verification":["pending_verification"]},"settings":{"bacs_debit_payments":{"display_name":"display_name","service_user_number":"service_user_number"},"branding":{"icon":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"dispute_evidence","size":3530753,"title":"title","type":"type","url":"url"},"logo":{"created":"1028554472","expires_at":"833811170","filename":"filename","id":"obj_123","links":null,"object":"file","purpose":"dispute_evidence","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"},"invoices":{"default_account_tax_ids":[{"country":"country","created":"1028554472","customer":null,"id":"obj_123","livemode":true,"object":"tax_id","owner":{"account":null,"application":null,"customer":null,"type":"customer"},"type":"ba_tin","value":"value","verification":{"status":"unverified","verified_address":"verified_address","verified_name":"verified_name"}}]},"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":"none"},"application":{"id":"obj_123","name":"name","object":"application"},"customer":{"address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"balance":339185956,"cash_balance":{"available":{"undefined":733902135},"customer":"customer","livemode":true,"object":"cash_balance","settings":{"reconciliation_mode":"manual","using_merchant_default":true}},"created":"1028554472","currency":"currency","default_source":null,"delinquent":true,"description":"description","discount":{"checkout_session":"checkout_session","coupon":null,"customer":null,"end":"100571","id":"obj_123","invoice":"invoice","invoice_item":"invoice_item","object":"discount","promotion_code":null,"start":"109757538","subscription":"subscription","subscription_item":"subscription_item"},"email":"email","id":"obj_123","invoice_credit_balance":{"undefined":1267696360},"invoice_prefix":"invoice_prefix","invoice_settings":{"custom_fields":[{"name":"name","value":"value"}],"default_payment_method":{"acss_debit":{"bank_name":"bank_name","fingerprint":"fingerprint","institution_number":"institution_number","last4":"last4","transit_number":"transit_number"},"affirm":{},"afterpay_clearpay":{},"alipay":{},"allow_redisplay":"unspecified","alma":{},"amazon_pay":{},"au_becs_debit":{"bsb_number":"bsb_number","fingerprint":"fingerprint","last4":"last4"},"bacs_debit":{"fingerprint":"fingerprint","last4":"last4","sort_code":"sort_code"},"bancontact":{},"billing_details":{"address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"email":"email","name":"name","phone":"phone"},"blik":{},"boleto":{"tax_id":"tax_id"},"card":{"brand":"brand","checks":{"address_line1_check":"address_line1_check","address_postal_code_check":"address_postal_code_check","cvc_check":"cvc_check"},"country":"country","description":"description","display_brand":"display_brand","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","generated_from":{"charge":"charge","payment_method_details":{"card_present":{"amount_authorized":1406151710,"brand":"brand","brand_product":"brand_product","capture_before":"2079401320","cardholder_name":"cardholder_name","country":"country","description":"description","emv_auth_data":"emv_auth_data","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","generated_card":"generated_card","iin":"iin","incremental_authorization_supported":true,"issuer":"issuer","last4":"last4","network":"network","network_transaction_id":"network_transaction_id","offline":{"stored_at":"1692436047","type":"deferred"},"overcapture_supported":true,"preferred_locales":["preferred_locales"],"read_method":"magnetic_stripe_track2","receipt":{"account_type":"checking","application_cryptogram":"application_cryptogram","application_preferred_name":"application_preferred_name","authorization_code":"authorization_code","authorization_response_code":"authorization_response_code","cardholder_verification_method":"cardholder_verification_method","dedicated_file_name":"dedicated_file_name","terminal_verification_results":"terminal_verification_results","transaction_status_information":"transaction_status_information"},"wallet":{"type":"samsung_pay"}},"type":"type"},"setup_attempt":null},"iin":"iin","issuer":"issuer","last4":"last4","networks":{"available":["available"],"preferred":"preferred"},"regulated_status":"regulated","three_d_secure_usage":{"supported":true},"wallet":{"amex_express_checkout":{},"apple_pay":{},"dynamic_last4":"dynamic_last4","google_pay":{},"link":{},"masterpass":{"billing_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"email":"email","name":"name","shipping_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"}},"samsung_pay":{},"type":"link","visa_checkout":{"billing_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"email":"email","name":"name","shipping_address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"}}}},"card_present":{"brand":"brand","brand_product":"brand_product","cardholder_name":"cardholder_name","country":"country","description":"description","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","iin":"iin","issuer":"issuer","last4":"last4","networks":{"available":["available"],"preferred":"preferred"},"offline":{"stored_at":"1692436047","type":"deferred"},"preferred_locales":["preferred_locales"],"read_method":"magnetic_stripe_track2","wallet":{"type":"samsung_pay"}},"cashapp":{"buyer_id":"buyer_id","cashtag":"cashtag"},"created":"1028554472","customer":null,"customer_balance":{},"eps":{"bank":"btv_vier_lander_bank"},"fpx":{"account_holder_type":"individual","bank":"bsn"},"giropay":{},"grabpay":{},"id":"obj_123","ideal":{"bank":"sns_bank","bic":"BUNQNL2A"},"interac_present":{"brand":"brand","cardholder_name":"cardholder_name","country":"country","description":"description","exp_month":40417826,"exp_year":1940618977,"fingerprint":"fingerprint","funding":"funding","iin":"iin","issuer":"issuer","last4":"last4","networks":{"available":["available"],"preferred":"preferred"},"preferred_locales":["preferred_locales"],"read_method":"magnetic_stripe_track2"},"kakao_pay":{},"klarna":{"dob":{"day":99228,"month":104080000,"year":3704893}},"konbini":{},"kr_card":{"brand":"lotte","last4":"last4"},"link":{"email":"email","persistent_token":"persistent_token"},"livemode":true,"metadata":{"undefined":"metadata"},"mobilepay":{},"multibanco":{},"naver_pay":{"funding":"points"},"object":"payment_method","oxxo":{},"p24":{"bank":"noble_pay"},"payco":{},"paynow":{},"paypal":{"payer_email":"payer_email","payer_id":"payer_id"},"pix":{},"promptpay":{},"radar_options":{"session":"session"},"revolut_pay":{},"samsung_pay":{},"sepa_debit":{"bank_code":"bank_code","branch_code":"branch_code","country":"country","fingerprint":"fingerprint","generated_from":{"charge":null,"setup_attempt":null},"last4":"last4"},"sofort":{"country":"country"},"swish":{},"twint":{},"type":"acss_debit","us_bank_account":{"account_holder_type":"individual","account_type":"checking","bank_name":"bank_name","financial_connections_account":"financial_connections_account","fingerprint":"fingerprint","last4":"last4","networks":{"preferred":"preferred","supported":["ach"]},"routing_number":"routing_number","status_details":{"blocked":{"network_code":"R29","reason":"bank_account_unusable"}}},"wechat_pay":{},"zip":{}},"footer":"footer","rendering_options":{"amount_tax_display":"amount_tax_display","template":"template"}},"livemode":true,"metadata":{"undefined":"metadata"},"name":"name","next_invoice_sequence":1356358751,"object":"customer","phone":"phone","preferred_locales":["preferred_locales"],"shipping":{"address":{"city":"city","country":"country","line1":"line1","line2":"line2","postal_code":"postal_code","state":"state"},"carrier":"carrier","name":"name","phone":"phone","tracking_number":"tracking_number"},"sources":null,"subscriptions":null,"tax":{"automatic_tax":"unrecognized_location","ip_address":"ip_address","location":{"country":"country","source":"ip_address","state":"state"}},"tax_exempt":"reverse","tax_ids":null,"test_clock":{"created":"1028554472","deletes_after":"73213179","frozen_time":"2033541876","id":"obj_123","livemode":true,"name":"name","object":"test_helpers.test_clock","status":"advancing","status_details":{"advancing":{"target_frozen_time":"833971362"}}}},"type":"customer"},"type":"ba_tin","value":"value","verification":{"status":"unverified","verified_address":"verified_address","verified_name":"verified_name"}}]},"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":"none"}', }, ]); const account = await stripe.accounts.retrieve('acc_123'); @@ -567,6 +567,19 @@ describe('Generated tests', function() { expect(session).not.to.be.null; }); + it('test_core_events_get', async function() { + const stripe = testUtils.createMockClient([ + { + method: 'GET', + path: '/v2/core/events/ll_123', + response: + '{"context":"context","created":"1970-01-12T21:42:34.472Z","id":"obj_123","livemode":true,"object":"v2.core.event","reason":{"type":"request","request":{"id":"obj_123","idempotency_key":"idempotency_key"}},"type":"type"}', + }, + ]); + const event = await stripe.v2.core.events.retrieve('ll_123'); + expect(event).not.to.be.null; + }); + it('test_country_specs_get', async function() { const countrySpecs = await stripe.countrySpecs.list({ limit: 3, @@ -2988,17 +3001,6 @@ describe('Generated tests', function() { expect(reader).not.to.be.null; }); - it('test_terminal_readers_process_setup_intent_post', async function() { - const reader = await stripe.terminal.readers.processSetupIntent( - 'tmr_xxxxxxxxxxxxx', - { - setup_intent: 'seti_xxxxxxxxxxxxx', - customer_consent_collected: true, - } - ); - expect(reader).not.to.be.null; - }); - it('test_test_helpers_customers_fund_cash_balance_post', async function() { const customerCashBalanceTransaction = await stripe.testHelpers.customers.fundCashBalance( 'cus_123', diff --git a/test/stripe.spec.ts b/test/stripe.spec.ts index 79d702bf92..69c840e71e 100644 --- a/test/stripe.spec.ts +++ b/test/stripe.spec.ts @@ -4,14 +4,16 @@ 'use strict'; import {expect} from 'chai'; +import {StripeSignatureVerificationError} from '../src/Error.js'; import {ApiVersion} from '../src/apiVersion.js'; import {createStripe} from '../src/stripe.core.js'; +import {createApiKeyAuthenticator} from '../src/utils.js'; import { + FAKE_API_KEY, getMockPlatformFunctions, getRandomString, - getTestServerStripe, getStripeMockClient, - FAKE_API_KEY, + getTestServerStripe, } from './testUtils.js'; import Stripe = require('../src/stripe.cjs.node.js'); import crypto = require('crypto'); @@ -65,7 +67,7 @@ describe('Stripe Module', function() { }).to.not.throw(); }); - it('should perform a no-op if null, undefined or empty values are passed', () => { + it('API should use the default version when undefined or empty values are passed', () => { const cases = [null, undefined, '', {}]; cases.forEach((item) => { @@ -108,7 +110,32 @@ describe('Stripe Module', function() { describe('setApiKey', () => { it('uses Bearer auth', () => { - expect(stripe.getApiField('auth')).to.equal(`Bearer ${FAKE_API_KEY}`); + expect(stripe._authenticator._apiKey).to.equal(`${FAKE_API_KEY}`); + }); + + it('should throw if no api key or authenticator provided', () => { + expect(() => new Stripe(null)).to.throw( + 'Neither apiKey nor config.authenticator provided' + ); + }); + }); + + describe('authenticator', () => { + it('should throw an error when specifying both key and authenticator', () => { + expect(() => { + return new Stripe('key', { + authenticator: createApiKeyAuthenticator('...'), + }); + }).to.throw("Can't specify both apiKey and authenticator"); + }); + + it('can create client using authenticator', () => { + const authenticator = createApiKeyAuthenticator('...'); + const stripe = new Stripe(null, { + authenticator: authenticator, + }); + + expect(stripe._authenticator).to.equal(authenticator); }); }); @@ -529,6 +556,117 @@ describe('Stripe Module', function() { ); }); }); + describe('gets removed', () => { + let headers; + let stripeClient; + let closeServer; + beforeEach((callback) => { + getTestServerStripe( + {}, + (req, res) => { + headers = req.headers; + res.writeHeader(200); + res.write('{}'); + res.end(); + }, + (err, client, close) => { + if (err) { + return callback(err); + } + stripeClient = client; + closeServer = close; + return callback(); + } + ); + }); + afterEach(() => closeServer()); + + it('if explicitly undefined', (callback) => { + stripeClient.customers.create({stripeAccount: undefined}, (err) => { + closeServer(); + if (err) { + return callback(err); + } + expect(Object.keys(headers)).not.to.include('stripe-account'); + return callback(); + }); + }); + + it('if explicitly null', (callback) => { + stripeClient.customers.create({stripeAccount: null}, (err) => { + closeServer(); + if (err) { + return callback(err); + } + expect(Object.keys(headers)).not.to.include('stripe-account'); + return callback(); + }); + }); + }); + }); + + describe('context', () => { + describe('when passed in via the config object', () => { + let headers; + let stripeClient; + let closeServer; + beforeEach((callback) => { + getTestServerStripe( + { + stripeContext: 'ctx_123', + }, + (req, res) => { + headers = req.headers; + res.writeHeader(200); + res.write('{}'); + res.end(); + }, + (err, client, close) => { + if (err) { + return callback(err); + } + stripeClient = client; + closeServer = close; + return callback(); + } + ); + }); + afterEach(() => closeServer()); + it('is not sent on v1 call', (callback) => { + stripeClient.customers.create((err) => { + closeServer(); + if (err) { + return callback(err); + } + expect(headers['stripe-context']).to.equal(undefined); + return callback(); + }); + }); + it('is respected', (callback) => { + stripeClient.v2.billing.meterEventSession.create((err) => { + closeServer(); + if (err) { + return callback(err); + } + expect(headers['stripe-context']).to.equal('ctx_123'); + return callback(); + }); + }); + it('can still be overridden per-request', (callback) => { + stripeClient.v2.billing.meterEventSession.create( + {name: 'llama'}, + {stripeContext: 'ctx_456'}, + (err) => { + closeServer(); + if (err) { + return callback(err); + } + expect(headers['stripe-context']).to.equal('ctx_456'); + return callback(); + } + ); + }); + }); }); describe('setMaxNetworkRetries', () => { @@ -545,12 +683,12 @@ describe('Stripe Module', function() { }); describe('when passed in via the config object', () => { - it('should default to 1 if a non-integer is passed', () => { + it('should default to 2 if a non-integer is passed', () => { const newStripe = Stripe(FAKE_API_KEY, { maxNetworkRetries: 'foo', }); - expect(newStripe.getMaxNetworkRetries()).to.equal(1); + expect(newStripe.getMaxNetworkRetries()).to.equal(2); expect(() => { Stripe(FAKE_API_KEY, { @@ -572,7 +710,7 @@ describe('Stripe Module', function() { it('should use the default', () => { const newStripe = Stripe(FAKE_API_KEY); - expect(newStripe.getMaxNetworkRetries()).to.equal(1); + expect(newStripe.getMaxNetworkRetries()).to.equal(2); }); }); }); @@ -584,4 +722,243 @@ describe('Stripe Module', function() { expect(newStripe.VERSION).to.equal(Stripe.PACKAGE_VERSION); }); }); + + describe('parseThinEvent', () => { + const secret = 'whsec_test_secret'; + + it('can parse event from JSON payload', () => { + const jsonPayload = { + type: 'account.created', + data: 'hello', + related_object: {id: '123', url: 'hello_again'}, + }; + const payload = JSON.stringify(jsonPayload); + const header = stripe.webhooks.generateTestHeaderString({ + payload, + secret, + }); + const event = stripe.parseThinEvent(payload, header, secret); + + expect(event.type).to.equal(jsonPayload.type); + expect(event.data).to.equal(jsonPayload.data); + expect(event.related_object.id).to.equal(jsonPayload.related_object.id); + }); + + it('throws an error for invalid signatures', () => { + const payload = JSON.stringify({event_type: 'account.created'}); + + expect(() => { + stripe.parseThinEvent(payload, 'bad sigheader', secret); + }).to.throw(StripeSignatureVerificationError); + }); + }); + + describe('rawRequest', () => { + const returnedCustomer = { + id: 'cus_123', + }; + + it('should make request with specified encoding FORM', (done) => { + return getTestServerStripe( + {}, + (req, res) => { + expect(req.headers['content-type']).to.equal( + 'application/x-www-form-urlencoded' + ); + expect(req.headers['stripe-version']).to.equal(ApiVersion); + const requestBody = []; + req.on('data', (chunks) => { + requestBody.push(chunks); + }); + req.on('end', () => { + const body = Buffer.concat(requestBody).toString(); + expect(body).to.equal('description=test%20customer'); + }); + res.write(JSON.stringify(returnedCustomer)); + res.end(); + }, + async (err, stripe, closeServer) => { + if (err) return done(err); + try { + const result = await stripe.rawRequest( + 'POST', + '/v1/customers', + {description: 'test customer'}, + {} + ); + expect(result).to.deep.equal(returnedCustomer); + closeServer(); + done(); + } catch (err) { + return done(err); + } + } + ); + }); + + it('should make request with specified encoding JSON', (done) => { + return getTestServerStripe( + {}, + (req, res) => { + expect(req.headers['content-type']).to.equal('application/json'); + expect(req.headers['stripe-version']).to.equal(ApiVersion); + expect(req.headers.foo).to.equal('bar'); + const requestBody = []; + req.on('data', (chunks) => { + requestBody.push(chunks); + }); + req.on('end', () => { + const body = Buffer.concat(requestBody).toString(); + expect(body).to.equal( + '{"description":"test meter event","created":"1234567890"}' + ); + }); + res.write(JSON.stringify(returnedCustomer)); + res.end(); + }, + async (err, stripe, closeServer) => { + if (err) return done(err); + try { + const result = await stripe.rawRequest( + 'POST', + '/v2/billing/meter_events', + { + description: 'test meter event', + created: new Date('2009-02-13T23:31:30Z'), + }, + {additionalHeaders: {foo: 'bar'}} + ); + expect(result).to.deep.equal(returnedCustomer); + closeServer(); + done(); + } catch (err) { + return done(err); + } + } + ); + }); + + it('defaults to form encoding request if not specified', (done) => { + return getTestServerStripe( + {}, + (req, res) => { + expect(req.headers['content-type']).to.equal( + 'application/x-www-form-urlencoded' + ); + const requestBody = []; + req.on('data', (chunks) => { + requestBody.push(chunks); + }); + req.on('end', () => { + const body = Buffer.concat(requestBody).toString(); + expect(body).to.equal( + 'description=test%20customer&created=1234567890' + ); + }); + res.write(JSON.stringify(returnedCustomer)); + res.end(); + }, + async (err, stripe, closeServer) => { + if (err) return done(err); + try { + const result = await stripe.rawRequest('POST', '/v1/customers', { + description: 'test customer', + created: new Date('2009-02-13T23:31:30Z'), + }); + expect(result).to.deep.equal(returnedCustomer); + closeServer(); + done(); + } catch (err) { + return done(err); + } + } + ); + }); + + it('should make request with specified additional headers', (done) => { + return getTestServerStripe( + {}, + (req, res) => { + console.log(req.headers); + expect(req.headers.foo).to.equal('bar'); + res.write(JSON.stringify(returnedCustomer)); + res.end(); + }, + async (err, stripe, closeServer) => { + if (err) return done(err); + try { + const result = await stripe.rawRequest( + 'GET', + '/v1/customers/cus_123', + {}, + {additionalHeaders: {foo: 'bar'}} + ); + expect(result).to.deep.equal(returnedCustomer); + closeServer(); + done(); + } catch (err) { + return done(err); + } + } + ); + }); + + it('should make request successfully', async () => { + const response = await stripe.rawRequest('GET', '/v1/customers', {}); + + expect(response).to.have.property('object', 'list'); + }); + + it("should include 'raw_request' in usage telemetry", (done) => { + let telemetryHeader; + let shouldStayOpen = true; + return getTestServerStripe( + {}, + (req, res) => { + telemetryHeader = req.headers['x-stripe-client-telemetry']; + res.setHeader('Request-Id', `req_1`); + res.writeHeader(200); + res.write('{}'); + res.end(); + const ret = {shouldStayOpen}; + shouldStayOpen = false; + return ret; + }, + async (err, stripe, closeServer) => { + if (err) return done(err); + try { + await stripe.rawRequest( + 'POST', + '/v1/customers', + {description: 'test customer'}, + {} + ); + expect(telemetryHeader).to.equal(undefined); + await stripe.rawRequest( + 'POST', + '/v1/customers', + {description: 'test customer'}, + {} + ); + expect( + JSON.parse(telemetryHeader).last_request_metrics.usage + ).to.deep.equal(['raw_request']); + closeServer(); + done(); + } catch (err) { + return done(err); + } + } + ); + }); + + it('should throw error when passing in params to non-POST request', async () => { + await expect( + stripe.rawRequest('GET', '/v1/customers/cus_123', {foo: 'bar'}) + ).to.be.rejectedWith( + Error, + /rawRequest only supports params on POST requests. Please pass null and add your parameters to path./ + ); + }); + }); }); diff --git a/test/testUtils.ts b/test/testUtils.ts index 4d798ec6f7..f75ae08e87 100644 --- a/test/testUtils.ts +++ b/test/testUtils.ts @@ -8,6 +8,7 @@ import {NodePlatformFunctions} from '../src/platform/NodePlatformFunctions.js'; import {RequestSender} from '../src/RequestSender.js'; import {createStripe} from '../src/stripe.core.js'; import { + RequestAuthenticator, RequestCallback, RequestData, RequestDataProcessor, @@ -70,7 +71,7 @@ export const getStripeMockClient = (): StripeClient => { path: string, method: string, headers: RequestHeaders, - requestData: RequestData, + requestData: string, _protocol: string, timeout: number ): Promise { @@ -115,8 +116,8 @@ export const getMockStripe = ( host: string | null, path: string, data: RequestData, - auth: string | null, - options: RequestOptions = {}, + authenticator: RequestAuthenticator, + options: RequestOptions = {} as any, usage: Array, callback: RequestCallback, requestDataProcessor: RequestDataProcessor | null = null @@ -126,7 +127,7 @@ export const getMockStripe = ( host, path, data, - auth, + authenticator, options, usage, callback, @@ -157,7 +158,7 @@ export const createMockClient = ( throw new Error(`Unable to find a mock request for ${method} ${path}`); } - callback(null, Promise.resolve(JSON.parse(request.response))); + callback(null, JSON.parse(request.response)); }); }; @@ -170,8 +171,8 @@ export const getSpyableStripe = ( host: string | null, path: string, data: RequestData, - auth: string | null, - options: RequestOptions = {}, + authenticator: RequestAuthenticator, + options: RequestOptions = {} as any, usage: Array = [], callback: RequestCallback, requestDataProcessor: RequestDataProcessor | null = null @@ -183,6 +184,7 @@ export const getSpyableStripe = ( headers: RequestHeaders; settings: RequestSettings; auth?: string; + authenticator?: RequestAuthenticator; host?: string; usage?: Array; }; @@ -196,8 +198,13 @@ export const getSpyableStripe = ( if (usage && usage.length > 1) { req.usage = usage; } - if (auth) { - req.auth = auth; + if (authenticator) { + // Extract API key from the api-key authenticator + if ((authenticator as any)._apiKey) { + req.auth = (authenticator as any)._apiKey; + } else { + req.authenticator = authenticator; + } } if (host) { req.host = host; @@ -222,7 +229,7 @@ export const getSpyableStripe = ( host, path, data, - auth, + authenticator, options, usage, callback, diff --git a/test/utils.spec.ts b/test/utils.spec.ts index 248d8ee92b..b2437d9c76 100644 --- a/test/utils.spec.ts +++ b/test/utils.spec.ts @@ -28,10 +28,10 @@ describe('utils', () => { }); }); - describe('stringifyRequestData', () => { + describe('queryStringifyRequestData', () => { it('Handles basic types', () => { expect( - utils.stringifyRequestData({ + utils.queryStringifyRequestData({ a: 1, b: 'foo', }) @@ -40,7 +40,7 @@ describe('utils', () => { it('Handles Dates', () => { expect( - utils.stringifyRequestData({ + utils.queryStringifyRequestData({ date: new Date('2009-02-13T23:31:30Z'), created: { gte: new Date('2009-02-13T23:31:30Z'), @@ -58,7 +58,7 @@ describe('utils', () => { it('Handles deeply nested object', () => { expect( - utils.stringifyRequestData({ + utils.queryStringifyRequestData({ a: { b: { c: { @@ -72,7 +72,7 @@ describe('utils', () => { it('Handles arrays of objects', () => { expect( - utils.stringifyRequestData({ + utils.queryStringifyRequestData({ a: [{b: 'c'}, {b: 'd'}], }) ).to.equal('a[0][b]=c&a[1][b]=d'); @@ -80,7 +80,7 @@ describe('utils', () => { it('Handles indexed arrays', () => { expect( - utils.stringifyRequestData({ + utils.queryStringifyRequestData({ a: { 0: {b: 'c'}, 1: {b: 'd'}, @@ -91,7 +91,7 @@ describe('utils', () => { it('Creates a string from an object, handling shallow nested objects', () => { expect( - utils.stringifyRequestData({ + utils.queryStringifyRequestData({ test: 1, foo: 'baz', somethingElse: '::""%&', @@ -110,6 +110,17 @@ describe('utils', () => { ].join('&') ); }); + + it('Handles v2 arrays', () => { + expect( + utils.queryStringifyRequestData( + { + include: ['a', 'b'], + }, + 'v2' + ) + ).to.equal('include=a&include=b'); + }); }); describe('protoExtend', () => { @@ -183,7 +194,6 @@ describe('utils', () => { describe('getOptsFromArgs', () => { it('handles an empty list', () => { expect(utils.getOptionsFromArgs([])).to.deep.equal({ - auth: null, host: null, headers: {}, settings: {}, @@ -193,7 +203,6 @@ describe('utils', () => { it('handles an list with no object', () => { const args = [1, 3]; expect(utils.getOptionsFromArgs(args)).to.deep.equal({ - auth: null, host: null, headers: {}, settings: {}, @@ -204,7 +213,6 @@ describe('utils', () => { it('ignores a non-options object', () => { const args = [{foo: 'bar'}]; expect(utils.getOptionsFromArgs(args)).to.deep.equal({ - auth: null, host: null, headers: {}, settings: {}, @@ -214,30 +222,33 @@ describe('utils', () => { it('parses an api key', () => { const args = ['sk_test_iiiiiiiiiiiiiiiiiiiiiiii']; - expect(utils.getOptionsFromArgs(args)).to.deep.equal({ - auth: 'sk_test_iiiiiiiiiiiiiiiiiiiiiiii', + const options = utils.getOptionsFromArgs(args); + expect(options).to.deep.contain({ host: null, headers: {}, settings: {}, }); expect(args.length).to.equal(0); + expect(options.authenticator._apiKey).to.equal( + 'sk_test_iiiiiiiiiiiiiiiiiiiiiiii' + ); }); it('assumes any string is an api key', () => { const args = ['yolo']; - expect(utils.getOptionsFromArgs(args)).to.deep.equal({ - auth: 'yolo', + const options = utils.getOptionsFromArgs(args); + expect(options).to.deep.contain({ host: null, headers: {}, settings: {}, }); expect(args.length).to.equal(0); + expect(options.authenticator._apiKey).to.equal('yolo'); }); it('parses an idempotency key', () => { const args = [{foo: 'bar'}, {idempotencyKey: 'foo'}]; expect(utils.getOptionsFromArgs(args)).to.deep.equal({ - auth: null, host: null, headers: {'Idempotency-Key': 'foo'}, settings: {}, @@ -248,7 +259,6 @@ describe('utils', () => { it('parses an api version', () => { const args = [{foo: 'bar'}, {apiVersion: '2003-03-30'}]; expect(utils.getOptionsFromArgs(args)).to.deep.equal({ - auth: null, host: null, headers: {'Stripe-Version': '2003-03-30'}, settings: {}, @@ -265,8 +275,8 @@ describe('utils', () => { apiVersion: '2010-01-10', }, ]; - expect(utils.getOptionsFromArgs(args)).to.deep.equal({ - auth: 'sk_test_iiiiiiiiiiiiiiiiiiiiiiii', + const options = utils.getOptionsFromArgs(args); + expect(options).to.deep.contains({ host: null, headers: { 'Idempotency-Key': 'foo', @@ -275,6 +285,9 @@ describe('utils', () => { settings: {}, }); expect(args.length).to.equal(1); + expect(options.authenticator._apiKey).to.equal( + 'sk_test_iiiiiiiiiiiiiiiiiiiiiiii' + ); }); it('parses an idempotency key and api key and api version', () => { @@ -285,8 +298,8 @@ describe('utils', () => { apiVersion: 'hunter2', }, ]; - expect(utils.getOptionsFromArgs(args)).to.deep.equal({ - auth: 'sk_test_iiiiiiiiiiiiiiiiiiiiiiii', + const options = utils.getOptionsFromArgs(args); + expect(options).to.deep.contains({ host: null, headers: { 'Idempotency-Key': 'foo', @@ -295,6 +308,9 @@ describe('utils', () => { settings: {}, }); expect(args.length).to.equal(0); + expect(options.authenticator._apiKey).to.equal( + 'sk_test_iiiiiiiiiiiiiiiiiiiiiiii' + ); }); it('parses additional per-request settings', () => { @@ -306,7 +322,6 @@ describe('utils', () => { ]; expect(utils.getOptionsFromArgs(args)).to.deep.equal({ - auth: null, host: null, headers: {}, settings: { diff --git a/testProjects/mjs/index.js b/testProjects/mjs/index.js index d5bc505f23..4271be4424 100644 --- a/testProjects/mjs/index.js +++ b/testProjects/mjs/index.js @@ -19,7 +19,8 @@ assert(Stripe.createNodeCryptoProvider); assert(Stripe.createSubtleCryptoProvider); assert(Stripe.errors); -assert(Stripe.errors.generate) +assert(Stripe.errors.generateV1Error); +assert(Stripe.errors.generateV2Error); assert(Stripe.errors.StripeError); assert(Stripe.errors.StripeCardError); assert(Stripe.errors.StripeInvalidRequestError); diff --git a/types/AccountSessions.d.ts b/types/AccountSessions.d.ts index 175deba494..741dd6b752 100644 --- a/types/AccountSessions.d.ts +++ b/types/AccountSessions.d.ts @@ -82,7 +82,12 @@ declare module 'stripe' { namespace AccountManagement { interface Features { /** - * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for custom accounts (or accounts where the platform is compliance owner). Otherwise, bank account collection is determined by compliance requirements. + * Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false. + */ + disable_stripe_user_authentication: boolean; + + /** + * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`. */ external_account_collection: boolean; } @@ -100,7 +105,12 @@ declare module 'stripe' { namespace AccountOnboarding { interface Features { /** - * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for custom accounts (or accounts where the platform is compliance owner). Otherwise, bank account collection is determined by compliance requirements. + * Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false. + */ + disable_stripe_user_authentication: boolean; + + /** + * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`. */ external_account_collection: boolean; } @@ -117,13 +127,18 @@ declare module 'stripe' { namespace Balances { interface Features { + /** + * Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false. + */ + disable_stripe_user_authentication: boolean; + /** * Whether to allow payout schedule to be changed. Default `true` when Stripe owns Loss Liability, default `false` otherwise. */ edit_payout_schedule: boolean; /** - * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for custom accounts (or accounts where the platform is compliance owner). Otherwise, bank account collection is determined by compliance requirements. + * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`. */ external_account_collection: boolean; @@ -164,7 +179,12 @@ declare module 'stripe' { namespace NotificationBanner { interface Features { /** - * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for custom accounts (or accounts where the platform is compliance owner). Otherwise, bank account collection is determined by compliance requirements. + * Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false. + */ + disable_stripe_user_authentication: boolean; + + /** + * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`. */ external_account_collection: boolean; } @@ -247,13 +267,18 @@ declare module 'stripe' { namespace Payouts { interface Features { + /** + * Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false. + */ + disable_stripe_user_authentication: boolean; + /** * Whether to allow payout schedule to be changed. Default `true` when Stripe owns Loss Liability, default `false` otherwise. */ edit_payout_schedule: boolean; /** - * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for custom accounts (or accounts where the platform is compliance owner). Otherwise, bank account collection is determined by compliance requirements. + * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`. */ external_account_collection: boolean; diff --git a/types/AccountSessionsResource.d.ts b/types/AccountSessionsResource.d.ts index fa571cb00d..49bd196e43 100644 --- a/types/AccountSessionsResource.d.ts +++ b/types/AccountSessionsResource.d.ts @@ -93,7 +93,12 @@ declare module 'stripe' { namespace AccountManagement { interface Features { /** - * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for custom accounts (or accounts where the platform is compliance owner). Otherwise, bank account collection is determined by compliance requirements. + * Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false. + */ + disable_stripe_user_authentication?: boolean; + + /** + * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`. */ external_account_collection?: boolean; } @@ -114,7 +119,12 @@ declare module 'stripe' { namespace AccountOnboarding { interface Features { /** - * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for custom accounts (or accounts where the platform is compliance owner). Otherwise, bank account collection is determined by compliance requirements. + * Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false. + */ + disable_stripe_user_authentication?: boolean; + + /** + * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`. */ external_account_collection?: boolean; } @@ -134,13 +144,18 @@ declare module 'stripe' { namespace Balances { interface Features { + /** + * Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false. + */ + disable_stripe_user_authentication?: boolean; + /** * Whether to allow payout schedule to be changed. Default `true` when Stripe owns Loss Liability, default `false` otherwise. */ edit_payout_schedule?: boolean; /** - * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for custom accounts (or accounts where the platform is compliance owner). Otherwise, bank account collection is determined by compliance requirements. + * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`. */ external_account_collection?: boolean; @@ -187,7 +202,12 @@ declare module 'stripe' { namespace NotificationBanner { interface Features { /** - * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for custom accounts (or accounts where the platform is compliance owner). Otherwise, bank account collection is determined by compliance requirements. + * Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false. + */ + disable_stripe_user_authentication?: boolean; + + /** + * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`. */ external_account_collection?: boolean; } @@ -279,13 +299,18 @@ declare module 'stripe' { namespace Payouts { interface Features { + /** + * Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false. + */ + disable_stripe_user_authentication?: boolean; + /** * Whether to allow payout schedule to be changed. Default `true` when Stripe owns Loss Liability, default `false` otherwise. */ edit_payout_schedule?: boolean; /** - * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for custom accounts (or accounts where the platform is compliance owner). Otherwise, bank account collection is determined by compliance requirements. + * Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you're responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`. */ external_account_collection?: boolean; diff --git a/types/Accounts.d.ts b/types/Accounts.d.ts index 84b7914a1a..c9cd18ed1a 100644 --- a/types/Accounts.d.ts +++ b/types/Accounts.d.ts @@ -40,7 +40,7 @@ declare module 'stripe' { capabilities?: Account.Capabilities; /** - * Whether the account can create live charges. + * Whether the account can process charges. */ charges_enabled: boolean; @@ -85,6 +85,11 @@ declare module 'stripe' { future_requirements?: Account.FutureRequirements; + /** + * The groups associated with the account. + */ + groups?: Account.Groups | null; + /** * This is an object representing a person associated with a Stripe account. * @@ -100,7 +105,7 @@ declare module 'stripe' { metadata?: Stripe.Metadata; /** - * Whether Stripe can send payouts to this account. + * Whether the funds in this account can be paid out. */ payouts_enabled: boolean; @@ -124,12 +129,12 @@ declare module 'stripe' { /** * The applicant's gross annual revenue for its preceding fiscal year. */ - annual_revenue: BusinessProfile.AnnualRevenue | null; + annual_revenue?: BusinessProfile.AnnualRevenue | null; /** * An estimated upper bound of employees, contractors, vendors, etc. currently working for the business. */ - estimated_worker_count: number | null; + estimated_worker_count?: number | null; /** * [The merchant category code for the account](https://stripe.com/connect/setting-mcc). MCCs are used to classify businesses based on the goods or services they provide. @@ -227,6 +232,11 @@ declare module 'stripe' { */ afterpay_clearpay_payments?: Capabilities.AfterpayClearpayPayments; + /** + * The status of the Alma capability of the account, or whether the account can directly process Alma payments. + */ + alma_payments?: Capabilities.AlmaPayments; + /** * The status of the AmazonPay capability of the account, or whether the account can directly process AmazonPay payments. */ @@ -327,6 +337,11 @@ declare module 'stripe' { */ jp_bank_transfer_payments?: Capabilities.JpBankTransferPayments; + /** + * The status of the KakaoPay capability of the account, or whether the account can directly process KakaoPay payments. + */ + kakao_pay_payments?: Capabilities.KakaoPayPayments; + /** * The status of the Klarna payments capability of the account, or whether the account can directly process Klarna charges. */ @@ -337,6 +352,11 @@ declare module 'stripe' { */ konbini_payments?: Capabilities.KonbiniPayments; + /** + * The status of the KrCard capability of the account, or whether the account can directly process KrCard payments. + */ + kr_card_payments?: Capabilities.KrCardPayments; + /** * The status of the legacy payments capability of the account. */ @@ -362,6 +382,11 @@ declare module 'stripe' { */ mx_bank_transfer_payments?: Capabilities.MxBankTransferPayments; + /** + * The status of the NaverPay capability of the account, or whether the account can directly process NaverPay payments. + */ + naver_pay_payments?: Capabilities.NaverPayPayments; + /** * The status of the OXXO payments capability of the account, or whether the account can directly process OXXO charges. */ @@ -372,6 +397,11 @@ declare module 'stripe' { */ p24_payments?: Capabilities.P24Payments; + /** + * The status of the Payco capability of the account, or whether the account can directly process Payco payments. + */ + payco_payments?: Capabilities.PaycoPayments; + /** * The status of the paynow payments capability of the account, or whether the account can directly process paynow charges. */ @@ -387,6 +417,11 @@ declare module 'stripe' { */ revolut_pay_payments?: Capabilities.RevolutPayPayments; + /** + * The status of the SamsungPay capability of the account, or whether the account can directly process SamsungPay payments. + */ + samsung_pay_payments?: Capabilities.SamsungPayPayments; + /** * The status of the SEPA customer_balance payments (EUR currency) capability of the account, or whether the account can directly process SEPA customer_balance charges. */ @@ -455,6 +490,8 @@ declare module 'stripe' { type AfterpayClearpayPayments = 'active' | 'inactive' | 'pending'; + type AlmaPayments = 'active' | 'inactive' | 'pending'; + type AmazonPayPayments = 'active' | 'inactive' | 'pending'; type AuBecsDebitPayments = 'active' | 'inactive' | 'pending'; @@ -495,10 +532,14 @@ declare module 'stripe' { type JpBankTransferPayments = 'active' | 'inactive' | 'pending'; + type KakaoPayPayments = 'active' | 'inactive' | 'pending'; + type KlarnaPayments = 'active' | 'inactive' | 'pending'; type KonbiniPayments = 'active' | 'inactive' | 'pending'; + type KrCardPayments = 'active' | 'inactive' | 'pending'; + type LegacyPayments = 'active' | 'inactive' | 'pending'; type LinkPayments = 'active' | 'inactive' | 'pending'; @@ -509,16 +550,22 @@ declare module 'stripe' { type MxBankTransferPayments = 'active' | 'inactive' | 'pending'; + type NaverPayPayments = 'active' | 'inactive' | 'pending'; + type OxxoPayments = 'active' | 'inactive' | 'pending'; type P24Payments = 'active' | 'inactive' | 'pending'; + type PaycoPayments = 'active' | 'inactive' | 'pending'; + type PaynowPayments = 'active' | 'inactive' | 'pending'; type PromptpayPayments = 'active' | 'inactive' | 'pending'; type RevolutPayPayments = 'active' | 'inactive' | 'pending'; + type SamsungPayPayments = 'active' | 'inactive' | 'pending'; + type SepaBankTransferPayments = 'active' | 'inactive' | 'pending'; type SepaDebitPayments = 'active' | 'inactive' | 'pending'; @@ -852,7 +899,7 @@ declare module 'stripe' { alternatives: Array | null; /** - * Date on which `future_requirements` merges with the main `requirements` hash and `future_requirements` becomes empty. After the transition, `currently_due` requirements may immediately become `past_due`, but the account may also be given a grace period depending on its enablement state prior to transitioning. + * Date on which `future_requirements` becomes the main `requirements` hash and `future_requirements` becomes empty. After the transition, `currently_due` requirements may immediately become `past_due`, but the account may also be given a grace period depending on its enablement state prior to transitioning. */ current_deadline: number | null; @@ -862,9 +909,9 @@ declare module 'stripe' { currently_due: Array | null; /** - * This is typed as a string for consistency with `requirements.disabled_reason`. + * This is typed as an enum for consistency with `requirements.disabled_reason`. */ - disabled_reason: string | null; + disabled_reason: FutureRequirements.DisabledReason | null; /** * Fields that are `currently_due` and need to be collected again because validation or verification failed. @@ -872,7 +919,7 @@ declare module 'stripe' { errors: Array | null; /** - * Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well. + * Fields you must collect when all thresholds are reached. As they become required, they appear in `currently_due` as well. */ eventually_due: Array | null; @@ -900,6 +947,23 @@ declare module 'stripe' { original_fields_due: Array; } + type DisabledReason = + | 'action_required.requested_capabilities' + | 'listed' + | 'other' + | 'platform_paused' + | 'rejected.fraud' + | 'rejected.incomplete_verification' + | 'rejected.listed' + | 'rejected.other' + | 'rejected.platform_fraud' + | 'rejected.platform_other' + | 'rejected.platform_terms_of_service' + | 'rejected.terms_of_service' + | 'requirements.past_due' + | 'requirements.pending_verification' + | 'under_review'; + interface Error { /** * The code for the type of error. @@ -1012,6 +1076,13 @@ declare module 'stripe' { } } + interface Groups { + /** + * The group the account is in to determine their payments pricing, and null if the account is on customized pricing. [See the Platform pricing tool documentation](https://stripe.com/docs/connect/platform-pricing-tools) for details. + */ + payments_pricing: string | null; + } + interface Requirements { /** * Fields that are due and can be satisfied by providing the corresponding alternative fields instead. @@ -1029,9 +1100,9 @@ declare module 'stripe' { currently_due: Array | null; /** - * If the account is disabled, this string describes why. [Learn more about handling verification issues](https://stripe.com/docs/connect/handling-api-verification). Can be `action_required.requested_capabilities`, `requirements.past_due`, `requirements.pending_verification`, `listed`, `platform_paused`, `rejected.fraud`, `rejected.incomplete_verification`, `rejected.listed`, `rejected.other`, `rejected.terms_of_service`, `under_review`, or `other`. + * If the account is disabled, this enum describes why. [Learn more about handling verification issues](https://stripe.com/docs/connect/handling-api-verification). */ - disabled_reason: string | null; + disabled_reason: Requirements.DisabledReason | null; /** * Fields that are `currently_due` and need to be collected again because validation or verification failed. @@ -1039,7 +1110,7 @@ declare module 'stripe' { errors: Array | null; /** - * Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well, and `current_deadline` becomes set. + * Fields you must collect when all thresholds are reached. As they become required, they appear in `currently_due` as well, and `current_deadline` becomes set. */ eventually_due: Array | null; @@ -1067,6 +1138,23 @@ declare module 'stripe' { original_fields_due: Array; } + type DisabledReason = + | 'action_required.requested_capabilities' + | 'listed' + | 'other' + | 'platform_paused' + | 'rejected.fraud' + | 'rejected.incomplete_verification' + | 'rejected.listed' + | 'rejected.other' + | 'rejected.platform_fraud' + | 'rejected.platform_other' + | 'rejected.platform_terms_of_service' + | 'rejected.terms_of_service' + | 'requirements.past_due' + | 'requirements.pending_verification' + | 'under_review'; + interface Error { /** * The code for the type of error. diff --git a/types/AccountsResource.d.ts b/types/AccountsResource.d.ts index 416406eaac..3a4b88b016 100644 --- a/types/AccountsResource.d.ts +++ b/types/AccountsResource.d.ts @@ -72,6 +72,11 @@ declare module 'stripe' { */ external_account?: string | AccountCreateParams.ExternalAccount; + /** + * A hash of account group type to tokens. These are account groups this account should be added to. + */ + groups?: AccountCreateParams.Groups; + /** * Information about the person represented by the account. This field is null unless `business_type` is set to `individual`. Once you create an [Account Link](https://stripe.com/api/account_links) or [Account Session](https://stripe.com/api/account_sessions), this property can only be updated for accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts. */ @@ -209,6 +214,11 @@ declare module 'stripe' { */ afterpay_clearpay_payments?: Capabilities.AfterpayClearpayPayments; + /** + * The alma_payments capability. + */ + alma_payments?: Capabilities.AlmaPayments; + /** * The amazon_pay_payments capability. */ @@ -309,6 +319,11 @@ declare module 'stripe' { */ jp_bank_transfer_payments?: Capabilities.JpBankTransferPayments; + /** + * The kakao_pay_payments capability. + */ + kakao_pay_payments?: Capabilities.KakaoPayPayments; + /** * The klarna_payments capability. */ @@ -319,6 +334,11 @@ declare module 'stripe' { */ konbini_payments?: Capabilities.KonbiniPayments; + /** + * The kr_card_payments capability. + */ + kr_card_payments?: Capabilities.KrCardPayments; + /** * The legacy_payments capability. */ @@ -344,6 +364,11 @@ declare module 'stripe' { */ mx_bank_transfer_payments?: Capabilities.MxBankTransferPayments; + /** + * The naver_pay_payments capability. + */ + naver_pay_payments?: Capabilities.NaverPayPayments; + /** * The oxxo_payments capability. */ @@ -354,6 +379,11 @@ declare module 'stripe' { */ p24_payments?: Capabilities.P24Payments; + /** + * The payco_payments capability. + */ + payco_payments?: Capabilities.PaycoPayments; + /** * The paynow_payments capability. */ @@ -369,6 +399,11 @@ declare module 'stripe' { */ revolut_pay_payments?: Capabilities.RevolutPayPayments; + /** + * The samsung_pay_payments capability. + */ + samsung_pay_payments?: Capabilities.SamsungPayPayments; + /** * The sepa_bank_transfer_payments capability. */ @@ -452,6 +487,13 @@ declare module 'stripe' { requested?: boolean; } + interface AlmaPayments { + /** + * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + */ + requested?: boolean; + } + interface AmazonPayPayments { /** * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. @@ -592,6 +634,13 @@ declare module 'stripe' { requested?: boolean; } + interface KakaoPayPayments { + /** + * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + */ + requested?: boolean; + } + interface KlarnaPayments { /** * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. @@ -606,6 +655,13 @@ declare module 'stripe' { requested?: boolean; } + interface KrCardPayments { + /** + * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + */ + requested?: boolean; + } + interface LegacyPayments { /** * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. @@ -641,6 +697,13 @@ declare module 'stripe' { requested?: boolean; } + interface NaverPayPayments { + /** + * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + */ + requested?: boolean; + } + interface OxxoPayments { /** * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. @@ -655,6 +718,13 @@ declare module 'stripe' { requested?: boolean; } + interface PaycoPayments { + /** + * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + */ + requested?: boolean; + } + interface PaynowPayments { /** * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. @@ -676,6 +746,13 @@ declare module 'stripe' { requested?: boolean; } + interface SamsungPayPayments { + /** + * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + */ + requested?: boolean; + } + interface SepaBankTransferPayments { /** * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. @@ -1107,6 +1184,13 @@ declare module 'stripe' { account_number: string; } + interface Groups { + /** + * The group the account is in to determine their payments pricing, and null if the account is on customized pricing. [See the Platform pricing tool documentation](https://stripe.com/docs/connect/platform-pricing-tools) for details. + */ + payments_pricing?: Stripe.Emptyable; + } + interface Individual { /** * The individual's primary address. @@ -1154,7 +1238,7 @@ declare module 'stripe' { full_name_aliases?: Stripe.Emptyable>; /** - * The individual's gender (International regulations require either "male" or "female"). + * The individual's gender */ gender?: string; @@ -1634,6 +1718,11 @@ declare module 'stripe' { | AccountUpdateParams.CardToken >; + /** + * A hash of account group type to tokens. These are account groups this account should be added to. + */ + groups?: AccountUpdateParams.Groups; + /** * Information about the person represented by the account. This field is null unless `business_type` is set to `individual`. Once you create an [Account Link](https://stripe.com/api/account_links) or [Account Session](https://stripe.com/api/account_sessions), this property can only be updated for accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts. */ @@ -1804,6 +1893,11 @@ declare module 'stripe' { */ afterpay_clearpay_payments?: Capabilities.AfterpayClearpayPayments; + /** + * The alma_payments capability. + */ + alma_payments?: Capabilities.AlmaPayments; + /** * The amazon_pay_payments capability. */ @@ -1904,6 +1998,11 @@ declare module 'stripe' { */ jp_bank_transfer_payments?: Capabilities.JpBankTransferPayments; + /** + * The kakao_pay_payments capability. + */ + kakao_pay_payments?: Capabilities.KakaoPayPayments; + /** * The klarna_payments capability. */ @@ -1914,6 +2013,11 @@ declare module 'stripe' { */ konbini_payments?: Capabilities.KonbiniPayments; + /** + * The kr_card_payments capability. + */ + kr_card_payments?: Capabilities.KrCardPayments; + /** * The legacy_payments capability. */ @@ -1939,6 +2043,11 @@ declare module 'stripe' { */ mx_bank_transfer_payments?: Capabilities.MxBankTransferPayments; + /** + * The naver_pay_payments capability. + */ + naver_pay_payments?: Capabilities.NaverPayPayments; + /** * The oxxo_payments capability. */ @@ -1949,6 +2058,11 @@ declare module 'stripe' { */ p24_payments?: Capabilities.P24Payments; + /** + * The payco_payments capability. + */ + payco_payments?: Capabilities.PaycoPayments; + /** * The paynow_payments capability. */ @@ -1964,6 +2078,11 @@ declare module 'stripe' { */ revolut_pay_payments?: Capabilities.RevolutPayPayments; + /** + * The samsung_pay_payments capability. + */ + samsung_pay_payments?: Capabilities.SamsungPayPayments; + /** * The sepa_bank_transfer_payments capability. */ @@ -2047,6 +2166,13 @@ declare module 'stripe' { requested?: boolean; } + interface AlmaPayments { + /** + * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + */ + requested?: boolean; + } + interface AmazonPayPayments { /** * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. @@ -2187,6 +2313,13 @@ declare module 'stripe' { requested?: boolean; } + interface KakaoPayPayments { + /** + * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + */ + requested?: boolean; + } + interface KlarnaPayments { /** * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. @@ -2201,6 +2334,13 @@ declare module 'stripe' { requested?: boolean; } + interface KrCardPayments { + /** + * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + */ + requested?: boolean; + } + interface LegacyPayments { /** * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. @@ -2236,6 +2376,13 @@ declare module 'stripe' { requested?: boolean; } + interface NaverPayPayments { + /** + * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + */ + requested?: boolean; + } + interface OxxoPayments { /** * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. @@ -2250,6 +2397,13 @@ declare module 'stripe' { requested?: boolean; } + interface PaycoPayments { + /** + * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + */ + requested?: boolean; + } + interface PaynowPayments { /** * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. @@ -2271,6 +2425,13 @@ declare module 'stripe' { requested?: boolean; } + interface SamsungPayPayments { + /** + * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + */ + requested?: boolean; + } + interface SepaBankTransferPayments { /** * Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. @@ -2649,6 +2810,13 @@ declare module 'stripe' { } } + interface Groups { + /** + * The group the account is in to determine their payments pricing, and null if the account is on customized pricing. [See the Platform pricing tool documentation](https://stripe.com/docs/connect/platform-pricing-tools) for details. + */ + payments_pricing?: Stripe.Emptyable; + } + interface Individual { /** * The individual's primary address. @@ -2696,7 +2864,7 @@ declare module 'stripe' { full_name_aliases?: Stripe.Emptyable>; /** - * The individual's gender (International regulations require either "male" or "female"). + * The individual's gender */ gender?: string; @@ -3469,6 +3637,11 @@ declare module 'stripe' { } interface Relationship { + /** + * Whether the person is the authorizer of the account's representative. + */ + authorizer?: boolean; + /** * Whether the person is a director of the account's legal entity. Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations. */ @@ -3585,6 +3758,11 @@ declare module 'stripe' { namespace AccountListPersonsParams { interface Relationship { + /** + * A filter on the list of people returned based on whether these people are authorizers of the account's representative. + */ + authorizer?: boolean; + /** * A filter on the list of people returned based on whether these people are directors of the account's company. */ @@ -3999,6 +4177,11 @@ declare module 'stripe' { } interface Relationship { + /** + * Whether the person is the authorizer of the account's representative. + */ + authorizer?: boolean; + /** * Whether the person is a director of the account's legal entity. Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations. */ @@ -4174,7 +4357,7 @@ declare module 'stripe' { ): Promise>; /** - * Creates a single-use login link for a connected account to access the Express Dashboard. + * Creates a login link for a connected account to access the Express Dashboard. * * You can only create login links for accounts that use the [Express Dashboard](https://stripe.com/connect/express-dashboard) and are connected to your platform. */ diff --git a/types/BalanceTransactions.d.ts b/types/BalanceTransactions.d.ts index fa975313ef..f0a035b9ac 100644 --- a/types/BalanceTransactions.d.ts +++ b/types/BalanceTransactions.d.ts @@ -80,7 +80,7 @@ declare module 'stripe' { status: string; /** - * Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_outbound`, `obligation_reversal_inbound`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. Learn more about [balance transaction types and what they represent](https://stripe.com/docs/reports/balance-transaction-types). To classify transactions for accounting purposes, consider `reporting_category` instead. + * Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_outbound`, `obligation_reversal_inbound`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `payout_minimum_balance_hold`, `payout_minimum_balance_release`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. Learn more about [balance transaction types and what they represent](https://stripe.com/docs/reports/balance-transaction-types). To classify transactions for accounting purposes, consider `reporting_category` instead. */ type: BalanceTransaction.Type; } @@ -141,6 +141,8 @@ declare module 'stripe' { | 'payout' | 'payout_cancel' | 'payout_failure' + | 'payout_minimum_balance_hold' + | 'payout_minimum_balance_release' | 'refund' | 'refund_failure' | 'reserve_transaction' diff --git a/types/BalanceTransactionsResource.d.ts b/types/BalanceTransactionsResource.d.ts index 929c9bee4f..3538087e47 100644 --- a/types/BalanceTransactionsResource.d.ts +++ b/types/BalanceTransactionsResource.d.ts @@ -36,7 +36,7 @@ declare module 'stripe' { source?: string; /** - * Only returns transactions of the given type. One of: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_outbound`, `obligation_reversal_inbound`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. + * Only returns transactions of the given type. One of: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_outbound`, `obligation_reversal_inbound`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `payout_minimum_balance_hold`, `payout_minimum_balance_release`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. */ type?: string; } diff --git a/types/Billing/Alerts.d.ts b/types/Billing/Alerts.d.ts index 3989d21281..4184264ffb 100644 --- a/types/Billing/Alerts.d.ts +++ b/types/Billing/Alerts.d.ts @@ -22,11 +22,6 @@ declare module 'stripe' { */ alert_type: 'usage_threshold'; - /** - * Limits the scope of the alert to a specific [customer](https://stripe.com/docs/api/customers). - */ - filter: Alert.Filter | null; - /** * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. */ @@ -45,20 +40,18 @@ declare module 'stripe' { /** * Encapsulates configuration of the alert to monitor usage on a specific [Billing Meter](https://stripe.com/docs/api/billing/meter). */ - usage_threshold_config: Alert.UsageThresholdConfig | null; + usage_threshold: Alert.UsageThreshold | null; } namespace Alert { - interface Filter { + type Status = 'active' | 'archived' | 'inactive'; + + interface UsageThreshold { /** - * Limit the scope of the alert to this customer ID + * The filters allow limiting the scope of this usage alert. You can only specify up to one filter at this time. */ - customer: string | Stripe.Customer | null; - } + filters: Array | null; - type Status = 'active' | 'archived' | 'inactive'; - - interface UsageThresholdConfig { /** * The value at which this alert will trigger. */ @@ -74,6 +67,17 @@ declare module 'stripe' { */ recurrence: 'one_time'; } + + namespace UsageThreshold { + interface Filter { + /** + * Limit the scope of the alert to this customer ID + */ + customer: string | Stripe.Customer | null; + + type: 'customer'; + } + } } } } diff --git a/types/Billing/AlertsResource.d.ts b/types/Billing/AlertsResource.d.ts index 6090503b89..fa0fdec94e 100644 --- a/types/Billing/AlertsResource.d.ts +++ b/types/Billing/AlertsResource.d.ts @@ -19,36 +19,19 @@ declare module 'stripe' { */ expand?: Array; - /** - * Filters to limit the scope of an alert. - */ - filter?: AlertCreateParams.Filter; - /** * The configuration of the usage threshold. */ - usage_threshold_config?: AlertCreateParams.UsageThresholdConfig; + usage_threshold?: AlertCreateParams.UsageThreshold; } namespace AlertCreateParams { - interface Filter { - /** - * Limit the scope to this alert only to this customer. - */ - customer?: string; - + interface UsageThreshold { /** - * Limit the scope of this rated usage alert to this subscription. + * The filters allows limiting the scope of this usage alert. You can only specify up to one filter at this time. */ - subscription?: string; + filters?: Array; - /** - * Limit the scope of this rated usage alert to this subscription item. - */ - subscription_item?: string; - } - - interface UsageThresholdConfig { /** * Defines at which value the alert will fire. */ @@ -64,6 +47,20 @@ declare module 'stripe' { */ recurrence: 'one_time'; } + + namespace UsageThreshold { + interface Filter { + /** + * Limit the scope to this usage alert only to this customer. + */ + customer?: string; + + /** + * What type of filter is being applied to this usage alert. + */ + type: 'customer'; + } + } } interface AlertRetrieveParams { diff --git a/types/Billing/CreditBalanceSummary.d.ts b/types/Billing/CreditBalanceSummary.d.ts new file mode 100644 index 0000000000..c4627a288c --- /dev/null +++ b/types/Billing/CreditBalanceSummary.d.ts @@ -0,0 +1,94 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace Billing { + /** + * Indicates the billing credit balance for billing credits granted to a customer. + */ + interface CreditBalanceSummary { + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'billing.credit_balance_summary'; + + /** + * The billing credit balances. One entry per credit grant currency. If a customer only has credit grants in a single currency, then this will have a single balance entry. + */ + balances: Array; + + /** + * The customer the balance is for. + */ + customer: string | Stripe.Customer | Stripe.DeletedCustomer; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + } + + namespace CreditBalanceSummary { + interface Balance { + available_balance: Balance.AvailableBalance; + + ledger_balance: Balance.LedgerBalance; + } + + namespace Balance { + interface AvailableBalance { + /** + * The monetary amount. + */ + monetary: AvailableBalance.Monetary | null; + + /** + * The type of this amount. We currently only support `monetary` billing credits. + */ + type: 'monetary'; + } + + namespace AvailableBalance { + interface Monetary { + /** + * 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 positive integer representing the amount. + */ + value: number; + } + } + + interface LedgerBalance { + /** + * The monetary amount. + */ + monetary: LedgerBalance.Monetary | null; + + /** + * The type of this amount. We currently only support `monetary` billing credits. + */ + type: 'monetary'; + } + + namespace LedgerBalance { + interface Monetary { + /** + * 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 positive integer representing the amount. + */ + value: number; + } + } + } + } + } + } +} diff --git a/types/Billing/CreditBalanceSummaryResource.d.ts b/types/Billing/CreditBalanceSummaryResource.d.ts new file mode 100644 index 0000000000..09cf01f44c --- /dev/null +++ b/types/Billing/CreditBalanceSummaryResource.d.ts @@ -0,0 +1,64 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace Billing { + interface CreditBalanceSummaryRetrieveParams { + /** + * The customer for which to fetch credit balance summary. + */ + customer: string; + + /** + * The filter criteria for the credit balance summary. + */ + filter: CreditBalanceSummaryRetrieveParams.Filter; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + namespace CreditBalanceSummaryRetrieveParams { + interface Filter { + /** + * The billing credit applicability scope for which to fetch credit balance summary. + */ + applicability_scope?: Filter.ApplicabilityScope; + + /** + * The credit grant for which to fetch credit balance summary. + */ + credit_grant?: string; + + /** + * Specify the type of this filter. + */ + type: Filter.Type; + } + + namespace Filter { + interface ApplicabilityScope { + /** + * The price type that credit grants can apply to. We currently only support the `metered` price type. + */ + price_type: 'metered'; + } + + type Type = 'applicability_scope' | 'credit_grant'; + } + } + + class CreditBalanceSummaryResource { + /** + * Retrieves the credit balance summary for a customer. + */ + retrieve( + params: CreditBalanceSummaryRetrieveParams, + options?: RequestOptions + ): Promise>; + } + } + } +} diff --git a/types/Billing/CreditBalanceTransactions.d.ts b/types/Billing/CreditBalanceTransactions.d.ts new file mode 100644 index 0000000000..6106d744ba --- /dev/null +++ b/types/Billing/CreditBalanceTransactions.d.ts @@ -0,0 +1,178 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace Billing { + /** + * A credit balance transaction is a resource representing a transaction (either a credit or a debit) against an existing credit grant. + */ + interface CreditBalanceTransaction { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'billing.credit_balance_transaction'; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * Credit details for this credit balance transaction. Only present if type is `credit`. + */ + credit: CreditBalanceTransaction.Credit | null; + + /** + * The credit grant associated with this credit balance transaction. + */ + credit_grant: string | Stripe.Billing.CreditGrant; + + /** + * Debit details for this credit balance transaction. Only present if type is `debit`. + */ + debit: CreditBalanceTransaction.Debit | null; + + /** + * The effective time of this credit balance transaction. + */ + effective_at: number; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * ID of the test clock this credit balance transaction belongs to. + */ + test_clock: string | Stripe.TestHelpers.TestClock | null; + + /** + * The type of credit balance transaction (credit or debit). + */ + type: CreditBalanceTransaction.Type | null; + } + + namespace CreditBalanceTransaction { + interface Credit { + amount: Credit.Amount; + + /** + * Details of the invoice to which the reinstated credits were originally applied. Only present if `type` is `credits_application_invoice_voided`. + */ + credits_application_invoice_voided?: Credit.CreditsApplicationInvoiceVoided | null; + + /** + * The type of credit transaction. + */ + type: Credit.Type; + } + + namespace Credit { + interface Amount { + /** + * The monetary amount. + */ + monetary: Amount.Monetary | null; + + /** + * The type of this amount. We currently only support `monetary` billing credits. + */ + type: 'monetary'; + } + + namespace Amount { + interface Monetary { + /** + * 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 positive integer representing the amount. + */ + value: number; + } + } + + interface CreditsApplicationInvoiceVoided { + /** + * The invoice to which the reinstated billing credits were originally applied. + */ + invoice: string | Stripe.Invoice; + + /** + * The invoice line item to which the reinstated billing credits were originally applied. + */ + invoice_line_item: string; + } + + type Type = 'credits_application_invoice_voided' | 'credits_granted'; + } + + interface Debit { + amount: Debit.Amount; + + /** + * Details of how the billing credits were applied to an invoice. Only present if `type` is `credits_applied`. + */ + credits_applied: Debit.CreditsApplied | null; + + /** + * The type of debit transaction. + */ + type: Debit.Type; + } + + namespace Debit { + interface Amount { + /** + * The monetary amount. + */ + monetary: Amount.Monetary | null; + + /** + * The type of this amount. We currently only support `monetary` billing credits. + */ + type: 'monetary'; + } + + namespace Amount { + interface Monetary { + /** + * 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 positive integer representing the amount. + */ + value: number; + } + } + + interface CreditsApplied { + /** + * The invoice to which the billing credits were applied. + */ + invoice: string | Stripe.Invoice; + + /** + * The invoice line item to which the billing credits were applied. + */ + invoice_line_item: string; + } + + type Type = 'credits_applied' | 'credits_expired' | 'credits_voided'; + } + + type Type = 'credit' | 'debit'; + } + } + } +} diff --git a/types/Billing/CreditBalanceTransactionsResource.d.ts b/types/Billing/CreditBalanceTransactionsResource.d.ts new file mode 100644 index 0000000000..6e700537f2 --- /dev/null +++ b/types/Billing/CreditBalanceTransactionsResource.d.ts @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace Billing { + interface CreditBalanceTransactionRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CreditBalanceTransactionListParams extends PaginationParams { + /** + * The customer for which to fetch credit balance transactions. + */ + customer: string; + + /** + * The credit grant for which to fetch credit balance transactions. + */ + credit_grant?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class CreditBalanceTransactionsResource { + /** + * Retrieves a credit balance transaction. + */ + retrieve( + id: string, + params?: CreditBalanceTransactionRetrieveParams, + options?: RequestOptions + ): Promise>; + retrieve( + id: string, + options?: RequestOptions + ): Promise>; + + /** + * Retrieve a list of credit balance transactions. + */ + list( + params: CreditBalanceTransactionListParams, + options?: RequestOptions + ): ApiListPromise; + } + } + } +} diff --git a/types/Billing/CreditGrants.d.ts b/types/Billing/CreditGrants.d.ts new file mode 100644 index 0000000000..6f50ed5aea --- /dev/null +++ b/types/Billing/CreditGrants.d.ts @@ -0,0 +1,126 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace Billing { + /** + * A credit grant is an API resource that documents the allocation of some billing credits to a customer. + * + * Related guide: [Billing credits](https://docs.stripe.com/billing/subscriptions/usage-based/billing-credits) + */ + interface CreditGrant { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value. + */ + object: 'billing.credit_grant'; + + amount: CreditGrant.Amount; + + applicability_config: CreditGrant.ApplicabilityConfig; + + /** + * The category of this credit grant. This is for tracking purposes and isn't displayed to the customer. + */ + category: CreditGrant.Category; + + /** + * Time at which the object was created. Measured in seconds since the Unix epoch. + */ + created: number; + + /** + * ID of the customer receiving the billing credits. + */ + customer: string | Stripe.Customer | Stripe.DeletedCustomer; + + /** + * The time when the billing credits become effective-when they're eligible for use. + */ + effective_at: number | null; + + /** + * The time when the billing credits expire. If not present, the billing credits don't expire. + */ + expires_at: number | 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; + + /** + * A descriptive name shown in dashboard. + */ + name: string | null; + + /** + * ID of the test clock this credit grant belongs to. + */ + test_clock: string | Stripe.TestHelpers.TestClock | null; + + /** + * Time at which the object was last updated. Measured in seconds since the Unix epoch. + */ + updated: number; + + /** + * The time when this credit grant was voided. If not present, the credit grant hasn't been voided. + */ + voided_at: number | null; + } + + namespace CreditGrant { + interface Amount { + /** + * The monetary amount. + */ + monetary: Amount.Monetary | null; + + /** + * The type of this amount. We currently only support `monetary` billing credits. + */ + type: 'monetary'; + } + + namespace Amount { + interface Monetary { + /** + * 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 positive integer representing the amount. + */ + value: number; + } + } + + interface ApplicabilityConfig { + scope: ApplicabilityConfig.Scope; + } + + namespace ApplicabilityConfig { + interface Scope { + /** + * The price type that credit grants can apply to. We currently only support the `metered` price type. This refers to prices that have a [Billing Meter](https://docs.stripe.com/api/billing/meter) attached to them. + */ + price_type: 'metered'; + } + } + + type Category = 'paid' | 'promotional'; + } + } + } +} diff --git a/types/Billing/CreditGrantsResource.d.ts b/types/Billing/CreditGrantsResource.d.ts new file mode 100644 index 0000000000..58509065b7 --- /dev/null +++ b/types/Billing/CreditGrantsResource.d.ts @@ -0,0 +1,219 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace Billing { + interface CreditGrantCreateParams { + /** + * Amount of this credit grant. + */ + amount: CreditGrantCreateParams.Amount; + + /** + * Configuration specifying what this credit grant applies to. + */ + applicability_config: CreditGrantCreateParams.ApplicabilityConfig; + + /** + * The category of this credit grant. + */ + category: CreditGrantCreateParams.Category; + + /** + * ID of the customer to receive the billing credits. + */ + customer: string; + + /** + * The time when the billing credits become effective-when they're eligible for use. It defaults to the current timestamp if not specified. + */ + effective_at?: number; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The time when the billing credits expire. If not specified, the billing credits don't expire. + */ + expires_at?: number; + + /** + * Set of key-value pairs that you can attach to an object. You can use this to store additional information about the object (for example, cost basis) in a structured format. + */ + metadata?: Stripe.MetadataParam; + + /** + * A descriptive name shown in the Dashboard. + */ + name?: string; + } + + namespace CreditGrantCreateParams { + interface Amount { + /** + * The monetary amount. + */ + monetary?: Amount.Monetary; + + /** + * Specify the type of this amount. We currently only support `monetary` billing credits. + */ + type: 'monetary'; + } + + namespace Amount { + interface Monetary { + /** + * Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the `value` parameter. + */ + currency: string; + + /** + * A positive integer representing the amount of the credit grant. + */ + value: number; + } + } + + interface ApplicabilityConfig { + /** + * Specify the scope of this applicability config. + */ + scope: ApplicabilityConfig.Scope; + } + + namespace ApplicabilityConfig { + interface Scope { + /** + * The price type that credit grants can apply to. We currently only support the `metered` price type. + */ + price_type: 'metered'; + } + } + + type Category = 'paid' | 'promotional'; + } + + interface CreditGrantRetrieveParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CreditGrantUpdateParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + + /** + * The time when the billing credits created by this credit grant expire. If set to empty, the billing credits never expire. + */ + expires_at?: Stripe.Emptyable; + + /** + * Set of key-value pairs you can attach to an object. You can use this to store additional information about the object (for example, cost basis) in a structured format. + */ + metadata?: Stripe.MetadataParam; + } + + interface CreditGrantListParams extends PaginationParams { + /** + * Only return credit grants for this customer. + */ + customer?: string; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CreditGrantExpireParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + interface CreditGrantVoidGrantParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + + class CreditGrantsResource { + /** + * Creates a credit grant. + */ + create( + params: CreditGrantCreateParams, + options?: RequestOptions + ): Promise>; + + /** + * Retrieves a credit grant. + */ + retrieve( + id: string, + params?: CreditGrantRetrieveParams, + options?: RequestOptions + ): Promise>; + retrieve( + id: string, + options?: RequestOptions + ): Promise>; + + /** + * Updates a credit grant. + */ + update( + id: string, + params?: CreditGrantUpdateParams, + options?: RequestOptions + ): Promise>; + + /** + * Retrieve a list of credit grants. + */ + list( + params?: CreditGrantListParams, + options?: RequestOptions + ): ApiListPromise; + list( + options?: RequestOptions + ): ApiListPromise; + + /** + * Expires a credit grant. + */ + expire( + id: string, + params?: CreditGrantExpireParams, + options?: RequestOptions + ): Promise>; + expire( + id: string, + options?: RequestOptions + ): Promise>; + + /** + * Voids a credit grant. + */ + voidGrant( + id: string, + params?: CreditGrantVoidGrantParams, + options?: RequestOptions + ): Promise>; + voidGrant( + id: string, + options?: RequestOptions + ): Promise>; + } + } + } +} diff --git a/types/Billing/MeterEventAdjustmentsResource.d.ts b/types/Billing/MeterEventAdjustmentsResource.d.ts index 74ac21ad90..25129a97c5 100644 --- a/types/Billing/MeterEventAdjustmentsResource.d.ts +++ b/types/Billing/MeterEventAdjustmentsResource.d.ts @@ -36,7 +36,7 @@ declare module 'stripe' { class MeterEventAdjustmentsResource { /** - * Creates a billing meter event adjustment + * Creates a billing meter event adjustment. */ create( params: MeterEventAdjustmentCreateParams, diff --git a/types/Billing/MeterEvents.d.ts b/types/Billing/MeterEvents.d.ts index abcb35c586..1492b44367 100644 --- a/types/Billing/MeterEvents.d.ts +++ b/types/Billing/MeterEvents.d.ts @@ -4,8 +4,7 @@ declare module 'stripe' { namespace Stripe { namespace Billing { /** - * A billing meter event represents a customer's usage of a product. Meter events are used to bill a customer based on their usage. - * Meter events are associated with billing meters, which define the shape of the event's payload and how those events are aggregated for billing. + * Meter events represent actions that customers take in your system. You can use meter events to bill a customer based on their usage. Meter events are associated with billing meters, which define both the contents of the event's payload and how to aggregate those events. */ interface MeterEvent { /** diff --git a/types/Billing/MeterEventsResource.d.ts b/types/Billing/MeterEventsResource.d.ts index 97fb3f86b2..e8ec9753b8 100644 --- a/types/Billing/MeterEventsResource.d.ts +++ b/types/Billing/MeterEventsResource.d.ts @@ -22,7 +22,7 @@ declare module 'stripe' { expand?: Array; /** - * A unique identifier for the event. If not provided, one will be generated. We recommend using a globally unique identifier for this. We'll enforce uniqueness within a rolling 24 hour period. + * A unique identifier for the event. If not provided, one is generated. We recommend using UUID-like identifiers. We will enforce uniqueness within a rolling period of at least 24 hours. The enforcement of uniqueness primarily addresses issues arising from accidental retries or other problems occurring within extremely brief time intervals. This approach helps prevent duplicate entries and ensures data integrity in high-frequency operations. */ identifier?: string; @@ -34,7 +34,7 @@ declare module 'stripe' { class MeterEventsResource { /** - * Creates a billing meter event + * Creates a billing meter event. */ create( params: MeterEventCreateParams, diff --git a/types/Billing/Meters.d.ts b/types/Billing/Meters.d.ts index ca9d47eb0d..f572530c66 100644 --- a/types/Billing/Meters.d.ts +++ b/types/Billing/Meters.d.ts @@ -4,7 +4,9 @@ declare module 'stripe' { namespace Stripe { namespace Billing { /** - * A billing meter is a resource that allows you to track usage of a particular event. For example, you might create a billing meter to track the number of API calls made by a particular user. You can then attach the billing meter to a price and attach the price to a subscription to charge the user for the number of API calls they make. + * Meters specify how to aggregate meter events over a billing period. Meter events represent the actions that customers take in your system. Meters attach to prices and form the basis of the bill. + * + * Related guide: [Usage based billing](https://docs.stripe.com/billing/subscriptions/usage-based) */ interface Meter { /** diff --git a/types/Billing/MetersResource.d.ts b/types/Billing/MetersResource.d.ts index 26bee2b879..b28eb72baa 100644 --- a/types/Billing/MetersResource.d.ts +++ b/types/Billing/MetersResource.d.ts @@ -10,7 +10,7 @@ declare module 'stripe' { default_aggregation: MeterCreateParams.DefaultAggregation; /** - * The meter's name. + * The meter's name. Not visible to the customer. */ display_name: string; @@ -43,7 +43,7 @@ declare module 'stripe' { namespace MeterCreateParams { interface CustomerMapping { /** - * The key in the usage event payload to use for mapping the event to a customer. + * The key in the meter event payload to use for mapping the event to a customer. */ event_payload_key: string; @@ -83,7 +83,7 @@ declare module 'stripe' { interface MeterUpdateParams { /** - * The meter's name. + * The meter's name. Not visible to the customer. */ display_name?: string; @@ -156,7 +156,7 @@ declare module 'stripe' { class MetersResource { /** - * Creates a billing meter + * Creates a billing meter. */ create( params: MeterCreateParams, @@ -164,7 +164,7 @@ declare module 'stripe' { ): Promise>; /** - * Retrieves a billing meter given an ID + * Retrieves a billing meter given an ID. */ retrieve( id: string, @@ -177,7 +177,7 @@ declare module 'stripe' { ): Promise>; /** - * Updates a billing meter + * Updates a billing meter. */ update( id: string, @@ -195,7 +195,7 @@ declare module 'stripe' { list(options?: RequestOptions): ApiListPromise; /** - * Deactivates a billing meter + * When a meter is deactivated, no more meter events will be accepted for this meter. You can't attach a deactivated meter to a price. */ deactivate( id: string, @@ -217,7 +217,7 @@ declare module 'stripe' { ): ApiListPromise; /** - * Reactivates a billing meter + * When a meter is reactivated, events for this meter can be accepted and you can attach the meter to a price. */ reactivate( id: string, diff --git a/types/BillingPortal/Configurations.d.ts b/types/BillingPortal/Configurations.d.ts index 20762774a6..0b9ce422ab 100644 --- a/types/BillingPortal/Configurations.d.ts +++ b/types/BillingPortal/Configurations.d.ts @@ -209,6 +209,8 @@ declare module 'stripe' { * Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`. Defaults to a value of `none` if you don't set it during creation. */ proration_behavior: SubscriptionUpdate.ProrationBehavior; + + schedule_at_period_end: SubscriptionUpdate.ScheduleAtPeriodEnd; } namespace SubscriptionUpdate { @@ -230,6 +232,26 @@ declare module 'stripe' { | 'always_invoice' | 'create_prorations' | 'none'; + + interface ScheduleAtPeriodEnd { + /** + * List of conditions. When any condition is true, an update will be scheduled at the end of the current period. + */ + conditions: Array; + } + + namespace ScheduleAtPeriodEnd { + interface Condition { + /** + * The type of condition. + */ + type: Condition.Type; + } + + namespace Condition { + type Type = 'decreasing_item_amount' | 'shortening_interval'; + } + } } } diff --git a/types/BillingPortal/ConfigurationsResource.d.ts b/types/BillingPortal/ConfigurationsResource.d.ts index 636feb34ec..52bf0d150b 100644 --- a/types/BillingPortal/ConfigurationsResource.d.ts +++ b/types/BillingPortal/ConfigurationsResource.d.ts @@ -5,14 +5,14 @@ declare module 'stripe' { namespace BillingPortal { interface ConfigurationCreateParams { /** - * The business information shown to customers in the portal. + * Information about the features available in the portal. */ - business_profile: ConfigurationCreateParams.BusinessProfile; + features: ConfigurationCreateParams.Features; /** - * Information about the features available in the portal. + * The business information shown to customers in the portal. */ - features: ConfigurationCreateParams.Features; + business_profile?: ConfigurationCreateParams.BusinessProfile; /** * The default URL to redirect customers to when they click on the portal's link to return to your website. This can be [overriden](https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url) when creating the session. @@ -178,7 +178,7 @@ declare module 'stripe' { /** * The types of subscription updates that are supported. When empty, subscriptions are not updateable. */ - default_allowed_updates: Stripe.Emptyable< + default_allowed_updates?: Stripe.Emptyable< Array >; @@ -190,12 +190,17 @@ declare module 'stripe' { /** * The list of up to 10 products that support subscription updates. */ - products: Stripe.Emptyable>; + products?: Stripe.Emptyable>; /** * Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`. */ proration_behavior?: SubscriptionUpdate.ProrationBehavior; + + /** + * Setting to control when an update should be scheduled at the end of the period instead of applying immediately. + */ + schedule_at_period_end?: SubscriptionUpdate.ScheduleAtPeriodEnd; } namespace SubscriptionUpdate { @@ -217,6 +222,26 @@ declare module 'stripe' { | 'always_invoice' | 'create_prorations' | 'none'; + + interface ScheduleAtPeriodEnd { + /** + * List of conditions. When any condition is true, the update will be scheduled at the end of the current period. + */ + conditions?: Array; + } + + namespace ScheduleAtPeriodEnd { + interface Condition { + /** + * The type of condition. + */ + type: Condition.Type; + } + + namespace Condition { + type Type = 'decreasing_item_amount' | 'shortening_interval'; + } + } } } @@ -433,6 +458,11 @@ declare module 'stripe' { * Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`. */ proration_behavior?: SubscriptionUpdate.ProrationBehavior; + + /** + * Setting to control when an update should be scheduled at the end of the period instead of applying immediately. + */ + schedule_at_period_end?: SubscriptionUpdate.ScheduleAtPeriodEnd; } namespace SubscriptionUpdate { @@ -454,6 +484,28 @@ declare module 'stripe' { | 'always_invoice' | 'create_prorations' | 'none'; + + interface ScheduleAtPeriodEnd { + /** + * List of conditions. When any condition is true, the update will be scheduled at the end of the current period. + */ + conditions?: Stripe.Emptyable< + Array + >; + } + + namespace ScheduleAtPeriodEnd { + interface Condition { + /** + * The type of condition. + */ + type: Condition.Type; + } + + namespace Condition { + type Type = 'decreasing_item_amount' | 'shortening_interval'; + } + } } } diff --git a/types/Capabilities.d.ts b/types/Capabilities.d.ts index 195e9d57cd..d77a45d5d9 100644 --- a/types/Capabilities.d.ts +++ b/types/Capabilities.d.ts @@ -38,7 +38,7 @@ declare module 'stripe' { requirements?: Capability.Requirements; /** - * The status of the capability. Can be `active`, `inactive`, `pending`, or `unrequested`. + * The status of the capability. */ status: Capability.Status; } @@ -51,7 +51,7 @@ declare module 'stripe' { alternatives: Array | null; /** - * Date on which `future_requirements` merges with the main `requirements` hash and `future_requirements` becomes empty. After the transition, `currently_due` requirements may immediately become `past_due`, but the account may also be given a grace period depending on the capability's enablement state prior to transitioning. + * Date on which `future_requirements` becomes the main `requirements` hash and `future_requirements` becomes empty. After the transition, `currently_due` requirements may immediately become `past_due`, but the account may also be given a grace period depending on the capability's enablement state prior to transitioning. */ current_deadline: number | null; @@ -71,7 +71,7 @@ declare module 'stripe' { errors: Array; /** - * Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well. + * Fields you must collect when all thresholds are reached. As they become required, they appear in `currently_due` as well. */ eventually_due: Array; @@ -250,7 +250,7 @@ declare module 'stripe' { errors: Array; /** - * Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well, and `current_deadline` becomes set. + * Fields you must collect when all thresholds are reached. As they become required, they appear in `currently_due` as well, and `current_deadline` becomes set. */ eventually_due: Array; diff --git a/types/Cards.d.ts b/types/Cards.d.ts index a8411949ed..bdbb9b426f 100644 --- a/types/Cards.d.ts +++ b/types/Cards.d.ts @@ -65,6 +65,11 @@ declare module 'stripe' { */ address_zip_check: string | null; + /** + * This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to “unspecified”. + */ + allow_redisplay?: Card.AllowRedisplay | null; + /** * A set of available payout methods for this card. Only values from this set should be passed as the `method` when creating a payout. */ @@ -164,6 +169,11 @@ declare module 'stripe' { networks?: Card.Networks; + /** + * Status of a card based on the card issuer. + */ + regulated_status?: Card.RegulatedStatus | null; + /** * For external accounts that are cards, possible values are `new` and `errored`. If a payout fails, the status is set to `errored` and [scheduled payouts](https://stripe.com/docs/payouts#payout-schedule) are stopped until account details are updated. */ @@ -176,6 +186,8 @@ declare module 'stripe' { } namespace Card { + type AllowRedisplay = 'always' | 'limited' | 'unspecified'; + type AvailablePayoutMethod = 'instant' | 'standard'; interface Networks { @@ -184,6 +196,8 @@ declare module 'stripe' { */ preferred: string | null; } + + type RegulatedStatus = 'regulated' | 'unregulated'; } /** diff --git a/types/Charges.d.ts b/types/Charges.d.ts index e86d7818c0..f9e87b8f5a 100644 --- a/types/Charges.d.ts +++ b/types/Charges.d.ts @@ -312,6 +312,16 @@ declare module 'stripe' { } interface Outcome { + /** + * For charges declined by the network, a 2 digit code which indicates the advice returned by the network on how to proceed with an error. + */ + network_advice_code: string | null; + + /** + * For charges declined by the network, a brand specific 2, 3, or 4 digit code which indicates the reason the authorization failed. + */ + network_decline_code: string | null; + /** * Possible values are `approved_by_network`, `declined_by_network`, `not_sent_to_network`, and `reversed_after_approval`. The value `reversed_after_approval` indicates the payment was [blocked by Stripe](https://stripe.com/docs/declines#blocked-payments) after bank authorization, and may temporarily appear as "pending" on a cardholder's statement. */ @@ -380,6 +390,8 @@ declare module 'stripe' { alipay?: PaymentMethodDetails.Alipay; + alma?: PaymentMethodDetails.Alma; + amazon_pay?: PaymentMethodDetails.AmazonPay; au_becs_debit?: PaymentMethodDetails.AuBecsDebit; @@ -412,20 +424,28 @@ declare module 'stripe' { interac_present?: PaymentMethodDetails.InteracPresent; + kakao_pay?: PaymentMethodDetails.KakaoPay; + klarna?: PaymentMethodDetails.Klarna; konbini?: PaymentMethodDetails.Konbini; + kr_card?: PaymentMethodDetails.KrCard; + link?: PaymentMethodDetails.Link; mobilepay?: PaymentMethodDetails.Mobilepay; multibanco?: PaymentMethodDetails.Multibanco; + naver_pay?: PaymentMethodDetails.NaverPay; + oxxo?: PaymentMethodDetails.Oxxo; p24?: PaymentMethodDetails.P24; + payco?: PaymentMethodDetails.Payco; + paynow?: PaymentMethodDetails.Paynow; paypal?: PaymentMethodDetails.Paypal; @@ -436,6 +456,8 @@ declare module 'stripe' { revolut_pay?: PaymentMethodDetails.RevolutPay; + samsung_pay?: PaymentMethodDetails.SamsungPay; + sepa_credit_transfer?: PaymentMethodDetails.SepaCreditTransfer; sepa_debit?: PaymentMethodDetails.SepaDebit; @@ -591,7 +613,56 @@ declare module 'stripe' { transaction_id: string | null; } - interface AmazonPay {} + interface Alma {} + + interface AmazonPay { + funding?: AmazonPay.Funding; + } + + namespace AmazonPay { + interface Funding { + card?: Funding.Card; + + /** + * funding type of the underlying payment method. + */ + type: 'card' | null; + } + + namespace Funding { + interface Card { + /** + * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. + */ + brand: string | null; + + /** + * Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. + */ + country: string | null; + + /** + * Two-digit number representing the card's expiration month. + */ + exp_month: number | null; + + /** + * Four-digit number representing the card's expiration year. + */ + exp_year: number | null; + + /** + * Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. + */ + funding: string | null; + + /** + * The last four digits of the card. + */ + last4: string | null; + } + } + } interface AuBecsDebit { /** @@ -711,7 +782,7 @@ declare module 'stripe' { authorization_code: string | null; /** - * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ brand: string | null; @@ -796,7 +867,7 @@ declare module 'stripe' { multicapture?: Card.Multicapture; /** - * Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ network: string | null; @@ -805,8 +876,18 @@ declare module 'stripe' { */ network_token?: Card.NetworkToken | null; + /** + * This is used by the financial networks to identify a transaction. Visa calls this the Transaction ID, Mastercard calls this the Trace ID, and American Express calls this the Acquirer Reference Data. The first three digits of the Trace ID is the Financial Network Code, the next 6 digits is the Banknet Reference Number, and the last 4 digits represent the date (MM/DD). This field will be available for successful Visa, Mastercard, or American Express transactions and always null for other card brands. + */ + network_transaction_id?: string | null; + overcapture?: Card.Overcapture; + /** + * Status of a card based on the card issuer. + */ + regulated_status?: Card.RegulatedStatus | null; + /** * Populated if this transaction used 3D Secure authentication. */ @@ -919,6 +1000,8 @@ declare module 'stripe' { type Status = 'available' | 'unavailable'; } + type RegulatedStatus = 'regulated' | 'unregulated'; + interface ThreeDSecure { /** * For authenticated transactions: how the customer was authenticated by @@ -1092,7 +1175,7 @@ declare module 'stripe' { amount_authorized: number | null; /** - * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ brand: string | null; @@ -1174,7 +1257,7 @@ declare module 'stripe' { last4: string | null; /** - * Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ network: string | null; @@ -1571,7 +1654,7 @@ declare module 'stripe' { last4: string | null; /** - * Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ network: string | null; @@ -1656,6 +1739,13 @@ declare module 'stripe' { } } + interface KakaoPay { + /** + * A unique identifier for the buyer as determined by the local payment processor. + */ + buyer_id: string | null; + } + interface Klarna { /** * The payer details for this transaction. @@ -1713,6 +1803,49 @@ declare module 'stripe' { } } + interface KrCard { + /** + * The local credit or debit card brand. + */ + brand: KrCard.Brand | null; + + /** + * A unique identifier for the buyer as determined by the local payment processor. + */ + buyer_id: string | null; + + /** + * The last four digits of the card. This may not be present for American Express cards. + */ + last4: string | null; + } + + namespace KrCard { + type Brand = + | 'bc' + | 'citi' + | 'hana' + | 'hyundai' + | 'jeju' + | 'jeonbuk' + | 'kakaobank' + | 'kbank' + | 'kdbbank' + | 'kookmin' + | 'kwangju' + | 'lotte' + | 'mg' + | 'nh' + | 'post' + | 'samsung' + | 'savingsbank' + | 'shinhan' + | 'shinhyup' + | 'suhyup' + | 'tossbank' + | 'woori'; + } + interface Link { /** * Two-letter ISO code representing the funding source country beneath the Link payment. @@ -1769,6 +1902,13 @@ declare module 'stripe' { reference: string | null; } + interface NaverPay { + /** + * A unique identifier for the buyer as determined by the local payment processor. + */ + buyer_id: string | null; + } + interface Oxxo { /** * OXXO reference number @@ -1825,6 +1965,13 @@ declare module 'stripe' { | 'volkswagen_bank'; } + interface Payco { + /** + * A unique identifier for the buyer as determined by the local payment processor. + */ + buyer_id: string | null; + } + interface Paynow { /** * Reference number associated with this PayNow payment @@ -1895,7 +2042,61 @@ declare module 'stripe' { reference: string | null; } - interface RevolutPay {} + interface RevolutPay { + funding?: RevolutPay.Funding; + } + + namespace RevolutPay { + interface Funding { + card?: Funding.Card; + + /** + * funding type of the underlying payment method. + */ + type: 'card' | null; + } + + namespace Funding { + interface Card { + /** + * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. + */ + brand: string | null; + + /** + * Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. + */ + country: string | null; + + /** + * Two-digit number representing the card's expiration month. + */ + exp_month: number | null; + + /** + * Four-digit number representing the card's expiration year. + */ + exp_year: number | null; + + /** + * Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`. + */ + funding: string | null; + + /** + * The last four digits of the card. + */ + last4: string | null; + } + } + } + + interface SamsungPay { + /** + * A unique identifier for the buyer as determined by the local payment processor. + */ + buyer_id: string | null; + } interface SepaCreditTransfer { /** diff --git a/types/Checkout/Sessions.d.ts b/types/Checkout/Sessions.d.ts index 6ea0510ccb..ab51a90518 100644 --- a/types/Checkout/Sessions.d.ts +++ b/types/Checkout/Sessions.d.ts @@ -30,6 +30,11 @@ declare module 'stripe' { */ object: 'checkout.session'; + /** + * Settings for price localization with [Adaptive Pricing](https://docs.stripe.com/payments/checkout/adaptive-pricing). + */ + adaptive_pricing: Session.AdaptivePricing | null; + /** * When set, provides configuration for actions to take if this Checkout Session expires. */ @@ -301,6 +306,13 @@ declare module 'stripe' { } namespace Session { + interface AdaptivePricing { + /** + * Whether Adaptive Pricing is enabled. + */ + enabled: boolean; + } + interface AfterExpiration { /** * When set, configuration used to recover the Checkout Session on expiry. @@ -490,7 +502,7 @@ declare module 'stripe' { interface TaxId { /** - * The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `hr_oib`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `no_voec`, `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`, `bh_vat`, `kz_bin`, `ng_tin`, `om_vat`, `de_stn`, `ch_uid`, or `unknown` + * The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `hr_oib`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `no_voec`, `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`, `li_vat`, `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`, `al_tin`, `bh_vat`, `kz_bin`, `ng_tin`, `om_vat`, `de_stn`, `ch_uid`, `tz_vat`, `uz_vat`, `uz_tin`, `md_vat`, `ma_vat`, `by_tin`, `ao_tin`, `bs_tin`, `bb_tin`, `cd_nif`, `mr_nif`, `me_pib`, `zw_tin`, `ba_tin`, `gn_nif`, `mk_vat`, `sr_fin`, `sn_ninea`, `am_tin`, `np_pan`, `tj_tin`, `ug_tin`, `zm_tin`, `kh_tin`, or `unknown` */ type: TaxId.Type; @@ -504,20 +516,28 @@ declare module 'stripe' { type Type = | 'ad_nrt' | 'ae_trn' + | 'al_tin' + | 'am_tin' + | 'ao_tin' | 'ar_cuit' | 'au_abn' | 'au_arn' + | 'ba_tin' + | 'bb_tin' | 'bg_uic' | 'bh_vat' | 'bo_tin' | 'br_cnpj' | 'br_cpf' + | 'bs_tin' + | 'by_tin' | 'ca_bn' | 'ca_gst_hst' | 'ca_pst_bc' | 'ca_pst_mb' | 'ca_pst_sk' | 'ca_qst' + | 'cd_nif' | 'ch_uid' | 'ch_vat' | 'cl_tin' @@ -533,6 +553,7 @@ declare module 'stripe' { | 'eu_vat' | 'gb_vat' | 'ge_vat' + | 'gn_nif' | 'hk_br' | 'hr_oib' | 'hu_tin' @@ -544,9 +565,16 @@ declare module 'stripe' { | 'jp_rn' | 'jp_trn' | 'ke_pin' + | 'kh_tin' | 'kr_brn' | 'kz_bin' | 'li_uid' + | 'li_vat' + | 'ma_vat' + | 'md_vat' + | 'me_pib' + | 'mk_vat' + | 'mr_nif' | 'mx_rfc' | 'my_frp' | 'my_itn' @@ -554,6 +582,7 @@ declare module 'stripe' { | 'ng_tin' | 'no_vat' | 'no_voec' + | 'np_pan' | 'nz_gst' | 'om_vat' | 'pe_ruc' @@ -566,17 +595,26 @@ declare module 'stripe' { | 'sg_gst' | 'sg_uen' | 'si_tin' + | 'sn_ninea' + | 'sr_fin' | 'sv_nit' | 'th_vat' + | 'tj_tin' | 'tr_tin' | 'tw_vat' + | 'tz_vat' | 'ua_vat' + | 'ug_tin' | 'unknown' | 'us_ein' | 'uy_ruc' + | 'uz_tin' + | 'uz_vat' | 've_rif' | 'vn_tin' - | 'za_vat'; + | 'za_vat' + | 'zm_tin' + | 'zw_tin'; } } @@ -929,20 +967,28 @@ declare module 'stripe' { ideal?: PaymentMethodOptions.Ideal; + kakao_pay?: PaymentMethodOptions.KakaoPay; + klarna?: PaymentMethodOptions.Klarna; konbini?: PaymentMethodOptions.Konbini; + kr_card?: PaymentMethodOptions.KrCard; + link?: PaymentMethodOptions.Link; mobilepay?: PaymentMethodOptions.Mobilepay; multibanco?: PaymentMethodOptions.Multibanco; + naver_pay?: PaymentMethodOptions.NaverPay; + oxxo?: PaymentMethodOptions.Oxxo; p24?: PaymentMethodOptions.P24; + payco?: PaymentMethodOptions.Payco; + paynow?: PaymentMethodOptions.Paynow; paypal?: PaymentMethodOptions.Paypal; @@ -951,6 +997,8 @@ declare module 'stripe' { revolut_pay?: PaymentMethodOptions.RevolutPay; + samsung_pay?: PaymentMethodOptions.SamsungPay; + sepa_debit?: PaymentMethodOptions.SepaDebit; sofort?: PaymentMethodOptions.Sofort; @@ -1099,6 +1147,8 @@ declare module 'stripe' { } interface BacsDebit { + mandate_options?: BacsDebit.MandateOptions; + /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. * @@ -1112,6 +1162,13 @@ declare module 'stripe' { } namespace BacsDebit { + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'DDIC' or 'STRIPE'. + */ + reference_prefix?: string; + } + type SetupFutureUsage = 'none' | 'off_session' | 'on_session'; } @@ -1153,6 +1210,26 @@ declare module 'stripe' { interface Card { installments?: Card.Installments; + /** + * Request ability to [capture beyond the standard authorization validity window](https://stripe.com/payments/extended-authorization) for this CheckoutSession. + */ + request_extended_authorization?: Card.RequestExtendedAuthorization; + + /** + * Request ability to [increment the authorization](https://stripe.com/payments/incremental-authorization) for this CheckoutSession. + */ + request_incremental_authorization?: Card.RequestIncrementalAuthorization; + + /** + * Request ability to make [multiple captures](https://stripe.com/payments/multicapture) for this CheckoutSession. + */ + request_multicapture?: Card.RequestMulticapture; + + /** + * Request ability to [overcapture](https://stripe.com/payments/overcapture) for this CheckoutSession. + */ + request_overcapture?: Card.RequestOvercapture; + /** * We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. If not provided, this value defaults to `automatic`. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure/authentication-flow#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. */ @@ -1188,6 +1265,14 @@ declare module 'stripe' { enabled?: boolean; } + type RequestExtendedAuthorization = 'if_available' | 'never'; + + type RequestIncrementalAuthorization = 'if_available' | 'never'; + + type RequestMulticapture = 'if_available' | 'never'; + + type RequestOvercapture = 'if_available' | 'never'; + type RequestThreeDSecure = 'any' | 'automatic' | 'challenge'; type SetupFutureUsage = 'none' | 'off_session' | 'on_session'; @@ -1340,6 +1425,28 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface KakaoPay { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. + * + * If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](https://stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead. + * + * When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](https://stripe.com/strong-customer-authentication). + */ + setup_future_usage?: KakaoPay.SetupFutureUsage; + } + + namespace KakaoPay { + type SetupFutureUsage = 'none' | 'off_session'; + } + interface Klarna { /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -1375,6 +1482,28 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface KrCard { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. + * + * If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](https://stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead. + * + * When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](https://stripe.com/strong-customer-authentication). + */ + setup_future_usage?: KrCard.SetupFutureUsage; + } + + namespace KrCard { + type SetupFutureUsage = 'none' | 'off_session'; + } + interface Link { /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -1418,6 +1547,13 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface NaverPay { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + } + interface Oxxo { /** * The number of calendar days before an OXXO invoice expires. For example, if you create an OXXO invoice on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time. @@ -1449,6 +1585,13 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface Payco { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + } + interface Paynow { /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -1518,7 +1661,16 @@ declare module 'stripe' { type SetupFutureUsage = 'none' | 'off_session'; } + interface SamsungPay { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + } + interface SepaDebit { + mandate_options?: SepaDebit.MandateOptions; + /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. * @@ -1532,6 +1684,13 @@ declare module 'stripe' { } namespace SepaDebit { + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'STRIPE'. + */ + reference_prefix?: string; + } + type SetupFutureUsage = 'none' | 'off_session' | 'on_session'; } @@ -2019,7 +2178,7 @@ declare module 'stripe' { type Status = 'complete' | 'expired' | 'open'; - type SubmitType = 'auto' | 'book' | 'donate' | 'pay'; + type SubmitType = 'auto' | 'book' | 'donate' | 'pay' | 'subscribe'; interface TaxIdCollection { /** diff --git a/types/Checkout/SessionsResource.d.ts b/types/Checkout/SessionsResource.d.ts index 84383ac49a..9de715c731 100644 --- a/types/Checkout/SessionsResource.d.ts +++ b/types/Checkout/SessionsResource.d.ts @@ -4,6 +4,11 @@ declare module 'stripe' { namespace Stripe { namespace Checkout { interface SessionCreateParams { + /** + * Settings for price localization with [Adaptive Pricing](https://docs.stripe.com/payments/checkout/adaptive-pricing). + */ + adaptive_pricing?: SessionCreateParams.AdaptivePricing; + /** * Configure actions after a Checkout Session has expired. */ @@ -260,6 +265,13 @@ declare module 'stripe' { } namespace SessionCreateParams { + interface AdaptivePricing { + /** + * Set to `true` to enable [Adaptive Pricing](https://docs.stripe.com/payments/checkout/adaptive-pricing). Defaults to your [dashboard setting](https://dashboard.stripe.com/settings/adaptive-pricing). + */ + enabled?: boolean; + } + interface AfterExpiration { /** * Configure a Checkout Session that can be used to recover an expired session. @@ -285,7 +297,9 @@ declare module 'stripe' { interface AutomaticTax { /** - * Set to true to enable automatic taxes. + * Set to `true` to [calculate tax automatically](https://docs.stripe.com/tax) using the customer's location. + * + * Enabling this parameter causes Checkout to collect any billing address information necessary for tax calculation. */ enabled: boolean; @@ -690,7 +704,7 @@ declare module 'stripe' { namespace LineItem { interface AdjustableQuantity { /** - * Set to true if the quantity can be adjusted to any non-negative integer. By default customers will be able to remove the line item by setting the quantity to 0. + * Set to true if the quantity can be adjusted to any non-negative integer. */ enabled: boolean; @@ -1068,6 +1082,11 @@ declare module 'stripe' { */ ideal?: PaymentMethodOptions.Ideal; + /** + * contains details about the Kakao Pay payment method options. + */ + kakao_pay?: PaymentMethodOptions.KakaoPay; + /** * contains details about the Klarna payment method options. */ @@ -1078,6 +1097,11 @@ declare module 'stripe' { */ konbini?: PaymentMethodOptions.Konbini; + /** + * contains details about the Korean card payment method options. + */ + kr_card?: PaymentMethodOptions.KrCard; + /** * contains details about the Link payment method options. */ @@ -1093,6 +1117,11 @@ declare module 'stripe' { */ multibanco?: PaymentMethodOptions.Multibanco; + /** + * contains details about the Naver Pay payment method options. + */ + naver_pay?: PaymentMethodOptions.NaverPay; + /** * contains details about the OXXO payment method options. */ @@ -1103,6 +1132,11 @@ declare module 'stripe' { */ p24?: PaymentMethodOptions.P24; + /** + * contains details about the PAYCO payment method options. + */ + payco?: PaymentMethodOptions.Payco; + /** * contains details about the PayNow payment method options. */ @@ -1123,6 +1157,11 @@ declare module 'stripe' { */ revolut_pay?: PaymentMethodOptions.RevolutPay; + /** + * contains details about the Samsung Pay payment method options. + */ + samsung_pay?: PaymentMethodOptions.SamsungPay; + /** * contains details about the Sepa Debit payment method options. */ @@ -1293,6 +1332,11 @@ declare module 'stripe' { } interface BacsDebit { + /** + * Additional fields for Mandate creation + */ + mandate_options?: BacsDebit.MandateOptions; + /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. * @@ -1306,6 +1350,13 @@ declare module 'stripe' { } namespace BacsDebit { + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'DDIC' or 'STRIPE'. + */ + reference_prefix?: Stripe.Emptyable; + } + type SetupFutureUsage = 'none' | 'off_session' | 'on_session'; } @@ -1350,6 +1401,26 @@ declare module 'stripe' { */ installments?: Card.Installments; + /** + * Request ability to [capture beyond the standard authorization validity window](https://stripe.com/payments/extended-authorization) for this CheckoutSession. + */ + request_extended_authorization?: Card.RequestExtendedAuthorization; + + /** + * Request ability to [increment the authorization](https://stripe.com/payments/incremental-authorization) for this CheckoutSession. + */ + request_incremental_authorization?: Card.RequestIncrementalAuthorization; + + /** + * Request ability to make [multiple captures](https://stripe.com/payments/multicapture) for this CheckoutSession. + */ + request_multicapture?: Card.RequestMulticapture; + + /** + * Request ability to [overcapture](https://stripe.com/payments/overcapture) for this CheckoutSession. + */ + request_overcapture?: Card.RequestOvercapture; + /** * We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. If not provided, this value defaults to `automatic`. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure/authentication-flow#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine. */ @@ -1386,6 +1457,14 @@ declare module 'stripe' { enabled?: boolean; } + type RequestExtendedAuthorization = 'if_available' | 'never'; + + type RequestIncrementalAuthorization = 'if_available' | 'never'; + + type RequestMulticapture = 'if_available' | 'never'; + + type RequestOvercapture = 'if_available' | 'never'; + type RequestThreeDSecure = 'any' | 'automatic' | 'challenge'; type SetupFutureUsage = 'off_session' | 'on_session'; @@ -1544,6 +1623,28 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface KakaoPay { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. + * + * If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](https://stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead. + * + * When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](https://stripe.com/strong-customer-authentication). + */ + setup_future_usage?: KakaoPay.SetupFutureUsage; + } + + namespace KakaoPay { + type SetupFutureUsage = 'none' | 'off_session'; + } + interface Klarna { /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -1575,6 +1676,28 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface KrCard { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. + * + * If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](https://stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead. + * + * When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](https://stripe.com/strong-customer-authentication). + */ + setup_future_usage?: KrCard.SetupFutureUsage; + } + + namespace KrCard { + type SetupFutureUsage = 'none' | 'off_session'; + } + interface Link { /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -1618,6 +1741,28 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface NaverPay { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. + * + * If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](https://stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead. + * + * When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](https://stripe.com/strong-customer-authentication). + */ + setup_future_usage?: NaverPay.SetupFutureUsage; + } + + namespace NaverPay { + type SetupFutureUsage = 'none' | 'off_session'; + } + interface Oxxo { /** * The number of calendar days before an OXXO voucher expires. For example, if you create an OXXO voucher on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time. @@ -1654,6 +1799,13 @@ declare module 'stripe' { tos_shown_and_accepted?: boolean; } + interface Payco { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + } + interface Paynow { /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -1753,7 +1905,19 @@ declare module 'stripe' { type SetupFutureUsage = 'none' | 'off_session'; } + interface SamsungPay { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + } + interface SepaDebit { + /** + * Additional fields for Mandate creation + */ + mandate_options?: SepaDebit.MandateOptions; + /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. * @@ -1767,6 +1931,13 @@ declare module 'stripe' { } namespace SepaDebit { + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'STRIPE'. + */ + reference_prefix?: Stripe.Emptyable; + } + type SetupFutureUsage = 'none' | 'off_session' | 'on_session'; } @@ -1874,6 +2045,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'amazon_pay' | 'au_becs_debit' | 'bacs_debit' @@ -1888,18 +2060,23 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'kakao_pay' | 'klarna' | 'konbini' + | 'kr_card' | 'link' | 'mobilepay' | 'multibanco' + | 'naver_pay' | 'oxxo' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'pix' | 'promptpay' | 'revolut_pay' + | 'samsung_pay' | 'sepa_debit' | 'sofort' | 'swish' @@ -1957,7 +2134,7 @@ declare module 'stripe' { interface ShippingAddressCollection { /** * An array of two-letter ISO country codes representing which countries Checkout should provide as options for - * shipping locations. Unsupported country codes: `AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI`. + * shipping locations. */ allowed_countries: Array; } @@ -2341,7 +2518,7 @@ declare module 'stripe' { } } - type SubmitType = 'auto' | 'book' | 'donate' | 'pay'; + type SubmitType = 'auto' | 'book' | 'donate' | 'pay' | 'subscribe'; interface SubscriptionData { /** diff --git a/types/ConfirmationTokens.d.ts b/types/ConfirmationTokens.d.ts index 37dafc79fa..d044fb92fc 100644 --- a/types/ConfirmationTokens.d.ts +++ b/types/ConfirmationTokens.d.ts @@ -151,6 +151,8 @@ declare module 'stripe' { */ allow_redisplay?: PaymentMethodPreview.AllowRedisplay; + alma?: PaymentMethodPreview.Alma; + amazon_pay?: PaymentMethodPreview.AmazonPay; au_becs_debit?: PaymentMethodPreview.AuBecsDebit; @@ -190,20 +192,28 @@ declare module 'stripe' { interac_present?: PaymentMethodPreview.InteracPresent; + kakao_pay?: PaymentMethodPreview.KakaoPay; + klarna?: PaymentMethodPreview.Klarna; konbini?: PaymentMethodPreview.Konbini; + kr_card?: PaymentMethodPreview.KrCard; + link?: PaymentMethodPreview.Link; mobilepay?: PaymentMethodPreview.Mobilepay; multibanco?: PaymentMethodPreview.Multibanco; + naver_pay?: PaymentMethodPreview.NaverPay; + oxxo?: PaymentMethodPreview.Oxxo; p24?: PaymentMethodPreview.P24; + payco?: PaymentMethodPreview.Payco; + paynow?: PaymentMethodPreview.Paynow; paypal?: PaymentMethodPreview.Paypal; @@ -214,6 +224,8 @@ declare module 'stripe' { revolut_pay?: PaymentMethodPreview.RevolutPay; + samsung_pay?: PaymentMethodPreview.SamsungPay; + sepa_debit?: PaymentMethodPreview.SepaDebit; sofort?: PaymentMethodPreview.Sofort; @@ -270,6 +282,8 @@ declare module 'stripe' { type AllowRedisplay = 'always' | 'limited' | 'unspecified'; + interface Alma {} + interface AmazonPay {} interface AuBecsDebit { @@ -341,7 +355,7 @@ declare module 'stripe' { interface Card { /** - * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ brand: string; @@ -412,6 +426,11 @@ declare module 'stripe' { */ networks: Card.Networks | null; + /** + * Status of a card based on the card issuer. + */ + regulated_status?: Card.RegulatedStatus | null; + /** * Contains details on how this Card may be used for 3D Secure authentication. */ @@ -476,7 +495,7 @@ declare module 'stripe' { amount_authorized: number | null; /** - * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ brand: string | null; @@ -558,7 +577,7 @@ declare module 'stripe' { last4: string | null; /** - * Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ network: string | null; @@ -700,6 +719,8 @@ declare module 'stripe' { preferred: string | null; } + type RegulatedStatus = 'regulated' | 'unregulated'; + interface ThreeDSecureUsage { /** * Whether 3D Secure is supported on this card. @@ -801,7 +822,7 @@ declare module 'stripe' { interface CardPresent { /** - * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ brand: string | null; @@ -1172,6 +1193,8 @@ declare module 'stripe' { | 'magnetic_stripe_track2'; } + interface KakaoPay {} + interface Klarna { /** * The customer's date of birth, if provided. @@ -1200,6 +1223,44 @@ declare module 'stripe' { interface Konbini {} + interface KrCard { + /** + * The local credit or debit card brand. + */ + brand: KrCard.Brand | null; + + /** + * The last four digits of the card. This may not be present for American Express cards. + */ + last4: string | null; + } + + namespace KrCard { + type Brand = + | 'bc' + | 'citi' + | 'hana' + | 'hyundai' + | 'jeju' + | 'jeonbuk' + | 'kakaobank' + | 'kbank' + | 'kdbbank' + | 'kookmin' + | 'kwangju' + | 'lotte' + | 'mg' + | 'nh' + | 'post' + | 'samsung' + | 'savingsbank' + | 'shinhan' + | 'shinhyup' + | 'suhyup' + | 'tossbank' + | 'woori'; + } + interface Link { /** * Account owner's email address. @@ -1217,6 +1278,17 @@ declare module 'stripe' { interface Multibanco {} + interface NaverPay { + /** + * Whether to fund this transaction with Naver Pay points or a card. + */ + funding: NaverPay.Funding; + } + + namespace NaverPay { + type Funding = 'card' | 'points'; + } + interface Oxxo {} interface P24 { @@ -1256,6 +1328,8 @@ declare module 'stripe' { | 'volkswagen_bank'; } + interface Payco {} + interface Paynow {} interface Paypal { @@ -1277,6 +1351,8 @@ declare module 'stripe' { interface RevolutPay {} + interface SamsungPay {} + interface SepaDebit { /** * Bank code of bank associated with the bank account. @@ -1339,6 +1415,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'amazon_pay' | 'au_becs_debit' | 'bacs_debit' @@ -1355,18 +1432,23 @@ declare module 'stripe' { | 'grabpay' | 'ideal' | 'interac_present' + | 'kakao_pay' | 'klarna' | 'konbini' + | 'kr_card' | 'link' | 'mobilepay' | 'multibanco' + | 'naver_pay' | 'oxxo' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'pix' | 'promptpay' | 'revolut_pay' + | 'samsung_pay' | 'sepa_debit' | 'sofort' | 'swish' diff --git a/types/CreditNoteLineItems.d.ts b/types/CreditNoteLineItems.d.ts index e56b6079dc..28e46ceecb 100644 --- a/types/CreditNoteLineItems.d.ts +++ b/types/CreditNoteLineItems.d.ts @@ -51,6 +51,11 @@ declare module 'stripe' { */ livemode: boolean; + /** + * The pretax credit amounts (ex: discount, credit grants, etc) for this line item. + */ + pretax_credit_amounts?: Array; + /** * The number of units of product being credited. */ @@ -100,6 +105,34 @@ declare module 'stripe' { discount: string | Stripe.Discount | Stripe.DeletedDiscount; } + interface PretaxCreditAmount { + /** + * The amount, in cents (or local equivalent), of the pretax credit amount. + */ + amount: number; + + /** + * The credit balance transaction that was applied to get this pretax credit amount. + */ + credit_balance_transaction?: + | string + | Stripe.Billing.CreditBalanceTransaction; + + /** + * The discount that was applied to get this pretax credit amount. + */ + discount?: string | Stripe.Discount | Stripe.DeletedDiscount; + + /** + * Type of the pretax credit amount referenced. + */ + type: PretaxCreditAmount.Type; + } + + namespace PretaxCreditAmount { + type Type = 'credit_balance_transaction' | 'discount'; + } + interface TaxAmount { /** * The amount, in cents (or local equivalent), of the tax. diff --git a/types/CreditNotes.d.ts b/types/CreditNotes.d.ts index ee619a0f94..7cda890c0a 100644 --- a/types/CreditNotes.d.ts +++ b/types/CreditNotes.d.ts @@ -106,6 +106,11 @@ declare module 'stripe' { */ pdf: string; + /** + * The pretax credit amounts (ex: discount, credit grants, etc) for all line items. + */ + pretax_credit_amounts?: Array; + /** * Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory` */ @@ -175,6 +180,34 @@ declare module 'stripe' { discount: string | Stripe.Discount | Stripe.DeletedDiscount; } + interface PretaxCreditAmount { + /** + * The amount, in cents (or local equivalent), of the pretax credit amount. + */ + amount: number; + + /** + * The credit balance transaction that was applied to get this pretax credit amount. + */ + credit_balance_transaction?: + | string + | Stripe.Billing.CreditBalanceTransaction; + + /** + * The discount that was applied to get this pretax credit amount. + */ + discount?: string | Stripe.Discount | Stripe.DeletedDiscount; + + /** + * Type of the pretax credit amount referenced. + */ + type: PretaxCreditAmount.Type; + } + + namespace PretaxCreditAmount { + type Type = 'credit_balance_transaction' | 'discount'; + } + type Reason = | 'duplicate' | 'fraudulent' diff --git a/types/CreditNotesResource.d.ts b/types/CreditNotesResource.d.ts index c3a3afcaff..ea8fb8a951 100644 --- a/types/CreditNotesResource.d.ts +++ b/types/CreditNotesResource.d.ts @@ -79,7 +79,7 @@ declare module 'stripe' { interface Line { /** - * The line item amount to credit. Only valid when `type` is `invoice_line_item`. + * The line item amount to credit. Only valid when `type` is `invoice_line_item`. If invoice is set up with `automatic_tax[enabled]=true`, this amount is tax exclusive */ amount?: number; @@ -289,7 +289,7 @@ declare module 'stripe' { interface Line { /** - * The line item amount to credit. Only valid when `type` is `invoice_line_item`. + * The line item amount to credit. Only valid when `type` is `invoice_line_item`. If invoice is set up with `automatic_tax[enabled]=true`, this amount is tax exclusive */ amount?: number; @@ -446,7 +446,7 @@ declare module 'stripe' { interface Line { /** - * The line item amount to credit. Only valid when `type` is `invoice_line_item`. + * The line item amount to credit. Only valid when `type` is `invoice_line_item`. If invoice is set up with `automatic_tax[enabled]=true`, this amount is tax exclusive */ amount?: number; diff --git a/types/Customers.d.ts b/types/Customers.d.ts index 7ea03d7ea6..3c55da594b 100644 --- a/types/Customers.d.ts +++ b/types/Customers.d.ts @@ -3,9 +3,8 @@ declare module 'stripe' { namespace Stripe { /** - * This object represents a customer of your business. Use it to create recurring charges and track payments that belong to the same customer. - * - * Related guide: [Save a card during payment](https://stripe.com/docs/payments/save-during-payment) + * This object represents a customer of your business. Use it to [create recurring charges](https://stripe.com/docs/invoicing/customer), [save payment](https://stripe.com/docs/payments/save-during-payment) and contact information, + * and track payments that belong to the same customer. */ interface Customer { /** diff --git a/types/CustomersResource.d.ts b/types/CustomersResource.d.ts index 6151f3097c..fe4c3f7914 100644 --- a/types/CustomersResource.d.ts +++ b/types/CustomersResource.d.ts @@ -220,7 +220,7 @@ declare module 'stripe' { interface TaxIdDatum { /** - * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `kz_bin`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat` + * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `ba_tin`, `bb_tin`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kh_tin`, `kr_brn`, `kz_bin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin` */ type: TaxIdDatum.Type; @@ -234,20 +234,28 @@ declare module 'stripe' { type Type = | 'ad_nrt' | 'ae_trn' + | 'al_tin' + | 'am_tin' + | 'ao_tin' | 'ar_cuit' | 'au_abn' | 'au_arn' + | 'ba_tin' + | 'bb_tin' | 'bg_uic' | 'bh_vat' | 'bo_tin' | 'br_cnpj' | 'br_cpf' + | 'bs_tin' + | 'by_tin' | 'ca_bn' | 'ca_gst_hst' | 'ca_pst_bc' | 'ca_pst_mb' | 'ca_pst_sk' | 'ca_qst' + | 'cd_nif' | 'ch_uid' | 'ch_vat' | 'cl_tin' @@ -263,6 +271,7 @@ declare module 'stripe' { | 'eu_vat' | 'gb_vat' | 'ge_vat' + | 'gn_nif' | 'hk_br' | 'hr_oib' | 'hu_tin' @@ -274,9 +283,16 @@ declare module 'stripe' { | 'jp_rn' | 'jp_trn' | 'ke_pin' + | 'kh_tin' | 'kr_brn' | 'kz_bin' | 'li_uid' + | 'li_vat' + | 'ma_vat' + | 'md_vat' + | 'me_pib' + | 'mk_vat' + | 'mr_nif' | 'mx_rfc' | 'my_frp' | 'my_itn' @@ -284,6 +300,7 @@ declare module 'stripe' { | 'ng_tin' | 'no_vat' | 'no_voec' + | 'np_pan' | 'nz_gst' | 'om_vat' | 'pe_ruc' @@ -296,16 +313,25 @@ declare module 'stripe' { | 'sg_gst' | 'sg_uen' | 'si_tin' + | 'sn_ninea' + | 'sr_fin' | 'sv_nit' | 'th_vat' + | 'tj_tin' | 'tr_tin' | 'tw_vat' + | 'tz_vat' | 'ua_vat' + | 'ug_tin' | 'us_ein' | 'uy_ruc' + | 'uz_tin' + | 'uz_vat' | 've_rif' | 'vn_tin' - | 'za_vat'; + | 'za_vat' + | 'zm_tin' + | 'zw_tin'; } } @@ -518,13 +544,13 @@ declare module 'stripe' { ip_address?: Stripe.Emptyable; /** - * A flag that indicates when Stripe should validate the customer tax location. Defaults to `deferred`. + * A flag that indicates when Stripe should validate the customer tax location. Defaults to `auto`. */ validate_location?: Tax.ValidateLocation; } namespace Tax { - type ValidateLocation = 'deferred' | 'immediately'; + type ValidateLocation = 'auto' | 'deferred' | 'immediately'; } type TaxExempt = 'exempt' | 'none' | 'reverse'; @@ -663,7 +689,7 @@ declare module 'stripe' { interface CustomerCreateTaxIdParams { /** - * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `kz_bin`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat` + * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `ba_tin`, `bb_tin`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kh_tin`, `kr_brn`, `kz_bin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin` */ type: CustomerCreateTaxIdParams.Type; @@ -682,20 +708,28 @@ declare module 'stripe' { type Type = | 'ad_nrt' | 'ae_trn' + | 'al_tin' + | 'am_tin' + | 'ao_tin' | 'ar_cuit' | 'au_abn' | 'au_arn' + | 'ba_tin' + | 'bb_tin' | 'bg_uic' | 'bh_vat' | 'bo_tin' | 'br_cnpj' | 'br_cpf' + | 'bs_tin' + | 'by_tin' | 'ca_bn' | 'ca_gst_hst' | 'ca_pst_bc' | 'ca_pst_mb' | 'ca_pst_sk' | 'ca_qst' + | 'cd_nif' | 'ch_uid' | 'ch_vat' | 'cl_tin' @@ -711,6 +745,7 @@ declare module 'stripe' { | 'eu_vat' | 'gb_vat' | 'ge_vat' + | 'gn_nif' | 'hk_br' | 'hr_oib' | 'hu_tin' @@ -722,9 +757,16 @@ declare module 'stripe' { | 'jp_rn' | 'jp_trn' | 'ke_pin' + | 'kh_tin' | 'kr_brn' | 'kz_bin' | 'li_uid' + | 'li_vat' + | 'ma_vat' + | 'md_vat' + | 'me_pib' + | 'mk_vat' + | 'mr_nif' | 'mx_rfc' | 'my_frp' | 'my_itn' @@ -732,6 +774,7 @@ declare module 'stripe' { | 'ng_tin' | 'no_vat' | 'no_voec' + | 'np_pan' | 'nz_gst' | 'om_vat' | 'pe_ruc' @@ -744,16 +787,25 @@ declare module 'stripe' { | 'sg_gst' | 'sg_uen' | 'si_tin' + | 'sn_ninea' + | 'sr_fin' | 'sv_nit' | 'th_vat' + | 'tj_tin' | 'tr_tin' | 'tw_vat' + | 'tz_vat' | 'ua_vat' + | 'ug_tin' | 'us_ein' | 'uy_ruc' + | 'uz_tin' + | 'uz_vat' | 've_rif' | 'vn_tin' - | 'za_vat'; + | 'za_vat' + | 'zm_tin' + | 'zw_tin'; } interface CustomerDeleteDiscountParams {} @@ -807,6 +859,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'amazon_pay' | 'au_becs_debit' | 'bacs_debit' @@ -821,18 +874,23 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'kakao_pay' | 'klarna' | 'konbini' + | 'kr_card' | 'link' | 'mobilepay' | 'multibanco' + | 'naver_pay' | 'oxxo' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'pix' | 'promptpay' | 'revolut_pay' + | 'samsung_pay' | 'sepa_debit' | 'sofort' | 'swish' diff --git a/types/Disputes.d.ts b/types/Disputes.d.ts index 58b9257af7..9470ff5e83 100644 --- a/types/Disputes.d.ts +++ b/types/Disputes.d.ts @@ -45,6 +45,11 @@ declare module 'stripe' { */ currency: string; + /** + * List of eligibility types that are included in `enhanced_evidence`. + */ + enhanced_eligibility_types: Array<'visa_compelling_evidence_3'>; + evidence: Dispute.Evidence; evidence_details: Dispute.EvidenceDetails; @@ -154,6 +159,8 @@ declare module 'stripe' { */ duplicate_charge_id: string | null; + enhanced_evidence: Evidence.EnhancedEvidence; + /** * A description of the product or service that was sold. */ @@ -225,12 +232,135 @@ declare module 'stripe' { uncategorized_text: string | null; } + namespace Evidence { + interface EnhancedEvidence { + visa_compelling_evidence_3?: EnhancedEvidence.VisaCompellingEvidence3; + + visa_compliance?: EnhancedEvidence.VisaCompliance; + } + + namespace EnhancedEvidence { + interface VisaCompellingEvidence3 { + /** + * Disputed transaction details for Visa Compelling Evidence 3.0 evidence submission. + */ + disputed_transaction: VisaCompellingEvidence3.DisputedTransaction | null; + + /** + * List of exactly two prior undisputed transaction objects for Visa Compelling Evidence 3.0 evidence submission. + */ + prior_undisputed_transactions: Array< + VisaCompellingEvidence3.PriorUndisputedTransaction + >; + } + + namespace VisaCompellingEvidence3 { + interface DisputedTransaction { + /** + * User Account ID used to log into business platform. Must be recognizable by the user. + */ + customer_account_id: string | null; + + /** + * Unique identifier of the cardholder's device derived from a combination of at least two hardware and software attributes. Must be at least 20 characters. + */ + customer_device_fingerprint: string | null; + + /** + * Unique identifier of the cardholder's device such as a device serial number (e.g., International Mobile Equipment Identity [IMEI]). Must be at least 15 characters. + */ + customer_device_id: string | null; + + /** + * The email address of the customer. + */ + customer_email_address: string | null; + + /** + * The IP address that the customer used when making the purchase. + */ + customer_purchase_ip: string | null; + + /** + * Categorization of disputed payment. + */ + merchandise_or_services: DisputedTransaction.MerchandiseOrServices | null; + + /** + * A description of the product or service that was sold. + */ + product_description: string | null; + + /** + * The address to which a physical product was shipped. All fields are required for Visa Compelling Evidence 3.0 evidence submission. + */ + shipping_address: Stripe.Address | null; + } + + namespace DisputedTransaction { + type MerchandiseOrServices = 'merchandise' | 'services'; + } + + interface PriorUndisputedTransaction { + /** + * Stripe charge ID for the Visa Compelling Evidence 3.0 eligible prior charge. + */ + charge: string; + + /** + * User Account ID used to log into business platform. Must be recognizable by the user. + */ + customer_account_id: string | null; + + /** + * Unique identifier of the cardholder's device derived from a combination of at least two hardware and software attributes. Must be at least 20 characters. + */ + customer_device_fingerprint: string | null; + + /** + * Unique identifier of the cardholder's device such as a device serial number (e.g., International Mobile Equipment Identity [IMEI]). Must be at least 15 characters. + */ + customer_device_id: string | null; + + /** + * The email address of the customer. + */ + customer_email_address: string | null; + + /** + * The IP address that the customer used when making the purchase. + */ + customer_purchase_ip: string | null; + + /** + * A description of the product or service that was sold. + */ + product_description: string | null; + + /** + * The address to which a physical product was shipped. All fields are required for Visa Compelling Evidence 3.0 evidence submission. + */ + shipping_address: Stripe.Address | null; + } + } + + interface VisaCompliance { + /** + * A field acknowledging the fee incurred when countering a Visa compliance dispute. If this field is set to true, evidence can be submitted for the compliance dispute. Stripe collects a 500 USD (or local equivalent) amount to cover the network costs associated with resolving compliance disputes. Stripe refunds the 500 USD network fee if you win the dispute. + */ + fee_acknowledged: boolean; + } + } + } + interface EvidenceDetails { /** * Date by which evidence must be submitted in order to successfully challenge dispute. Will be 0 if the customer's bank or credit card company doesn't allow a response for this particular dispute. */ due_by: number | null; + enhanced_eligibility: EvidenceDetails.EnhancedEligibility; + /** * Whether evidence has been staged for this dispute. */ @@ -247,6 +377,50 @@ declare module 'stripe' { submission_count: number; } + namespace EvidenceDetails { + interface EnhancedEligibility { + visa_compelling_evidence_3?: EnhancedEligibility.VisaCompellingEvidence3; + + visa_compliance?: EnhancedEligibility.VisaCompliance; + } + + namespace EnhancedEligibility { + interface VisaCompellingEvidence3 { + /** + * List of actions required to qualify dispute for Visa Compelling Evidence 3.0 evidence submission. + */ + required_actions: Array; + + /** + * Visa Compelling Evidence 3.0 eligibility status. + */ + status: VisaCompellingEvidence3.Status; + } + + namespace VisaCompellingEvidence3 { + type RequiredAction = + | 'missing_customer_identifiers' + | 'missing_disputed_transaction_description' + | 'missing_merchandise_or_services' + | 'missing_prior_undisputed_transaction_description' + | 'missing_prior_undisputed_transactions'; + + type Status = 'not_qualified' | 'qualified' | 'requires_action'; + } + + interface VisaCompliance { + /** + * Visa compliance eligibility status. + */ + status: VisaCompliance.Status; + } + + namespace VisaCompliance { + type Status = 'fee_acknowledged' | 'requires_fee_acknowledgement'; + } + } + } + interface PaymentMethodDetails { amazon_pay?: PaymentMethodDetails.AmazonPay; @@ -276,7 +450,7 @@ declare module 'stripe' { interface Card { /** - * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ brand: string; diff --git a/types/DisputesResource.d.ts b/types/DisputesResource.d.ts index 3bbf30e906..86965a31db 100644 --- a/types/DisputesResource.d.ts +++ b/types/DisputesResource.d.ts @@ -98,6 +98,11 @@ declare module 'stripe' { */ duplicate_charge_id?: string; + /** + * Additional evidence for qualifying evidence programs. + */ + enhanced_evidence?: Stripe.Emptyable; + /** * A description of the product or service that was sold. Has a maximum character count of 20,000. */ @@ -168,6 +173,133 @@ declare module 'stripe' { */ uncategorized_text?: string; } + + namespace Evidence { + interface EnhancedEvidence { + /** + * Evidence provided for Visa Compelling Evidence 3.0 evidence submission. + */ + visa_compelling_evidence_3?: EnhancedEvidence.VisaCompellingEvidence3; + + /** + * Evidence provided for Visa compliance evidence submission. + */ + visa_compliance?: EnhancedEvidence.VisaCompliance; + } + + namespace EnhancedEvidence { + interface VisaCompellingEvidence3 { + /** + * Disputed transaction details for Visa Compelling Evidence 3.0 evidence submission. + */ + disputed_transaction?: VisaCompellingEvidence3.DisputedTransaction; + + /** + * List of exactly two prior undisputed transaction objects for Visa Compelling Evidence 3.0 evidence submission. + */ + prior_undisputed_transactions?: Array< + VisaCompellingEvidence3.PriorUndisputedTransaction + >; + } + + namespace VisaCompellingEvidence3 { + interface DisputedTransaction { + /** + * User Account ID used to log into business platform. Must be recognizable by the user. + */ + customer_account_id?: Stripe.Emptyable; + + /** + * Unique identifier of the cardholder's device derived from a combination of at least two hardware and software attributes. Must be at least 20 characters. + */ + customer_device_fingerprint?: Stripe.Emptyable; + + /** + * Unique identifier of the cardholder's device such as a device serial number (e.g., International Mobile Equipment Identity [IMEI]). Must be at least 15 characters. + */ + customer_device_id?: Stripe.Emptyable; + + /** + * The email address of the customer. + */ + customer_email_address?: Stripe.Emptyable; + + /** + * The IP address that the customer used when making the purchase. + */ + customer_purchase_ip?: Stripe.Emptyable; + + /** + * Categorization of disputed payment. + */ + merchandise_or_services?: DisputedTransaction.MerchandiseOrServices; + + /** + * A description of the product or service that was sold. + */ + product_description?: Stripe.Emptyable; + + /** + * The address to which a physical product was shipped. All fields are required for Visa Compelling Evidence 3.0 evidence submission. + */ + shipping_address?: Stripe.AddressParam; + } + + namespace DisputedTransaction { + type MerchandiseOrServices = 'merchandise' | 'services'; + } + + interface PriorUndisputedTransaction { + /** + * Stripe charge ID for the Visa Compelling Evidence 3.0 eligible prior charge. + */ + charge: string; + + /** + * User Account ID used to log into business platform. Must be recognizable by the user. + */ + customer_account_id?: Stripe.Emptyable; + + /** + * Unique identifier of the cardholder's device derived from a combination of at least two hardware and software attributes. Must be at least 20 characters. + */ + customer_device_fingerprint?: Stripe.Emptyable; + + /** + * Unique identifier of the cardholder's device such as a device serial number (e.g., International Mobile Equipment Identity [IMEI]). Must be at least 15 characters. + */ + customer_device_id?: Stripe.Emptyable; + + /** + * The email address of the customer. + */ + customer_email_address?: Stripe.Emptyable; + + /** + * The IP address that the customer used when making the purchase. + */ + customer_purchase_ip?: Stripe.Emptyable; + + /** + * A description of the product or service that was sold. + */ + product_description?: Stripe.Emptyable; + + /** + * The address to which a physical product was shipped. All fields are required for Visa Compelling Evidence 3.0 evidence submission. + */ + shipping_address?: Stripe.AddressParam; + } + } + + interface VisaCompliance { + /** + * A field acknowledging the fee incurred when countering a Visa compliance dispute. If this field is set to true, evidence can be submitted for the compliance dispute. Stripe collects a 500 USD (or local equivalent) amount to cover the network costs associated with resolving compliance disputes. Stripe refunds the 500 USD network fee if you win the dispute. + */ + fee_acknowledged?: boolean; + } + } + } } interface DisputeListParams extends PaginationParams { diff --git a/types/Errors.d.ts b/types/Errors.d.ts index 0b3a10d639..7f05e43539 100644 --- a/types/Errors.d.ts +++ b/types/Errors.d.ts @@ -1,5 +1,6 @@ declare module 'stripe' { namespace Stripe { + // rawErrorTypeEnum: The beginning of the section generated from our OpenAPI spec export type RawErrorType = | 'card_error' | 'invalid_request_error' @@ -7,10 +8,13 @@ declare module 'stripe' { | 'idempotency_error' | 'rate_limit_error' | 'authentication_error' - | 'invalid_grant'; + | 'invalid_grant' + | 'temporary_session_expired'; + // rawErrorTypeEnum: The end of the section generated from our OpenAPI spec export type StripeRawError = { message?: string; + userMessage?: string; type: RawErrorType; @@ -32,27 +36,35 @@ declare module 'stripe' { }; namespace errors { + /** @deprecated Not for external use. */ function generate( rawError: StripeRawError & {type: 'card_error'} ): StripeCardError; + /** @deprecated Not for external use. */ function generate( rawError: StripeRawError & {type: 'invalid_request_error'} ): StripeInvalidRequestError; + /** @deprecated Not for external use. */ function generate( rawError: StripeRawError & {type: 'api_error'} ): StripeAPIError; + /** @deprecated Not for external use. */ function generate( rawError: StripeRawError & {type: 'authentication_error'} ): StripeAuthenticationError; + /** @deprecated Not for external use. */ function generate( rawError: StripeRawError & {type: 'rate_limit_error'} ): StripeRateLimitError; + /** @deprecated Not for external use. */ function generate( rawError: StripeRawError & {type: 'idempotency_error'} ): StripeIdempotencyError; + /** @deprecated Not for external use. */ function generate( rawError: StripeRawError & {type: 'invalid_grant'} ): StripeInvalidGrantError; + /** @deprecated Not for external use. */ function generate( rawError: StripeRawError & {type: RawErrorType} ): StripeError; @@ -60,27 +72,35 @@ declare module 'stripe' { class StripeError extends Error { constructor(rawError: StripeRawError); + /** @deprecated Not for external use. */ static generate( rawError: StripeRawError & {type: 'card_error'} ): StripeCardError; + /** @deprecated Not for external use. */ static generate( rawError: StripeRawError & {type: 'invalid_request_error'} ): StripeInvalidRequestError; + /** @deprecated Not for external use. */ static generate( rawError: StripeRawError & {type: 'api_error'} ): StripeAPIError; + /** @deprecated Not for external use. */ static generate( rawError: StripeRawError & {type: 'authentication_error'} ): StripeAuthenticationError; + /** @deprecated Not for external use. */ static generate( rawError: StripeRawError & {type: 'rate_limit_error'} ): StripeRateLimitError; + /** @deprecated Not for external use. */ static generate( rawError: StripeRawError & {type: 'idempotency_error'} ): StripeIdempotencyError; + /** @deprecated Not for external use. */ static generate( rawError: StripeRawError & {type: 'invalid_grant'} ): StripeInvalidGrantError; + /** @deprecated Not for external use. */ static generate( rawError: StripeRawError & {type: RawErrorType} ): StripeError; @@ -91,6 +111,7 @@ declare module 'stripe' { */ readonly message: string; + // errorClassNameEnum: The beginning of the section generated from our OpenAPI spec readonly type: | 'StripeError' | 'StripeCardError' @@ -102,7 +123,9 @@ declare module 'stripe' { | 'StripeConnectionError' | 'StripeSignatureVerificationError' | 'StripeIdempotencyError' - | 'StripeInvalidGrantError'; + | 'StripeInvalidGrantError' + | 'TemporarySessionExpiredError'; + // errorClassNameEnum: The end of the section generated from our OpenAPI spec /** * See the "error types" section at https://stripe.com/docs/api/errors @@ -245,6 +268,13 @@ declare module 'stripe' { readonly type: 'StripeInvalidGrantError'; readonly rawType: 'invalid_grant'; } + + // errorClassDefinitions: The beginning of the section generated from our OpenAPI spec + export class TemporarySessionExpiredError extends StripeError { + readonly type: 'TemporarySessionExpiredError'; + readonly rawType: 'temporary_session_expired'; + } + // errorClassDefinitions: The end of the section generated from our OpenAPI spec } } } diff --git a/types/EventTypes.d.ts b/types/EventTypes.d.ts index 54f2e9c05f..7547658c9a 100644 --- a/types/EventTypes.d.ts +++ b/types/EventTypes.d.ts @@ -123,6 +123,7 @@ declare module 'stripe' { | IssuingTokenCreatedEvent | IssuingTokenUpdatedEvent | IssuingTransactionCreatedEvent + | IssuingTransactionPurchaseDetailsReceiptUpdatedEvent | IssuingTransactionUpdatedEvent | MandateUpdatedEvent | PaymentIntentAmountCapturableUpdatedEvent @@ -166,6 +167,7 @@ declare module 'stripe' { | RadarEarlyFraudWarningCreatedEvent | RadarEarlyFraudWarningUpdatedEvent | RefundCreatedEvent + | RefundFailedEvent | RefundUpdatedEvent | ReportingReportRunFailedEvent | ReportingReportRunSucceededEvent @@ -240,7 +242,9 @@ declare module 'stripe' { | TreasuryReceivedCreditFailedEvent | TreasuryReceivedCreditSucceededEvent | TreasuryReceivedDebitCreatedEvent; + } + namespace Stripe { /** * Occurs whenever a user authorizes an application. Sent to the related application only. */ @@ -642,7 +646,7 @@ declare module 'stripe' { } /** - * Occurs whenever a refund is updated, on selected payment methods. + * Occurs whenever a refund is updated on selected payment methods. For updates on all refunds, listen to `refund.updated` instead. */ interface ChargeRefundUpdatedEvent extends EventBase { type: 'charge.refund.updated'; @@ -658,7 +662,7 @@ declare module 'stripe' { } /** - * Occurs whenever a charge is refunded, including partial refunds. + * Occurs whenever a charge is refunded, including partial refunds. Listen to `refund.created` for information about the refund. */ interface ChargeRefundedEvent extends EventBase { type: 'charge.refunded'; @@ -2167,6 +2171,23 @@ declare module 'stripe' { } } + /** + * Occurs whenever an issuing transaction is updated with receipt data. + */ + interface IssuingTransactionPurchaseDetailsReceiptUpdatedEvent + extends EventBase { + type: 'issuing_transaction.purchase_details_receipt_updated'; + data: IssuingTransactionPurchaseDetailsReceiptUpdatedEvent.Data; + } + + namespace IssuingTransactionPurchaseDetailsReceiptUpdatedEvent { + interface Data extends Stripe.Event.Data { + object: Stripe.Issuing.Transaction; + + previous_attributes?: Partial; + } + } + /** * Occurs whenever an issuing transaction is updated. */ @@ -2840,7 +2861,7 @@ declare module 'stripe' { } /** - * Occurs whenever a refund from a customer's cash balance is created. + * Occurs whenever a refund is created. */ interface RefundCreatedEvent extends EventBase { type: 'refund.created'; @@ -2856,7 +2877,23 @@ declare module 'stripe' { } /** - * Occurs whenever a refund from a customer's cash balance is updated. + * Occurs whenever a refund has failed. + */ + interface RefundFailedEvent extends EventBase { + type: 'refund.failed'; + data: RefundFailedEvent.Data; + } + + namespace RefundFailedEvent { + interface Data extends Stripe.Event.Data { + object: Stripe.Refund; + + previous_attributes?: Partial; + } + } + + /** + * Occurs whenever a refund is updated. */ interface RefundUpdatedEvent extends EventBase { type: 'refund.updated'; diff --git a/types/Events.d.ts b/types/Events.d.ts index 229505475a..889191e126 100644 --- a/types/Events.d.ts +++ b/types/Events.d.ts @@ -154,6 +154,7 @@ declare module 'stripe' { | 'issuing_token.created' | 'issuing_token.updated' | 'issuing_transaction.created' + | 'issuing_transaction.purchase_details_receipt_updated' | 'issuing_transaction.updated' | 'mandate.updated' | 'payment_intent.amount_capturable_updated' @@ -197,6 +198,7 @@ declare module 'stripe' { | 'radar.early_fraud_warning.created' | 'radar.early_fraud_warning.updated' | 'refund.created' + | 'refund.failed' | 'refund.updated' | 'reporting.report_run.failed' | 'reporting.report_run.succeeded' diff --git a/types/FileLinksResource.d.ts b/types/FileLinksResource.d.ts index b1eb82f3f7..d0e5ee6f53 100644 --- a/types/FileLinksResource.d.ts +++ b/types/FileLinksResource.d.ts @@ -4,7 +4,7 @@ declare module 'stripe' { namespace Stripe { interface FileLinkCreateParams { /** - * The ID of the file. The file's `purpose` must be one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `identity_document_downloadable`, `issuing_regulatory_reporting`, `pci_document`, `selfie`, `sigma_scheduled_query`, `tax_document_user_upload`, or `terminal_reader_splashscreen`. + * The ID of the file. The file's `purpose` must be one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `financial_account_statement`, `identity_document_downloadable`, `issuing_regulatory_reporting`, `pci_document`, `selfie`, `sigma_scheduled_query`, `tax_document_user_upload`, or `terminal_reader_splashscreen`. */ file: string; diff --git a/types/Files.d.ts b/types/Files.d.ts index f9dd386785..568e0a0906 100644 --- a/types/Files.d.ts +++ b/types/Files.d.ts @@ -78,6 +78,7 @@ declare module 'stripe' { | 'dispute_evidence' | 'document_provider_identity_document' | 'finance_report_run' + | 'financial_account_statement' | 'identity_document' | 'identity_document_downloadable' | 'issuing_regulatory_reporting' diff --git a/types/FilesResource.d.ts b/types/FilesResource.d.ts index 21b257530b..01ecefa189 100644 --- a/types/FilesResource.d.ts +++ b/types/FilesResource.d.ts @@ -90,6 +90,7 @@ declare module 'stripe' { | 'dispute_evidence' | 'document_provider_identity_document' | 'finance_report_run' + | 'financial_account_statement' | 'identity_document' | 'identity_document_downloadable' | 'issuing_regulatory_reporting' diff --git a/types/Forwarding/Requests.d.ts b/types/Forwarding/Requests.d.ts index 278f206228..9eef8b8b93 100644 --- a/types/Forwarding/Requests.d.ts +++ b/types/Forwarding/Requests.d.ts @@ -42,6 +42,11 @@ declare module 'stripe' { */ 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; + /** * The PaymentMethod to insert into the forwarded request. Forwarding previously consumed PaymentMethods is allowed. */ @@ -78,7 +83,8 @@ declare module 'stripe' { | 'card_cvc' | 'card_expiry' | 'card_number' - | 'cardholder_name'; + | 'cardholder_name' + | 'request_signature'; interface RequestContext { /** diff --git a/types/Forwarding/RequestsResource.d.ts b/types/Forwarding/RequestsResource.d.ts index 7ab588437a..c6325fde6c 100644 --- a/types/Forwarding/RequestsResource.d.ts +++ b/types/Forwarding/RequestsResource.d.ts @@ -28,6 +28,11 @@ declare module 'stripe' { * 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; } namespace RequestCreateParams { @@ -35,7 +40,8 @@ declare module 'stripe' { | 'card_cvc' | 'card_expiry' | 'card_number' - | 'cardholder_name'; + | 'cardholder_name' + | 'request_signature'; interface Request { /** diff --git a/types/FundingInstructions.d.ts b/types/FundingInstructions.d.ts index e6f3710f69..aae8d4573b 100644 --- a/types/FundingInstructions.d.ts +++ b/types/FundingInstructions.d.ts @@ -96,11 +96,25 @@ declare module 'stripe' { namespace FinancialAddress { interface Aba { + account_holder_address: Stripe.Address; + + /** + * The account holder name + */ + account_holder_name: string; + /** * The ABA account number */ account_number: string; + /** + * The account type + */ + account_type: string; + + bank_address: Stripe.Address; + /** * The bank name */ @@ -113,11 +127,15 @@ declare module 'stripe' { } interface Iban { + account_holder_address: Stripe.Address; + /** * The name of the person or business that owns the bank account */ account_holder_name: string; + bank_address: Stripe.Address; + /** * The BIC/SWIFT code of the account. */ @@ -135,6 +153,8 @@ declare module 'stripe' { } interface SortCode { + account_holder_address: Stripe.Address; + /** * The name of the person or business that owns the bank account */ @@ -145,6 +165,8 @@ declare module 'stripe' { */ account_number: string; + bank_address: Stripe.Address; + /** * The six-digit sort code */ @@ -152,6 +174,15 @@ declare module 'stripe' { } interface Spei { + account_holder_address: Stripe.Address; + + /** + * The account holder name + */ + account_holder_name: string; + + bank_address: Stripe.Address; + /** * The three-digit bank code */ @@ -179,11 +210,25 @@ declare module 'stripe' { | 'zengin'; interface Swift { + account_holder_address: Stripe.Address; + + /** + * The account holder name + */ + account_holder_name: string; + /** * The account number */ account_number: string; + /** + * The account type + */ + account_type: string; + + bank_address: Stripe.Address; + /** * The bank name */ @@ -204,6 +249,8 @@ declare module 'stripe' { | 'zengin'; interface Zengin { + account_holder_address: Stripe.Address; + /** * The account holder name */ @@ -219,6 +266,8 @@ declare module 'stripe' { */ account_type: string | null; + bank_address: Stripe.Address; + /** * The bank code of the account */ diff --git a/types/Identity/VerificationReports.d.ts b/types/Identity/VerificationReports.d.ts index f48d8d071c..98d165be97 100644 --- a/types/Identity/VerificationReports.d.ts +++ b/types/Identity/VerificationReports.d.ts @@ -75,7 +75,7 @@ declare module 'stripe' { type: VerificationReport.Type; /** - * The configuration token of a Verification Flow from the dashboard. + * The configuration token of a verification flow from the dashboard. */ verification_flow?: string; diff --git a/types/Identity/VerificationSessions.d.ts b/types/Identity/VerificationSessions.d.ts index 8471de8f76..2509e5315f 100644 --- a/types/Identity/VerificationSessions.d.ts +++ b/types/Identity/VerificationSessions.d.ts @@ -101,7 +101,7 @@ declare module 'stripe' { url: string | null; /** - * The configuration token of a Verification Flow from the dashboard. + * The configuration token of a verification flow from the dashboard. */ verification_flow?: string; diff --git a/types/Identity/VerificationSessionsResource.d.ts b/types/Identity/VerificationSessionsResource.d.ts index c1cab70888..31ab42211d 100644 --- a/types/Identity/VerificationSessionsResource.d.ts +++ b/types/Identity/VerificationSessionsResource.d.ts @@ -45,7 +45,7 @@ declare module 'stripe' { type?: VerificationSessionCreateParams.Type; /** - * The ID of a Verification Flow from the Dashboard. See https://docs.stripe.com/identity/verification-flows. + * The ID of a verification flow from the Dashboard. See https://docs.stripe.com/identity/verification-flows. */ verification_flow?: string; } diff --git a/types/InvoiceLineItems.d.ts b/types/InvoiceLineItems.d.ts index 205dfdce99..d57ae60fae 100644 --- a/types/InvoiceLineItems.d.ts +++ b/types/InvoiceLineItems.d.ts @@ -80,6 +80,11 @@ declare module 'stripe' { */ plan: Stripe.Plan | null; + /** + * Contains pretax credit amounts (ex: discount, credit grants, etc) that apply to this line item. + */ + pretax_credit_amounts?: Array | null; + /** * The price of the line item. */ @@ -156,6 +161,35 @@ declare module 'stripe' { start: number; } + interface PretaxCreditAmount { + /** + * The amount, in cents (or local equivalent), of the pretax credit amount. + */ + amount: number; + + /** + * The credit balance transaction that was applied to get this pretax credit amount. + */ + credit_balance_transaction?: + | string + | Stripe.Billing.CreditBalanceTransaction + | null; + + /** + * The discount that was applied to get this pretax credit amount. + */ + discount?: string | Stripe.Discount | Stripe.DeletedDiscount; + + /** + * Type of the pretax credit amount referenced. + */ + type: PretaxCreditAmount.Type; + } + + namespace PretaxCreditAmount { + type Type = 'credit_balance_transaction' | 'discount'; + } + interface ProrationDetails { /** * For a credit proration `line_item`, the original debit line_items to which the credit proration applies. diff --git a/types/Invoices.d.ts b/types/Invoices.d.ts index 4d64c4566d..0249f36479 100644 --- a/types/Invoices.d.ts +++ b/types/Invoices.d.ts @@ -461,6 +461,13 @@ declare module 'stripe' { */ total_excluding_tax: number | null; + /** + * Contains pretax credit amounts (ex: discount, credit grants, etc) that apply to this invoice. This is a combined list of total_pretax_credit_amounts across all invoice line items. + */ + total_pretax_credit_amounts?: Array< + Invoice.TotalPretaxCreditAmount + > | null; + /** * The aggregate amounts calculated per tax rate for all line items. */ @@ -479,6 +486,11 @@ declare module 'stripe' { namespace Invoice { interface AutomaticTax { + /** + * If Stripe disabled automatic tax, this enum describes why. + */ + disabled_reason: AutomaticTax.DisabledReason | null; + /** * Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. */ @@ -496,6 +508,10 @@ declare module 'stripe' { } namespace AutomaticTax { + type DisabledReason = + | 'finalization_requires_location_inputs' + | 'finalization_system_error'; + interface Liability { /** * The connected account being referenced when `type` is `account`. @@ -556,7 +572,7 @@ declare module 'stripe' { interface CustomerTaxId { /** - * The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `hr_oib`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `no_voec`, `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`, `bh_vat`, `kz_bin`, `ng_tin`, `om_vat`, `de_stn`, `ch_uid`, or `unknown` + * The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `hr_oib`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `no_voec`, `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`, `li_vat`, `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`, `al_tin`, `bh_vat`, `kz_bin`, `ng_tin`, `om_vat`, `de_stn`, `ch_uid`, `tz_vat`, `uz_vat`, `uz_tin`, `md_vat`, `ma_vat`, `by_tin`, `ao_tin`, `bs_tin`, `bb_tin`, `cd_nif`, `mr_nif`, `me_pib`, `zw_tin`, `ba_tin`, `gn_nif`, `mk_vat`, `sr_fin`, `sn_ninea`, `am_tin`, `np_pan`, `tj_tin`, `ug_tin`, `zm_tin`, `kh_tin`, or `unknown` */ type: CustomerTaxId.Type; @@ -570,20 +586,28 @@ declare module 'stripe' { type Type = | 'ad_nrt' | 'ae_trn' + | 'al_tin' + | 'am_tin' + | 'ao_tin' | 'ar_cuit' | 'au_abn' | 'au_arn' + | 'ba_tin' + | 'bb_tin' | 'bg_uic' | 'bh_vat' | 'bo_tin' | 'br_cnpj' | 'br_cpf' + | 'bs_tin' + | 'by_tin' | 'ca_bn' | 'ca_gst_hst' | 'ca_pst_bc' | 'ca_pst_mb' | 'ca_pst_sk' | 'ca_qst' + | 'cd_nif' | 'ch_uid' | 'ch_vat' | 'cl_tin' @@ -599,6 +623,7 @@ declare module 'stripe' { | 'eu_vat' | 'gb_vat' | 'ge_vat' + | 'gn_nif' | 'hk_br' | 'hr_oib' | 'hu_tin' @@ -610,9 +635,16 @@ declare module 'stripe' { | 'jp_rn' | 'jp_trn' | 'ke_pin' + | 'kh_tin' | 'kr_brn' | 'kz_bin' | 'li_uid' + | 'li_vat' + | 'ma_vat' + | 'md_vat' + | 'me_pib' + | 'mk_vat' + | 'mr_nif' | 'mx_rfc' | 'my_frp' | 'my_itn' @@ -620,6 +652,7 @@ declare module 'stripe' { | 'ng_tin' | 'no_vat' | 'no_voec' + | 'np_pan' | 'nz_gst' | 'om_vat' | 'pe_ruc' @@ -632,17 +665,26 @@ declare module 'stripe' { | 'sg_gst' | 'sg_uen' | 'si_tin' + | 'sn_ninea' + | 'sr_fin' | 'sv_nit' | 'th_vat' + | 'tj_tin' | 'tr_tin' | 'tw_vat' + | 'tz_vat' | 'ua_vat' + | 'ug_tin' | 'unknown' | 'us_ein' | 'uy_ruc' + | 'uz_tin' + | 'uz_vat' | 've_rif' | 'vn_tin' - | 'za_vat'; + | 'za_vat' + | 'zm_tin' + | 'zw_tin'; } interface CustomField { @@ -711,6 +753,16 @@ declare module 'stripe' { */ message?: string; + /** + * For card errors resulting from a card issuer decline, a 2 digit code which indicates the advice given to merchant by the card network on how to proceed with an error. + */ + network_advice_code?: string; + + /** + * For card errors resulting from a card issuer decline, a brand specific 2, 3, or 4 digit code which indicates the reason the authorization failed. + */ + network_decline_code?: string; + /** * If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field. */ @@ -1179,10 +1231,15 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'jp_credit_transfer' + | 'kakao_pay' | 'konbini' + | 'kr_card' | 'link' | 'multibanco' + | 'naver_pay' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'promptpay' @@ -1396,6 +1453,35 @@ declare module 'stripe' { discount: string | Stripe.Discount | Stripe.DeletedDiscount; } + interface TotalPretaxCreditAmount { + /** + * The amount, in cents (or local equivalent), of the pretax credit amount. + */ + amount: number; + + /** + * The credit balance transaction that was applied to get this pretax credit amount. + */ + credit_balance_transaction?: + | string + | Stripe.Billing.CreditBalanceTransaction + | null; + + /** + * The discount that was applied to get this pretax credit amount. + */ + discount?: string | Stripe.Discount | Stripe.DeletedDiscount; + + /** + * Type of the pretax credit amount referenced. + */ + type: TotalPretaxCreditAmount.Type; + } + + namespace TotalPretaxCreditAmount { + type Type = 'credit_balance_transaction' | 'discount'; + } + interface TotalTaxAmount { /** * The amount, in cents (or local equivalent), of the tax. diff --git a/types/InvoicesResource.d.ts b/types/InvoicesResource.d.ts index 59ab729a1a..718fa262b0 100644 --- a/types/InvoicesResource.d.ts +++ b/types/InvoicesResource.d.ts @@ -23,6 +23,11 @@ declare module 'stripe' { */ automatic_tax?: InvoiceCreateParams.AutomaticTax; + /** + * The time when this invoice should be scheduled to finalize. The invoice will be finalized at this time if it is still in draft state. + */ + automatically_finalizes_at?: number; + /** * Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions. Defaults to `charge_automatically`. */ @@ -261,7 +266,7 @@ declare module 'stripe' { payment_method_options?: PaymentSettings.PaymentMethodOptions; /** - * The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). + * The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). Should not be specified with payment_method_configuration */ payment_method_types?: Stripe.Emptyable< Array @@ -511,10 +516,15 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'jp_credit_transfer' + | 'kakao_pay' | 'konbini' + | 'kr_card' | 'link' | 'multibanco' + | 'naver_pay' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'promptpay' @@ -764,6 +774,11 @@ declare module 'stripe' { */ automatic_tax?: InvoiceUpdateParams.AutomaticTax; + /** + * The time when this invoice should be scheduled to finalize. The invoice will be finalized at this time if it is still in draft state. To turn off automatic finalization, set `auto_advance` to false. + */ + automatically_finalizes_at?: number; + /** * Either `charge_automatically` or `send_invoice`. This field can be updated only on `draft` invoices. */ @@ -965,7 +980,7 @@ declare module 'stripe' { payment_method_options?: PaymentSettings.PaymentMethodOptions; /** - * The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). + * The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). Should not be specified with payment_method_configuration */ payment_method_types?: Stripe.Emptyable< Array @@ -1215,10 +1230,15 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'jp_credit_transfer' + | 'kakao_pay' | 'konbini' + | 'kr_card' | 'link' | 'multibanco' + | 'naver_pay' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'promptpay' @@ -1728,8 +1748,10 @@ declare module 'stripe' { | 'lease_tax' | 'pst' | 'qst' + | 'retail_delivery_fee' | 'rst' | 'sales_tax' + | 'service_tax' | 'vat'; } } @@ -1900,7 +1922,7 @@ declare module 'stripe' { interface TaxId { /** - * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `kz_bin`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat` + * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `ba_tin`, `bb_tin`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kh_tin`, `kr_brn`, `kz_bin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin` */ type: TaxId.Type; @@ -1914,20 +1936,28 @@ declare module 'stripe' { type Type = | 'ad_nrt' | 'ae_trn' + | 'al_tin' + | 'am_tin' + | 'ao_tin' | 'ar_cuit' | 'au_abn' | 'au_arn' + | 'ba_tin' + | 'bb_tin' | 'bg_uic' | 'bh_vat' | 'bo_tin' | 'br_cnpj' | 'br_cpf' + | 'bs_tin' + | 'by_tin' | 'ca_bn' | 'ca_gst_hst' | 'ca_pst_bc' | 'ca_pst_mb' | 'ca_pst_sk' | 'ca_qst' + | 'cd_nif' | 'ch_uid' | 'ch_vat' | 'cl_tin' @@ -1943,6 +1973,7 @@ declare module 'stripe' { | 'eu_vat' | 'gb_vat' | 'ge_vat' + | 'gn_nif' | 'hk_br' | 'hr_oib' | 'hu_tin' @@ -1954,9 +1985,16 @@ declare module 'stripe' { | 'jp_rn' | 'jp_trn' | 'ke_pin' + | 'kh_tin' | 'kr_brn' | 'kz_bin' | 'li_uid' + | 'li_vat' + | 'ma_vat' + | 'md_vat' + | 'me_pib' + | 'mk_vat' + | 'mr_nif' | 'mx_rfc' | 'my_frp' | 'my_itn' @@ -1964,6 +2002,7 @@ declare module 'stripe' { | 'ng_tin' | 'no_vat' | 'no_voec' + | 'np_pan' | 'nz_gst' | 'om_vat' | 'pe_ruc' @@ -1976,16 +2015,25 @@ declare module 'stripe' { | 'sg_gst' | 'sg_uen' | 'si_tin' + | 'sn_ninea' + | 'sr_fin' | 'sv_nit' | 'th_vat' + | 'tj_tin' | 'tr_tin' | 'tw_vat' + | 'tz_vat' | 'ua_vat' + | 'ug_tin' | 'us_ein' | 'uy_ruc' + | 'uz_tin' + | 'uz_vat' | 've_rif' | 'vn_tin' - | 'za_vat'; + | 'za_vat' + | 'zm_tin' + | 'zw_tin'; } } @@ -2694,7 +2742,7 @@ declare module 'stripe' { billing_thresholds?: Stripe.Emptyable; /** - * Delete all usage for a given subscription item. Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`. + * Delete all usage for a given subscription item. You must pass this when deleting a usage records subscription item. `clear_usage` has no effect if the plan has a billing meter attached. */ clear_usage?: boolean; @@ -3078,7 +3126,7 @@ declare module 'stripe' { interface TaxId { /** - * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `kz_bin`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat` + * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `ba_tin`, `bb_tin`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kh_tin`, `kr_brn`, `kz_bin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin` */ type: TaxId.Type; @@ -3092,20 +3140,28 @@ declare module 'stripe' { type Type = | 'ad_nrt' | 'ae_trn' + | 'al_tin' + | 'am_tin' + | 'ao_tin' | 'ar_cuit' | 'au_abn' | 'au_arn' + | 'ba_tin' + | 'bb_tin' | 'bg_uic' | 'bh_vat' | 'bo_tin' | 'br_cnpj' | 'br_cpf' + | 'bs_tin' + | 'by_tin' | 'ca_bn' | 'ca_gst_hst' | 'ca_pst_bc' | 'ca_pst_mb' | 'ca_pst_sk' | 'ca_qst' + | 'cd_nif' | 'ch_uid' | 'ch_vat' | 'cl_tin' @@ -3121,6 +3177,7 @@ declare module 'stripe' { | 'eu_vat' | 'gb_vat' | 'ge_vat' + | 'gn_nif' | 'hk_br' | 'hr_oib' | 'hu_tin' @@ -3132,9 +3189,16 @@ declare module 'stripe' { | 'jp_rn' | 'jp_trn' | 'ke_pin' + | 'kh_tin' | 'kr_brn' | 'kz_bin' | 'li_uid' + | 'li_vat' + | 'ma_vat' + | 'md_vat' + | 'me_pib' + | 'mk_vat' + | 'mr_nif' | 'mx_rfc' | 'my_frp' | 'my_itn' @@ -3142,6 +3206,7 @@ declare module 'stripe' { | 'ng_tin' | 'no_vat' | 'no_voec' + | 'np_pan' | 'nz_gst' | 'om_vat' | 'pe_ruc' @@ -3154,16 +3219,25 @@ declare module 'stripe' { | 'sg_gst' | 'sg_uen' | 'si_tin' + | 'sn_ninea' + | 'sr_fin' | 'sv_nit' | 'th_vat' + | 'tj_tin' | 'tr_tin' | 'tw_vat' + | 'tz_vat' | 'ua_vat' + | 'ug_tin' | 'us_ein' | 'uy_ruc' + | 'uz_tin' + | 'uz_vat' | 've_rif' | 'vn_tin' - | 'za_vat'; + | 'za_vat' + | 'zm_tin' + | 'zw_tin'; } } @@ -3874,7 +3948,7 @@ declare module 'stripe' { billing_thresholds?: Stripe.Emptyable; /** - * Delete all usage for a given subscription item. Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`. + * Delete all usage for a given subscription item. You must pass this when deleting a usage records subscription item. `clear_usage` has no effect if the plan has a billing meter attached. */ clear_usage?: boolean; @@ -4017,7 +4091,7 @@ declare module 'stripe' { >; /** - * Delete all usage for a given subscription item. Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`. + * Delete all usage for a given subscription item. You must pass this when deleting a usage records subscription item. `clear_usage` has no effect if the plan has a billing meter attached. */ clear_usage?: boolean; @@ -4464,7 +4538,7 @@ declare module 'stripe' { interface TaxId { /** - * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `kz_bin`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat` + * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `ba_tin`, `bb_tin`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kh_tin`, `kr_brn`, `kz_bin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin` */ type: TaxId.Type; @@ -4478,20 +4552,28 @@ declare module 'stripe' { type Type = | 'ad_nrt' | 'ae_trn' + | 'al_tin' + | 'am_tin' + | 'ao_tin' | 'ar_cuit' | 'au_abn' | 'au_arn' + | 'ba_tin' + | 'bb_tin' | 'bg_uic' | 'bh_vat' | 'bo_tin' | 'br_cnpj' | 'br_cpf' + | 'bs_tin' + | 'by_tin' | 'ca_bn' | 'ca_gst_hst' | 'ca_pst_bc' | 'ca_pst_mb' | 'ca_pst_sk' | 'ca_qst' + | 'cd_nif' | 'ch_uid' | 'ch_vat' | 'cl_tin' @@ -4507,6 +4589,7 @@ declare module 'stripe' { | 'eu_vat' | 'gb_vat' | 'ge_vat' + | 'gn_nif' | 'hk_br' | 'hr_oib' | 'hu_tin' @@ -4518,9 +4601,16 @@ declare module 'stripe' { | 'jp_rn' | 'jp_trn' | 'ke_pin' + | 'kh_tin' | 'kr_brn' | 'kz_bin' | 'li_uid' + | 'li_vat' + | 'ma_vat' + | 'md_vat' + | 'me_pib' + | 'mk_vat' + | 'mr_nif' | 'mx_rfc' | 'my_frp' | 'my_itn' @@ -4528,6 +4618,7 @@ declare module 'stripe' { | 'ng_tin' | 'no_vat' | 'no_voec' + | 'np_pan' | 'nz_gst' | 'om_vat' | 'pe_ruc' @@ -4540,16 +4631,25 @@ declare module 'stripe' { | 'sg_gst' | 'sg_uen' | 'si_tin' + | 'sn_ninea' + | 'sr_fin' | 'sv_nit' | 'th_vat' + | 'tj_tin' | 'tr_tin' | 'tw_vat' + | 'tz_vat' | 'ua_vat' + | 'ug_tin' | 'us_ein' | 'uy_ruc' + | 'uz_tin' + | 'uz_vat' | 've_rif' | 'vn_tin' - | 'za_vat'; + | 'za_vat' + | 'zm_tin' + | 'zw_tin'; } } @@ -5260,7 +5360,7 @@ declare module 'stripe' { billing_thresholds?: Stripe.Emptyable; /** - * Delete all usage for a given subscription item. Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`. + * Delete all usage for a given subscription item. You must pass this when deleting a usage records subscription item. `clear_usage` has no effect if the plan has a billing meter attached. */ clear_usage?: boolean; @@ -5403,7 +5503,7 @@ declare module 'stripe' { >; /** - * Delete all usage for a given subscription item. Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`. + * Delete all usage for a given subscription item. You must pass this when deleting a usage records subscription item. `clear_usage` has no effect if the plan has a billing meter attached. */ clear_usage?: boolean; @@ -5814,8 +5914,10 @@ declare module 'stripe' { | 'lease_tax' | 'pst' | 'qst' + | 'retail_delivery_fee' | 'rst' | 'sales_tax' + | 'service_tax' | 'vat'; } } @@ -6052,8 +6154,10 @@ declare module 'stripe' { | 'lease_tax' | 'pst' | 'qst' + | 'retail_delivery_fee' | 'rst' | 'sales_tax' + | 'service_tax' | 'vat'; } } diff --git a/types/Issuing/Authorizations.d.ts b/types/Issuing/Authorizations.d.ts index 56d01ceb0b..652fe8a176 100644 --- a/types/Issuing/Authorizations.d.ts +++ b/types/Issuing/Authorizations.d.ts @@ -47,7 +47,7 @@ declare module 'stripe' { balance_transactions: Array; /** - * You can [create physical or virtual cards](https://stripe.com/docs/issuing/cards) that are issued to cardholders. + * You can [create physical or virtual cards](https://stripe.com/docs/issuing) that are issued to cardholders. */ card: Stripe.Issuing.Card; @@ -71,6 +71,11 @@ declare module 'stripe' { */ fleet: Authorization.Fleet | null; + /** + * Fraud challenges sent to the cardholder, if this authorization was declined for fraud risk reasons. + */ + fraud_challenges?: Array | null; + /** * Information about fuel that was purchased with this transaction. Typically this information is received from the merchant after the authorization has been approved and the fuel dispensed. */ @@ -135,6 +140,11 @@ declare module 'stripe' { verification_data: Authorization.VerificationData; + /** + * Whether the authorization bypassed fraud risk checks because the cardholder has previously completed a fraud challenge on a similar high-risk authorization from the same merchant. + */ + verified_by_fraud_challenge: boolean | null; + /** * The digital wallet used for this transaction. One of `apple_pay`, `google_pay`, or `samsung_pay`. Will populate as `null` when no digital wallet was utilized. */ @@ -273,6 +283,36 @@ declare module 'stripe' { | 'self_service'; } + interface FraudChallenge { + /** + * The method by which the fraud challenge was delivered to the cardholder. + */ + channel: 'sms'; + + /** + * The status of the fraud challenge. + */ + status: FraudChallenge.Status; + + /** + * If the challenge is not deliverable, the reason why. + */ + undeliverable_reason: FraudChallenge.UndeliverableReason | null; + } + + namespace FraudChallenge { + type Status = + | 'expired' + | 'pending' + | 'rejected' + | 'undeliverable' + | 'verified'; + + type UndeliverableReason = + | 'no_phone_number' + | 'unsupported_phone_number'; + } + interface Fuel { /** * [Conexxus Payment System Product Code](https://www.conexxus.org/conexxus-payment-system-product-codes) identifying the primary fuel product purchased. @@ -360,6 +400,11 @@ declare module 'stripe' { */ state: string | null; + /** + * The seller's tax identification number. Currently populated for French merchants only. + */ + tax_id?: string | null; + /** * An ID assigned by the seller to the location of the sale. */ diff --git a/types/Issuing/Cardholders.d.ts b/types/Issuing/Cardholders.d.ts index 2d6e1904d1..0c0558cf7b 100644 --- a/types/Issuing/Cardholders.d.ts +++ b/types/Issuing/Cardholders.d.ts @@ -6,7 +6,7 @@ declare module 'stripe' { /** * An Issuing `Cardholder` object represents an individual or business entity who is [issued](https://stripe.com/docs/issuing) cards. * - * Related guide: [How to create a cardholder](https://stripe.com/docs/issuing/cards#create-cardholder) + * Related guide: [How to create a cardholder](https://stripe.com/docs/issuing/cards/virtual/issue-cards#create-cardholder) */ interface Cardholder { /** diff --git a/types/Issuing/Cards.d.ts b/types/Issuing/Cards.d.ts index a87ef5d1f9..2e15aaa0de 100644 --- a/types/Issuing/Cards.d.ts +++ b/types/Issuing/Cards.d.ts @@ -4,7 +4,7 @@ declare module 'stripe' { namespace Stripe { namespace Issuing { /** - * You can [create physical or virtual cards](https://stripe.com/docs/issuing/cards) that are issued to cardholders. + * You can [create physical or virtual cards](https://stripe.com/docs/issuing) that are issued to cardholders. */ interface Card { /** @@ -30,7 +30,7 @@ declare module 'stripe' { /** * An Issuing `Cardholder` object represents an individual or business entity who is [issued](https://stripe.com/docs/issuing) cards. * - * Related guide: [How to create a cardholder](https://stripe.com/docs/issuing/cards#create-cardholder) + * Related guide: [How to create a cardholder](https://stripe.com/docs/issuing/cards/virtual/issue-cards#create-cardholder) */ cardholder: Stripe.Issuing.Cardholder; diff --git a/types/Issuing/CardsResource.d.ts b/types/Issuing/CardsResource.d.ts index 6dda2d6910..bc141ec6a8 100644 --- a/types/Issuing/CardsResource.d.ts +++ b/types/Issuing/CardsResource.d.ts @@ -52,7 +52,7 @@ declare module 'stripe' { replacement_reason?: CardCreateParams.ReplacementReason; /** - * The second line to print on the card. + * The second line to print on the card. Max length: 24 characters. */ second_line?: Stripe.Emptyable; diff --git a/types/Issuing/Transactions.d.ts b/types/Issuing/Transactions.d.ts index 49b4dee5d7..8916e39fed 100644 --- a/types/Issuing/Transactions.d.ts +++ b/types/Issuing/Transactions.d.ts @@ -173,6 +173,11 @@ declare module 'stripe' { */ state: string | null; + /** + * The seller's tax identification number. Currently populated for French merchants only. + */ + tax_id?: string | null; + /** * An ID assigned by the seller to the location of the sale. */ diff --git a/types/LineItems.d.ts b/types/LineItems.d.ts index 04e6b8f558..c18577584a 100644 --- a/types/LineItems.d.ts +++ b/types/LineItems.d.ts @@ -44,7 +44,7 @@ declare module 'stripe' { /** * An arbitrary string attached to the object. Often useful for displaying to users. Defaults to product name. */ - description?: string; + description: string | null; /** * The discounts applied to the line item. diff --git a/types/Mandates.d.ts b/types/Mandates.d.ts index 27b709e2b9..70c0e93ffa 100644 --- a/types/Mandates.d.ts +++ b/types/Mandates.d.ts @@ -100,6 +100,10 @@ declare module 'stripe' { cashapp?: PaymentMethodDetails.Cashapp; + kakao_pay?: PaymentMethodDetails.KakaoPay; + + kr_card?: PaymentMethodDetails.KrCard; + link?: PaymentMethodDetails.Link; paypal?: PaymentMethodDetails.Paypal; @@ -193,6 +197,10 @@ declare module 'stripe' { interface Cashapp {} + interface KakaoPay {} + + interface KrCard {} + interface Link {} interface Paypal { diff --git a/types/PaymentIntents.d.ts b/types/PaymentIntents.d.ts index d0c3b94a3a..84101ec4b3 100644 --- a/types/PaymentIntents.d.ts +++ b/types/PaymentIntents.d.ts @@ -152,7 +152,7 @@ declare module 'stripe' { payment_method: string | Stripe.PaymentMethod | null; /** - * Information about the payment method configuration used for this PaymentIntent. + * Information about the [payment method configuration](https://stripe.com/docs/api/payment_method_configurations) used for this PaymentIntent. */ payment_method_configuration_details: PaymentIntent.PaymentMethodConfigurationDetails | null; @@ -305,6 +305,16 @@ declare module 'stripe' { */ message?: string; + /** + * For card errors resulting from a card issuer decline, a 2 digit code which indicates the advice given to merchant by the card network on how to proceed with an error. + */ + network_advice_code?: string; + + /** + * For card errors resulting from a card issuer decline, a brand specific 2, 3, or 4 digit code which indicates the reason the authorization failed. + */ + network_decline_code?: string; + /** * If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field. */ @@ -774,11 +784,25 @@ declare module 'stripe' { namespace FinancialAddress { interface Aba { + account_holder_address: Stripe.Address; + + /** + * The account holder name + */ + account_holder_name: string; + /** * The ABA account number */ account_number: string; + /** + * The account type + */ + account_type: string; + + bank_address: Stripe.Address; + /** * The bank name */ @@ -791,11 +815,15 @@ declare module 'stripe' { } interface Iban { + account_holder_address: Stripe.Address; + /** * The name of the person or business that owns the bank account */ account_holder_name: string; + bank_address: Stripe.Address; + /** * The BIC/SWIFT code of the account. */ @@ -813,6 +841,8 @@ declare module 'stripe' { } interface SortCode { + account_holder_address: Stripe.Address; + /** * The name of the person or business that owns the bank account */ @@ -823,6 +853,8 @@ declare module 'stripe' { */ account_number: string; + bank_address: Stripe.Address; + /** * The six-digit sort code */ @@ -830,6 +862,15 @@ declare module 'stripe' { } interface Spei { + account_holder_address: Stripe.Address; + + /** + * The account holder name + */ + account_holder_name: string; + + bank_address: Stripe.Address; + /** * The three-digit bank code */ @@ -857,11 +898,25 @@ declare module 'stripe' { | 'zengin'; interface Swift { + account_holder_address: Stripe.Address; + + /** + * The account holder name + */ + account_holder_name: string; + /** * The account number */ account_number: string; + /** + * The account type + */ + account_type: string; + + bank_address: Stripe.Address; + /** * The bank name */ @@ -882,6 +937,8 @@ declare module 'stripe' { | 'zengin'; interface Zengin { + account_holder_address: Stripe.Address; + /** * The account holder name */ @@ -897,6 +954,8 @@ declare module 'stripe' { */ account_type: string | null; + bank_address: Stripe.Address; + /** * The bank code of the account */ @@ -1286,6 +1345,8 @@ declare module 'stripe' { alipay?: PaymentMethodOptions.Alipay; + alma?: PaymentMethodOptions.Alma; + amazon_pay?: PaymentMethodOptions.AmazonPay; au_becs_debit?: PaymentMethodOptions.AuBecsDebit; @@ -1318,20 +1379,28 @@ declare module 'stripe' { interac_present?: PaymentMethodOptions.InteracPresent; + kakao_pay?: PaymentMethodOptions.KakaoPay; + klarna?: PaymentMethodOptions.Klarna; konbini?: PaymentMethodOptions.Konbini; + kr_card?: PaymentMethodOptions.KrCard; + link?: PaymentMethodOptions.Link; mobilepay?: PaymentMethodOptions.Mobilepay; multibanco?: PaymentMethodOptions.Multibanco; + naver_pay?: PaymentMethodOptions.NaverPay; + oxxo?: PaymentMethodOptions.Oxxo; p24?: PaymentMethodOptions.P24; + payco?: PaymentMethodOptions.Payco; + paynow?: PaymentMethodOptions.Paynow; paypal?: PaymentMethodOptions.Paypal; @@ -1342,6 +1411,8 @@ declare module 'stripe' { revolut_pay?: PaymentMethodOptions.RevolutPay; + samsung_pay?: PaymentMethodOptions.SamsungPay; + sepa_debit?: PaymentMethodOptions.SepaDebit; sofort?: PaymentMethodOptions.Sofort; @@ -1476,6 +1547,13 @@ declare module 'stripe' { type SetupFutureUsage = 'none' | 'off_session'; } + interface Alma { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + } + interface AmazonPay { /** * Controls when the funds will be captured from the customer's account. @@ -1531,7 +1609,12 @@ declare module 'stripe' { } namespace BacsDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'DDIC' or 'STRIPE'. + */ + reference_prefix?: string; + } type SetupFutureUsage = 'none' | 'off_session' | 'on_session'; } @@ -1788,6 +1871,7 @@ declare module 'stripe' { | 'girocard' | 'interac' | 'jcb' + | 'link' | 'mastercard' | 'unionpay' | 'unknown' @@ -1993,6 +2077,28 @@ declare module 'stripe' { interface InteracPresent {} + interface KakaoPay { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. + * + * If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](https://stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead. + * + * When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](https://stripe.com/strong-customer-authentication). + */ + setup_future_usage?: KakaoPay.SetupFutureUsage; + } + + namespace KakaoPay { + type SetupFutureUsage = 'none' | 'off_session'; + } + interface Klarna { /** * Controls when the funds will be captured from the customer's account. @@ -2049,6 +2155,28 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface KrCard { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. + * + * If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](https://stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead. + * + * When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](https://stripe.com/strong-customer-authentication). + */ + setup_future_usage?: KrCard.SetupFutureUsage; + } + + namespace KrCard { + type SetupFutureUsage = 'none' | 'off_session'; + } + interface Link { /** * Controls when the funds will be captured from the customer's account. @@ -2108,6 +2236,13 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface NaverPay { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + } + interface Oxxo { /** * The number of calendar days before an OXXO invoice expires. For example, if you create an OXXO invoice on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time. @@ -2139,6 +2274,13 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface Payco { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + } + interface Paynow { /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -2242,6 +2384,13 @@ declare module 'stripe' { type SetupFutureUsage = 'none' | 'off_session'; } + interface SamsungPay { + /** + * Controls when the funds will be captured from the customer's account. + */ + capture_method?: 'manual'; + } + interface SepaDebit { mandate_options?: SepaDebit.MandateOptions; @@ -2258,7 +2407,12 @@ declare module 'stripe' { } namespace SepaDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'STRIPE'. + */ + reference_prefix?: string; + } type SetupFutureUsage = 'none' | 'off_session' | 'on_session'; } @@ -2296,7 +2450,7 @@ declare module 'stripe' { interface Swish { /** - * The order ID displayed in the Swish app after the payment is authorized. + * A reference for this payment to be displayed in the Swish app. */ reference: string | null; diff --git a/types/PaymentIntentsResource.d.ts b/types/PaymentIntentsResource.d.ts index a612f7262e..d29e9dd74f 100644 --- a/types/PaymentIntentsResource.d.ts +++ b/types/PaymentIntentsResource.d.ts @@ -102,7 +102,7 @@ declare module 'stripe' { payment_method?: string; /** - * The ID of the payment method configuration to use with this PaymentIntent. + * The ID of the [payment method configuration](https://stripe.com/docs/api/payment_method_configurations) to use with this PaymentIntent. */ payment_method_configuration?: string; @@ -119,7 +119,7 @@ declare module 'stripe' { payment_method_options?: PaymentIntentCreateParams.PaymentMethodOptions; /** - * The list of payment method types (for example, a card) that this PaymentIntent can use. If you don't provide this, it defaults to ["card"]. Use `automatic_payment_methods` to manage payment methods from the [Stripe Dashboard](https://dashboard.stripe.com/settings/payment_methods). + * The list of payment method types (for example, a card) that this PaymentIntent can use. If you don't provide this, Stripe will dynamically show relevant payment methods from your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). */ payment_method_types?: Array; @@ -283,6 +283,11 @@ declare module 'stripe' { */ allow_redisplay?: PaymentMethodData.AllowRedisplay; + /** + * If this is a Alma PaymentMethod, this hash contains details about the Alma payment method. + */ + alma?: PaymentMethodData.Alma; + /** * If this is a AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method. */ @@ -358,6 +363,11 @@ declare module 'stripe' { */ interac_present?: PaymentMethodData.InteracPresent; + /** + * If this is a `kakao_pay` PaymentMethod, this hash contains details about the Kakao Pay payment method. + */ + kakao_pay?: PaymentMethodData.KakaoPay; + /** * If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. */ @@ -368,6 +378,11 @@ declare module 'stripe' { */ konbini?: PaymentMethodData.Konbini; + /** + * If this is a `kr_card` PaymentMethod, this hash contains details about the Korean Card payment method. + */ + kr_card?: PaymentMethodData.KrCard; + /** * If this is an `Link` PaymentMethod, this hash contains details about the Link payment method. */ @@ -388,6 +403,11 @@ declare module 'stripe' { */ multibanco?: PaymentMethodData.Multibanco; + /** + * If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method. + */ + naver_pay?: PaymentMethodData.NaverPay; + /** * If this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method. */ @@ -398,6 +418,11 @@ declare module 'stripe' { */ p24?: PaymentMethodData.P24; + /** + * If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. + */ + payco?: PaymentMethodData.Payco; + /** * If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. */ @@ -428,6 +453,11 @@ declare module 'stripe' { */ revolut_pay?: PaymentMethodData.RevolutPay; + /** + * If this is a `samsung_pay` PaymentMethod, this hash contains details about the SamsungPay payment method. + */ + samsung_pay?: PaymentMethodData.SamsungPay; + /** * If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. */ @@ -495,6 +525,8 @@ declare module 'stripe' { type AllowRedisplay = 'always' | 'limited' | 'unspecified'; + interface Alma {} + interface AmazonPay {} interface AuBecsDebit { @@ -643,7 +675,7 @@ declare module 'stripe' { interface Ideal { /** - * The customer's bank. + * The customer's bank. Only use this parameter for existing customers. Don't use it for new customers. */ bank?: Ideal.Bank; } @@ -670,6 +702,8 @@ declare module 'stripe' { interface InteracPresent {} + interface KakaoPay {} + interface Klarna { /** * Customer's date of birth @@ -698,12 +732,25 @@ declare module 'stripe' { interface Konbini {} + interface KrCard {} + interface Link {} interface Mobilepay {} interface Multibanco {} + interface NaverPay { + /** + * Whether to use Naver Pay points or a card to fund this transaction. If not provided, this defaults to `card`. + */ + funding?: NaverPay.Funding; + } + + namespace NaverPay { + type Funding = 'card' | 'points'; + } + interface Oxxo {} interface P24 { @@ -743,6 +790,8 @@ declare module 'stripe' { | 'volkswagen_bank'; } + interface Payco {} + interface Paynow {} interface Paypal {} @@ -760,6 +809,8 @@ declare module 'stripe' { interface RevolutPay {} + interface SamsungPay {} + interface SepaDebit { /** * IBAN of the bank account. @@ -787,6 +838,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'amazon_pay' | 'au_becs_debit' | 'bacs_debit' @@ -800,18 +852,23 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'kakao_pay' | 'klarna' | 'konbini' + | 'kr_card' | 'link' | 'mobilepay' | 'multibanco' + | 'naver_pay' | 'oxxo' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'pix' | 'promptpay' | 'revolut_pay' + | 'samsung_pay' | 'sepa_debit' | 'sofort' | 'swish' @@ -881,6 +938,11 @@ declare module 'stripe' { */ alipay?: Stripe.Emptyable; + /** + * If this is a `alma` PaymentMethod, this sub-hash contains details about the Alma payment method options. + */ + alma?: Stripe.Emptyable; + /** * If this is a `amazon_pay` PaymentMethod, this sub-hash contains details about the Amazon Pay payment method options. */ @@ -963,6 +1025,11 @@ declare module 'stripe' { */ interac_present?: Stripe.Emptyable; + /** + * If this is a `kakao_pay` PaymentMethod, this sub-hash contains details about the Kakao Pay payment method options. + */ + kakao_pay?: Stripe.Emptyable; + /** * If this is a `klarna` PaymentMethod, this sub-hash contains details about the Klarna payment method options. */ @@ -973,6 +1040,11 @@ declare module 'stripe' { */ konbini?: Stripe.Emptyable; + /** + * If this is a `kr_card` PaymentMethod, this sub-hash contains details about the KR Card payment method options. + */ + kr_card?: Stripe.Emptyable; + /** * If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. */ @@ -988,6 +1060,11 @@ declare module 'stripe' { */ multibanco?: Stripe.Emptyable; + /** + * If this is a `naver_pay` PaymentMethod, this sub-hash contains details about the Naver Pay payment method options. + */ + naver_pay?: Stripe.Emptyable; + /** * If this is a `oxxo` PaymentMethod, this sub-hash contains details about the OXXO payment method options. */ @@ -998,6 +1075,11 @@ declare module 'stripe' { */ p24?: Stripe.Emptyable; + /** + * If this is a `payco` PaymentMethod, this sub-hash contains details about the PAYCO payment method options. + */ + payco?: Stripe.Emptyable; + /** * If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options. */ @@ -1023,6 +1105,11 @@ declare module 'stripe' { */ revolut_pay?: Stripe.Emptyable; + /** + * If this is a `samsung_pay` PaymentMethod, this sub-hash contains details about the Samsung Pay payment method options. + */ + samsung_pay?: Stripe.Emptyable; + /** * If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options. */ @@ -1199,6 +1286,17 @@ declare module 'stripe' { type SetupFutureUsage = 'none' | 'off_session'; } + interface Alma { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + } + interface AmazonPay { /** * Controls when the funds are captured from the customer's account. @@ -1265,7 +1363,12 @@ declare module 'stripe' { } namespace BacsDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'DDIC' or 'STRIPE'. + */ + reference_prefix?: Stripe.Emptyable; + } type SetupFutureUsage = 'none' | 'off_session' | 'on_session'; } @@ -1537,6 +1640,7 @@ declare module 'stripe' { | 'girocard' | 'interac' | 'jcb' + | 'link' | 'mastercard' | 'unionpay' | 'unknown' @@ -1861,6 +1965,32 @@ declare module 'stripe' { interface InteracPresent {} + interface KakaoPay { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. + * + * If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](https://stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead. + * + * When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](https://stripe.com/strong-customer-authentication). + */ + setup_future_usage?: Stripe.Emptyable; + } + + namespace KakaoPay { + type SetupFutureUsage = 'none' | 'off_session'; + } + interface Klarna { /** * Controls when the funds are captured from the customer's account. @@ -1975,6 +2105,32 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface KrCard { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. + * + * If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](https://stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead. + * + * When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](https://stripe.com/strong-customer-authentication). + */ + setup_future_usage?: Stripe.Emptyable; + } + + namespace KrCard { + type SetupFutureUsage = 'none' | 'off_session'; + } + interface Link { /** * Controls when the funds are captured from the customer's account. @@ -2048,6 +2204,17 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface NaverPay { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + } + interface Oxxo { /** * The number of calendar days before an OXXO voucher expires. For example, if you create an OXXO voucher on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time. @@ -2088,6 +2255,17 @@ declare module 'stripe' { tos_shown_and_accepted?: boolean; } + interface Payco { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + } + interface Paynow { /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -2231,6 +2409,17 @@ declare module 'stripe' { type SetupFutureUsage = 'none' | 'off_session'; } + interface SamsungPay { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + } + interface SepaDebit { /** * Additional fields for Mandate creation @@ -2252,7 +2441,12 @@ declare module 'stripe' { } namespace SepaDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'STRIPE'. + */ + reference_prefix?: Stripe.Emptyable; + } type SetupFutureUsage = 'none' | 'off_session' | 'on_session'; } @@ -2292,7 +2486,7 @@ declare module 'stripe' { interface Swish { /** - * The order ID displayed in the Swish app after the payment is authorized. + * A reference for this payment to be displayed in the Swish app. */ reference?: Stripe.Emptyable; @@ -2602,7 +2796,7 @@ declare module 'stripe' { payment_method?: string; /** - * The ID of the payment method configuration to use with this PaymentIntent. + * The ID of the [payment method configuration](https://stripe.com/docs/api/payment_method_configurations) to use with this PaymentIntent. */ payment_method_configuration?: string; @@ -2700,6 +2894,11 @@ declare module 'stripe' { */ allow_redisplay?: PaymentMethodData.AllowRedisplay; + /** + * If this is a Alma PaymentMethod, this hash contains details about the Alma payment method. + */ + alma?: PaymentMethodData.Alma; + /** * If this is a AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method. */ @@ -2775,6 +2974,11 @@ declare module 'stripe' { */ interac_present?: PaymentMethodData.InteracPresent; + /** + * If this is a `kakao_pay` PaymentMethod, this hash contains details about the Kakao Pay payment method. + */ + kakao_pay?: PaymentMethodData.KakaoPay; + /** * If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. */ @@ -2785,6 +2989,11 @@ declare module 'stripe' { */ konbini?: PaymentMethodData.Konbini; + /** + * If this is a `kr_card` PaymentMethod, this hash contains details about the Korean Card payment method. + */ + kr_card?: PaymentMethodData.KrCard; + /** * If this is an `Link` PaymentMethod, this hash contains details about the Link payment method. */ @@ -2805,6 +3014,11 @@ declare module 'stripe' { */ multibanco?: PaymentMethodData.Multibanco; + /** + * If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method. + */ + naver_pay?: PaymentMethodData.NaverPay; + /** * If this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method. */ @@ -2815,6 +3029,11 @@ declare module 'stripe' { */ p24?: PaymentMethodData.P24; + /** + * If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. + */ + payco?: PaymentMethodData.Payco; + /** * If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. */ @@ -2845,6 +3064,11 @@ declare module 'stripe' { */ revolut_pay?: PaymentMethodData.RevolutPay; + /** + * If this is a `samsung_pay` PaymentMethod, this hash contains details about the SamsungPay payment method. + */ + samsung_pay?: PaymentMethodData.SamsungPay; + /** * If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. */ @@ -2912,6 +3136,8 @@ declare module 'stripe' { type AllowRedisplay = 'always' | 'limited' | 'unspecified'; + interface Alma {} + interface AmazonPay {} interface AuBecsDebit { @@ -3060,7 +3286,7 @@ declare module 'stripe' { interface Ideal { /** - * The customer's bank. + * The customer's bank. Only use this parameter for existing customers. Don't use it for new customers. */ bank?: Ideal.Bank; } @@ -3087,6 +3313,8 @@ declare module 'stripe' { interface InteracPresent {} + interface KakaoPay {} + interface Klarna { /** * Customer's date of birth @@ -3115,12 +3343,25 @@ declare module 'stripe' { interface Konbini {} + interface KrCard {} + interface Link {} interface Mobilepay {} interface Multibanco {} + interface NaverPay { + /** + * Whether to use Naver Pay points or a card to fund this transaction. If not provided, this defaults to `card`. + */ + funding?: NaverPay.Funding; + } + + namespace NaverPay { + type Funding = 'card' | 'points'; + } + interface Oxxo {} interface P24 { @@ -3160,6 +3401,8 @@ declare module 'stripe' { | 'volkswagen_bank'; } + interface Payco {} + interface Paynow {} interface Paypal {} @@ -3177,6 +3420,8 @@ declare module 'stripe' { interface RevolutPay {} + interface SamsungPay {} + interface SepaDebit { /** * IBAN of the bank account. @@ -3204,6 +3449,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'amazon_pay' | 'au_becs_debit' | 'bacs_debit' @@ -3217,18 +3463,23 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'kakao_pay' | 'klarna' | 'konbini' + | 'kr_card' | 'link' | 'mobilepay' | 'multibanco' + | 'naver_pay' | 'oxxo' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'pix' | 'promptpay' | 'revolut_pay' + | 'samsung_pay' | 'sepa_debit' | 'sofort' | 'swish' @@ -3298,6 +3549,11 @@ declare module 'stripe' { */ alipay?: Stripe.Emptyable; + /** + * If this is a `alma` PaymentMethod, this sub-hash contains details about the Alma payment method options. + */ + alma?: Stripe.Emptyable; + /** * If this is a `amazon_pay` PaymentMethod, this sub-hash contains details about the Amazon Pay payment method options. */ @@ -3380,6 +3636,11 @@ declare module 'stripe' { */ interac_present?: Stripe.Emptyable; + /** + * If this is a `kakao_pay` PaymentMethod, this sub-hash contains details about the Kakao Pay payment method options. + */ + kakao_pay?: Stripe.Emptyable; + /** * If this is a `klarna` PaymentMethod, this sub-hash contains details about the Klarna payment method options. */ @@ -3390,6 +3651,11 @@ declare module 'stripe' { */ konbini?: Stripe.Emptyable; + /** + * If this is a `kr_card` PaymentMethod, this sub-hash contains details about the KR Card payment method options. + */ + kr_card?: Stripe.Emptyable; + /** * If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. */ @@ -3405,6 +3671,11 @@ declare module 'stripe' { */ multibanco?: Stripe.Emptyable; + /** + * If this is a `naver_pay` PaymentMethod, this sub-hash contains details about the Naver Pay payment method options. + */ + naver_pay?: Stripe.Emptyable; + /** * If this is a `oxxo` PaymentMethod, this sub-hash contains details about the OXXO payment method options. */ @@ -3415,6 +3686,11 @@ declare module 'stripe' { */ p24?: Stripe.Emptyable; + /** + * If this is a `payco` PaymentMethod, this sub-hash contains details about the PAYCO payment method options. + */ + payco?: Stripe.Emptyable; + /** * If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options. */ @@ -3440,6 +3716,11 @@ declare module 'stripe' { */ revolut_pay?: Stripe.Emptyable; + /** + * If this is a `samsung_pay` PaymentMethod, this sub-hash contains details about the Samsung Pay payment method options. + */ + samsung_pay?: Stripe.Emptyable; + /** * If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options. */ @@ -3616,6 +3897,17 @@ declare module 'stripe' { type SetupFutureUsage = 'none' | 'off_session'; } + interface Alma { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + } + interface AmazonPay { /** * Controls when the funds are captured from the customer's account. @@ -3682,7 +3974,12 @@ declare module 'stripe' { } namespace BacsDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'DDIC' or 'STRIPE'. + */ + reference_prefix?: Stripe.Emptyable; + } type SetupFutureUsage = 'none' | 'off_session' | 'on_session'; } @@ -3954,6 +4251,7 @@ declare module 'stripe' { | 'girocard' | 'interac' | 'jcb' + | 'link' | 'mastercard' | 'unionpay' | 'unknown' @@ -4278,6 +4576,32 @@ declare module 'stripe' { interface InteracPresent {} + interface KakaoPay { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. + * + * If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](https://stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead. + * + * When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](https://stripe.com/strong-customer-authentication). + */ + setup_future_usage?: Stripe.Emptyable; + } + + namespace KakaoPay { + type SetupFutureUsage = 'none' | 'off_session'; + } + interface Klarna { /** * Controls when the funds are captured from the customer's account. @@ -4392,6 +4716,32 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface KrCard { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. + * + * If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](https://stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead. + * + * When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](https://stripe.com/strong-customer-authentication). + */ + setup_future_usage?: Stripe.Emptyable; + } + + namespace KrCard { + type SetupFutureUsage = 'none' | 'off_session'; + } + interface Link { /** * Controls when the funds are captured from the customer's account. @@ -4465,6 +4815,17 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface NaverPay { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + } + interface Oxxo { /** * The number of calendar days before an OXXO voucher expires. For example, if you create an OXXO voucher on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time. @@ -4505,6 +4866,17 @@ declare module 'stripe' { tos_shown_and_accepted?: boolean; } + interface Payco { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + } + interface Paynow { /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -4648,6 +5020,17 @@ declare module 'stripe' { type SetupFutureUsage = 'none' | 'off_session'; } + interface SamsungPay { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + } + interface SepaDebit { /** * Additional fields for Mandate creation @@ -4669,7 +5052,12 @@ declare module 'stripe' { } namespace SepaDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'STRIPE'. + */ + reference_prefix?: Stripe.Emptyable; + } type SetupFutureUsage = 'none' | 'off_session' | 'on_session'; } @@ -4709,7 +5097,7 @@ declare module 'stripe' { interface Swish { /** - * The order ID displayed in the Swish app after the payment is authorized. + * A reference for this payment to be displayed in the Swish app. */ reference?: Stripe.Emptyable; @@ -4954,11 +5342,9 @@ declare module 'stripe' { interface PaymentIntentApplyCustomerBalanceParams { /** - * Amount that you intend to apply to this PaymentIntent from the customer's cash balance. + * Amount that you intend to apply to this PaymentIntent from the customer's cash balance. If the PaymentIntent was created by an Invoice, the full amount of the PaymentIntent is applied regardless of this parameter. * - * A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (for example, 100 cents to charge 1 USD or 100 to charge 100 JPY, a zero-decimal currency). - * - * The maximum amount is the amount of the PaymentIntent. + * A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (for example, 100 cents to charge 1 USD or 100 to charge 100 JPY, a zero-decimal currency). The maximum amount is the amount of the PaymentIntent. * * When you omit the amount, it defaults to the remaining amount requested on the PaymentIntent. */ @@ -5229,6 +5615,11 @@ declare module 'stripe' { */ allow_redisplay?: PaymentMethodData.AllowRedisplay; + /** + * If this is a Alma PaymentMethod, this hash contains details about the Alma payment method. + */ + alma?: PaymentMethodData.Alma; + /** * If this is a AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method. */ @@ -5304,6 +5695,11 @@ declare module 'stripe' { */ interac_present?: PaymentMethodData.InteracPresent; + /** + * If this is a `kakao_pay` PaymentMethod, this hash contains details about the Kakao Pay payment method. + */ + kakao_pay?: PaymentMethodData.KakaoPay; + /** * If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. */ @@ -5314,6 +5710,11 @@ declare module 'stripe' { */ konbini?: PaymentMethodData.Konbini; + /** + * If this is a `kr_card` PaymentMethod, this hash contains details about the Korean Card payment method. + */ + kr_card?: PaymentMethodData.KrCard; + /** * If this is an `Link` PaymentMethod, this hash contains details about the Link payment method. */ @@ -5334,6 +5735,11 @@ declare module 'stripe' { */ multibanco?: PaymentMethodData.Multibanco; + /** + * If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method. + */ + naver_pay?: PaymentMethodData.NaverPay; + /** * If this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method. */ @@ -5344,6 +5750,11 @@ declare module 'stripe' { */ p24?: PaymentMethodData.P24; + /** + * If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. + */ + payco?: PaymentMethodData.Payco; + /** * If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. */ @@ -5374,6 +5785,11 @@ declare module 'stripe' { */ revolut_pay?: PaymentMethodData.RevolutPay; + /** + * If this is a `samsung_pay` PaymentMethod, this hash contains details about the SamsungPay payment method. + */ + samsung_pay?: PaymentMethodData.SamsungPay; + /** * If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. */ @@ -5441,6 +5857,8 @@ declare module 'stripe' { type AllowRedisplay = 'always' | 'limited' | 'unspecified'; + interface Alma {} + interface AmazonPay {} interface AuBecsDebit { @@ -5589,7 +6007,7 @@ declare module 'stripe' { interface Ideal { /** - * The customer's bank. + * The customer's bank. Only use this parameter for existing customers. Don't use it for new customers. */ bank?: Ideal.Bank; } @@ -5616,6 +6034,8 @@ declare module 'stripe' { interface InteracPresent {} + interface KakaoPay {} + interface Klarna { /** * Customer's date of birth @@ -5644,12 +6064,25 @@ declare module 'stripe' { interface Konbini {} + interface KrCard {} + interface Link {} interface Mobilepay {} interface Multibanco {} + interface NaverPay { + /** + * Whether to use Naver Pay points or a card to fund this transaction. If not provided, this defaults to `card`. + */ + funding?: NaverPay.Funding; + } + + namespace NaverPay { + type Funding = 'card' | 'points'; + } + interface Oxxo {} interface P24 { @@ -5689,6 +6122,8 @@ declare module 'stripe' { | 'volkswagen_bank'; } + interface Payco {} + interface Paynow {} interface Paypal {} @@ -5706,6 +6141,8 @@ declare module 'stripe' { interface RevolutPay {} + interface SamsungPay {} + interface SepaDebit { /** * IBAN of the bank account. @@ -5733,6 +6170,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'amazon_pay' | 'au_becs_debit' | 'bacs_debit' @@ -5746,18 +6184,23 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'kakao_pay' | 'klarna' | 'konbini' + | 'kr_card' | 'link' | 'mobilepay' | 'multibanco' + | 'naver_pay' | 'oxxo' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'pix' | 'promptpay' | 'revolut_pay' + | 'samsung_pay' | 'sepa_debit' | 'sofort' | 'swish' @@ -5827,6 +6270,11 @@ declare module 'stripe' { */ alipay?: Stripe.Emptyable; + /** + * If this is a `alma` PaymentMethod, this sub-hash contains details about the Alma payment method options. + */ + alma?: Stripe.Emptyable; + /** * If this is a `amazon_pay` PaymentMethod, this sub-hash contains details about the Amazon Pay payment method options. */ @@ -5909,6 +6357,11 @@ declare module 'stripe' { */ interac_present?: Stripe.Emptyable; + /** + * If this is a `kakao_pay` PaymentMethod, this sub-hash contains details about the Kakao Pay payment method options. + */ + kakao_pay?: Stripe.Emptyable; + /** * If this is a `klarna` PaymentMethod, this sub-hash contains details about the Klarna payment method options. */ @@ -5919,6 +6372,11 @@ declare module 'stripe' { */ konbini?: Stripe.Emptyable; + /** + * If this is a `kr_card` PaymentMethod, this sub-hash contains details about the KR Card payment method options. + */ + kr_card?: Stripe.Emptyable; + /** * If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options. */ @@ -5934,6 +6392,11 @@ declare module 'stripe' { */ multibanco?: Stripe.Emptyable; + /** + * If this is a `naver_pay` PaymentMethod, this sub-hash contains details about the Naver Pay payment method options. + */ + naver_pay?: Stripe.Emptyable; + /** * If this is a `oxxo` PaymentMethod, this sub-hash contains details about the OXXO payment method options. */ @@ -5944,6 +6407,11 @@ declare module 'stripe' { */ p24?: Stripe.Emptyable; + /** + * If this is a `payco` PaymentMethod, this sub-hash contains details about the PAYCO payment method options. + */ + payco?: Stripe.Emptyable; + /** * If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options. */ @@ -5969,6 +6437,11 @@ declare module 'stripe' { */ revolut_pay?: Stripe.Emptyable; + /** + * If this is a `samsung_pay` PaymentMethod, this sub-hash contains details about the Samsung Pay payment method options. + */ + samsung_pay?: Stripe.Emptyable; + /** * If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options. */ @@ -6145,6 +6618,17 @@ declare module 'stripe' { type SetupFutureUsage = 'none' | 'off_session'; } + interface Alma { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + } + interface AmazonPay { /** * Controls when the funds are captured from the customer's account. @@ -6211,7 +6695,12 @@ declare module 'stripe' { } namespace BacsDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'DDIC' or 'STRIPE'. + */ + reference_prefix?: Stripe.Emptyable; + } type SetupFutureUsage = 'none' | 'off_session' | 'on_session'; } @@ -6483,6 +6972,7 @@ declare module 'stripe' { | 'girocard' | 'interac' | 'jcb' + | 'link' | 'mastercard' | 'unionpay' | 'unknown' @@ -6807,6 +7297,32 @@ declare module 'stripe' { interface InteracPresent {} + interface KakaoPay { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. + * + * If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](https://stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead. + * + * When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](https://stripe.com/strong-customer-authentication). + */ + setup_future_usage?: Stripe.Emptyable; + } + + namespace KakaoPay { + type SetupFutureUsage = 'none' | 'off_session'; + } + interface Klarna { /** * Controls when the funds are captured from the customer's account. @@ -6921,6 +7437,32 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface KrCard { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + + /** + * Indicates that you intend to make future payments with this PaymentIntent's payment method. + * + * If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](https://stripe.com/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still [attach](https://stripe.com/api/payment_methods/attach) the payment method to a Customer after the transaction completes. + * + * If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](https://stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead. + * + * When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](https://stripe.com/strong-customer-authentication). + */ + setup_future_usage?: Stripe.Emptyable; + } + + namespace KrCard { + type SetupFutureUsage = 'none' | 'off_session'; + } + interface Link { /** * Controls when the funds are captured from the customer's account. @@ -6994,6 +7536,17 @@ declare module 'stripe' { setup_future_usage?: 'none'; } + interface NaverPay { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + } + interface Oxxo { /** * The number of calendar days before an OXXO voucher expires. For example, if you create an OXXO voucher on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time. @@ -7034,6 +7587,17 @@ declare module 'stripe' { tos_shown_and_accepted?: boolean; } + interface Payco { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + } + interface Paynow { /** * Indicates that you intend to make future payments with this PaymentIntent's payment method. @@ -7177,6 +7741,17 @@ declare module 'stripe' { type SetupFutureUsage = 'none' | 'off_session'; } + interface SamsungPay { + /** + * Controls when the funds are captured from the customer's account. + * + * If provided, this parameter overrides the behavior of the top-level [capture_method](https://stripe.com/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type. + * + * If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type. + */ + capture_method?: Stripe.Emptyable<'manual'>; + } + interface SepaDebit { /** * Additional fields for Mandate creation @@ -7198,7 +7773,12 @@ declare module 'stripe' { } namespace SepaDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'STRIPE'. + */ + reference_prefix?: Stripe.Emptyable; + } type SetupFutureUsage = 'none' | 'off_session' | 'on_session'; } @@ -7238,7 +7818,7 @@ declare module 'stripe' { interface Swish { /** - * The order ID displayed in the Swish app after the payment is authorized. + * A reference for this payment to be displayed in the Swish app. */ reference?: Stripe.Emptyable; diff --git a/types/PaymentLinks.d.ts b/types/PaymentLinks.d.ts index bc4b6cb641..75abf6e686 100644 --- a/types/PaymentLinks.d.ts +++ b/types/PaymentLinks.d.ts @@ -542,6 +542,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'au_becs_debit' | 'bacs_debit' | 'bancontact' @@ -858,7 +859,7 @@ declare module 'stripe' { shipping_rate: string | Stripe.ShippingRate; } - type SubmitType = 'auto' | 'book' | 'donate' | 'pay'; + type SubmitType = 'auto' | 'book' | 'donate' | 'pay' | 'subscribe'; interface SubscriptionData { /** diff --git a/types/PaymentLinksResource.d.ts b/types/PaymentLinksResource.d.ts index da7bec4acf..70799a475e 100644 --- a/types/PaymentLinksResource.d.ts +++ b/types/PaymentLinksResource.d.ts @@ -188,7 +188,9 @@ declare module 'stripe' { interface AutomaticTax { /** - * If `true`, tax will be calculated automatically using the customer's location. + * Set to `true` to [calculate tax automatically](https://docs.stripe.com/tax) using the customer's location. + * + * Enabling this parameter causes the payment link to collect any billing address information necessary for tax calculation. */ enabled: boolean; @@ -601,6 +603,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'au_becs_debit' | 'bacs_debit' | 'bancontact' @@ -658,7 +661,7 @@ declare module 'stripe' { interface ShippingAddressCollection { /** * An array of two-letter ISO country codes representing which countries Checkout should provide as options for - * shipping locations. Unsupported country codes: `AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI`. + * shipping locations. */ allowed_countries: Array; } @@ -911,7 +914,7 @@ declare module 'stripe' { shipping_rate?: string; } - type SubmitType = 'auto' | 'book' | 'donate' | 'pay'; + type SubmitType = 'auto' | 'book' | 'donate' | 'pay' | 'subscribe'; interface SubscriptionData { /** @@ -1127,6 +1130,11 @@ declare module 'stripe' { PaymentLinkUpdateParams.ShippingAddressCollection >; + /** + * Describes the type of transaction being performed in order to customize relevant text on the page, such as the submit button. Changing this value will also affect the hostname in the [url](https://stripe.com/docs/api/payment_links/payment_links/object#url) property (example: `donate.stripe.com`). + */ + submit_type?: PaymentLinkUpdateParams.SubmitType; + /** * When creating a subscription, the specified configuration data will be used. There must be at least one line item with a recurring price to use `subscription_data`. */ @@ -1176,7 +1184,9 @@ declare module 'stripe' { interface AutomaticTax { /** - * If `true`, tax will be calculated automatically using the customer's location. + * Set to `true` to [calculate tax automatically](https://docs.stripe.com/tax) using the customer's location. + * + * Enabling this parameter causes the payment link to collect any billing address information necessary for tax calculation. */ enabled: boolean; @@ -1525,6 +1535,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'au_becs_debit' | 'bacs_debit' | 'bancontact' @@ -1575,7 +1586,7 @@ declare module 'stripe' { interface ShippingAddressCollection { /** * An array of two-letter ISO country codes representing which countries Checkout should provide as options for - * shipping locations. Unsupported country codes: `AS, CX, CC, CU, HM, IR, KP, MH, FM, NF, MP, PW, SD, SY, UM, VI`. + * shipping locations. */ allowed_countries: Array; } @@ -1821,6 +1832,8 @@ declare module 'stripe' { | 'ZZ'; } + type SubmitType = 'auto' | 'book' | 'donate' | 'pay' | 'subscribe'; + interface SubscriptionData { /** * All invoices will be billed using the specified settings. @@ -1832,6 +1845,11 @@ declare module 'stripe' { */ metadata?: Stripe.Emptyable; + /** + * Integer representing the number of trial period days before the customer is charged for the first time. Has to be at least 1. + */ + trial_period_days?: Stripe.Emptyable; + /** * Settings related to subscription trials. */ diff --git a/types/PaymentMethodConfigurations.d.ts b/types/PaymentMethodConfigurations.d.ts index 53aa3aadae..f5157ca0d3 100644 --- a/types/PaymentMethodConfigurations.d.ts +++ b/types/PaymentMethodConfigurations.d.ts @@ -42,6 +42,8 @@ declare module 'stripe' { alipay?: PaymentMethodConfiguration.Alipay; + alma?: PaymentMethodConfiguration.Alma; + amazon_pay?: PaymentMethodConfiguration.AmazonPay; apple_pay?: PaymentMethodConfiguration.ApplePay; @@ -277,6 +279,40 @@ declare module 'stripe' { } } + interface Alma { + /** + * Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. + */ + available: boolean; + + display_preference: Alma.DisplayPreference; + } + + namespace Alma { + interface DisplayPreference { + /** + * For child configs, whether or not the account's preference will be observed. If `false`, the parent configuration's default is used. + */ + overridable: boolean | null; + + /** + * The account's display preference. + */ + preference: DisplayPreference.Preference; + + /** + * The effective display preference value. + */ + value: DisplayPreference.Value; + } + + namespace DisplayPreference { + type Preference = 'none' | 'off' | 'on'; + + type Value = 'off' | 'on'; + } + } + interface AmazonPay { /** * Whether this payment method may be offered at checkout. True if `display_preference` is `on` and the payment method's capability is active. diff --git a/types/PaymentMethodConfigurationsResource.d.ts b/types/PaymentMethodConfigurationsResource.d.ts index c7ff55d37d..58f9efff96 100644 --- a/types/PaymentMethodConfigurationsResource.d.ts +++ b/types/PaymentMethodConfigurationsResource.d.ts @@ -23,6 +23,11 @@ declare module 'stripe' { */ alipay?: PaymentMethodConfigurationCreateParams.Alipay; + /** + * Alma is a Buy Now, Pay Later payment method that offers customers the ability to pay in 2, 3, or 4 installments. + */ + alma?: PaymentMethodConfigurationCreateParams.Alma; + /** * Amazon Pay is a wallet payment method that lets your customers check out the same way as on Amazon. */ @@ -209,7 +214,7 @@ declare module 'stripe' { twint?: PaymentMethodConfigurationCreateParams.Twint; /** - * Stripe users in the United States can accept ACH direct debit payments from customers with a US bank account using the Automated Clearing House (ACH) payments system operated by Nacha. Check this [page](https://stripe.com/docs/payments/ach-debit) for more details. + * Stripe users in the United States can accept ACH direct debit payments from customers with a US bank account using the Automated Clearing House (ACH) payments system operated by Nacha. Check this [page](https://stripe.com/docs/payments/ach-direct-debit) for more details. */ us_bank_account?: PaymentMethodConfigurationCreateParams.UsBankAccount; @@ -305,6 +310,26 @@ declare module 'stripe' { } } + interface Alma { + /** + * Whether or not the payment method should be displayed. + */ + display_preference?: Alma.DisplayPreference; + } + + namespace Alma { + interface DisplayPreference { + /** + * The account's preference for whether or not to display this payment method. + */ + preference?: DisplayPreference.Preference; + } + + namespace DisplayPreference { + type Preference = 'none' | 'off' | 'on'; + } + } + interface AmazonPay { /** * Whether or not the payment method should be displayed. @@ -1079,6 +1104,11 @@ declare module 'stripe' { */ alipay?: PaymentMethodConfigurationUpdateParams.Alipay; + /** + * Alma is a Buy Now, Pay Later payment method that offers customers the ability to pay in 2, 3, or 4 installments. + */ + alma?: PaymentMethodConfigurationUpdateParams.Alma; + /** * Amazon Pay is a wallet payment method that lets your customers check out the same way as on Amazon. */ @@ -1260,7 +1290,7 @@ declare module 'stripe' { twint?: PaymentMethodConfigurationUpdateParams.Twint; /** - * Stripe users in the United States can accept ACH direct debit payments from customers with a US bank account using the Automated Clearing House (ACH) payments system operated by Nacha. Check this [page](https://stripe.com/docs/payments/ach-debit) for more details. + * Stripe users in the United States can accept ACH direct debit payments from customers with a US bank account using the Automated Clearing House (ACH) payments system operated by Nacha. Check this [page](https://stripe.com/docs/payments/ach-direct-debit) for more details. */ us_bank_account?: PaymentMethodConfigurationUpdateParams.UsBankAccount; @@ -1356,6 +1386,26 @@ declare module 'stripe' { } } + interface Alma { + /** + * Whether or not the payment method should be displayed. + */ + display_preference?: Alma.DisplayPreference; + } + + namespace Alma { + interface DisplayPreference { + /** + * The account's preference for whether or not to display this payment method. + */ + preference?: DisplayPreference.Preference; + } + + namespace DisplayPreference { + type Preference = 'none' | 'off' | 'on'; + } + } + interface AmazonPay { /** * Whether or not the payment method should be displayed. diff --git a/types/PaymentMethodDomains.d.ts b/types/PaymentMethodDomains.d.ts index f11f39a902..cefded0fee 100644 --- a/types/PaymentMethodDomains.d.ts +++ b/types/PaymentMethodDomains.d.ts @@ -19,6 +19,11 @@ declare module 'stripe' { */ object: 'payment_method_domain'; + /** + * Indicates the status of a specific payment method on a payment method domain. + */ + amazon_pay: PaymentMethodDomain.AmazonPay; + /** * Indicates the status of a specific payment method on a payment method domain. */ @@ -61,6 +66,29 @@ declare module 'stripe' { } namespace PaymentMethodDomain { + interface AmazonPay { + /** + * The status of the payment method on the domain. + */ + status: AmazonPay.Status; + + /** + * Contains additional details about the status of a payment method for a specific payment method domain. + */ + status_details?: AmazonPay.StatusDetails; + } + + namespace AmazonPay { + type Status = 'active' | 'inactive'; + + interface StatusDetails { + /** + * The error message associated with the status of the payment method on the domain. + */ + error_message: string; + } + } + interface ApplePay { /** * The status of the payment method on the domain. diff --git a/types/PaymentMethods.d.ts b/types/PaymentMethods.d.ts index 3151ede73c..b3407a2030 100644 --- a/types/PaymentMethods.d.ts +++ b/types/PaymentMethods.d.ts @@ -33,6 +33,8 @@ declare module 'stripe' { */ allow_redisplay?: PaymentMethod.AllowRedisplay; + alma?: PaymentMethod.Alma; + amazon_pay?: PaymentMethod.AmazonPay; au_becs_debit?: PaymentMethod.AuBecsDebit; @@ -77,10 +79,14 @@ declare module 'stripe' { interac_present?: PaymentMethod.InteracPresent; + kakao_pay?: PaymentMethod.KakaoPay; + klarna?: PaymentMethod.Klarna; konbini?: PaymentMethod.Konbini; + kr_card?: PaymentMethod.KrCard; + link?: PaymentMethod.Link; /** @@ -97,10 +103,14 @@ declare module 'stripe' { multibanco?: PaymentMethod.Multibanco; + naver_pay?: PaymentMethod.NaverPay; + oxxo?: PaymentMethod.Oxxo; p24?: PaymentMethod.P24; + payco?: PaymentMethod.Payco; + paynow?: PaymentMethod.Paynow; paypal?: PaymentMethod.Paypal; @@ -116,6 +126,8 @@ declare module 'stripe' { revolut_pay?: PaymentMethod.RevolutPay; + samsung_pay?: PaymentMethod.SamsungPay; + sepa_debit?: PaymentMethod.SepaDebit; sofort?: PaymentMethod.Sofort; @@ -172,6 +184,8 @@ declare module 'stripe' { type AllowRedisplay = 'always' | 'limited' | 'unspecified'; + interface Alma {} + interface AmazonPay {} interface AuBecsDebit { @@ -243,7 +257,7 @@ declare module 'stripe' { interface Card { /** - * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ brand: string; @@ -314,6 +328,11 @@ declare module 'stripe' { */ networks: Card.Networks | null; + /** + * Status of a card based on the card issuer. + */ + regulated_status?: Card.RegulatedStatus | null; + /** * Contains details on how this Card may be used for 3D Secure authentication. */ @@ -378,7 +397,7 @@ declare module 'stripe' { amount_authorized: number | null; /** - * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ brand: string | null; @@ -460,7 +479,7 @@ declare module 'stripe' { last4: string | null; /** - * Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ network: string | null; @@ -602,6 +621,8 @@ declare module 'stripe' { preferred: string | null; } + type RegulatedStatus = 'regulated' | 'unregulated'; + interface ThreeDSecureUsage { /** * Whether 3D Secure is supported on this card. @@ -703,7 +724,7 @@ declare module 'stripe' { interface CardPresent { /** - * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ brand: string | null; @@ -1074,6 +1095,8 @@ declare module 'stripe' { | 'magnetic_stripe_track2'; } + interface KakaoPay {} + interface Klarna { /** * The customer's date of birth, if provided. @@ -1102,6 +1125,44 @@ declare module 'stripe' { interface Konbini {} + interface KrCard { + /** + * The local credit or debit card brand. + */ + brand: KrCard.Brand | null; + + /** + * The last four digits of the card. This may not be present for American Express cards. + */ + last4: string | null; + } + + namespace KrCard { + type Brand = + | 'bc' + | 'citi' + | 'hana' + | 'hyundai' + | 'jeju' + | 'jeonbuk' + | 'kakaobank' + | 'kbank' + | 'kdbbank' + | 'kookmin' + | 'kwangju' + | 'lotte' + | 'mg' + | 'nh' + | 'post' + | 'samsung' + | 'savingsbank' + | 'shinhan' + | 'shinhyup' + | 'suhyup' + | 'tossbank' + | 'woori'; + } + interface Link { /** * Account owner's email address. @@ -1119,6 +1180,17 @@ declare module 'stripe' { interface Multibanco {} + interface NaverPay { + /** + * Whether to fund this transaction with Naver Pay points or a card. + */ + funding: NaverPay.Funding; + } + + namespace NaverPay { + type Funding = 'card' | 'points'; + } + interface Oxxo {} interface P24 { @@ -1158,6 +1230,8 @@ declare module 'stripe' { | 'volkswagen_bank'; } + interface Payco {} + interface Paynow {} interface Paypal { @@ -1186,6 +1260,8 @@ declare module 'stripe' { interface RevolutPay {} + interface SamsungPay {} + interface SepaDebit { /** * Bank code of bank associated with the bank account. @@ -1248,6 +1324,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'amazon_pay' | 'au_becs_debit' | 'bacs_debit' @@ -1264,18 +1341,23 @@ declare module 'stripe' { | 'grabpay' | 'ideal' | 'interac_present' + | 'kakao_pay' | 'klarna' | 'konbini' + | 'kr_card' | 'link' | 'mobilepay' | 'multibanco' + | 'naver_pay' | 'oxxo' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'pix' | 'promptpay' | 'revolut_pay' + | 'samsung_pay' | 'sepa_debit' | 'sofort' | 'swish' diff --git a/types/PaymentMethodsResource.d.ts b/types/PaymentMethodsResource.d.ts index 9d2398e5e1..5b5d933872 100644 --- a/types/PaymentMethodsResource.d.ts +++ b/types/PaymentMethodsResource.d.ts @@ -28,6 +28,11 @@ declare module 'stripe' { */ allow_redisplay?: PaymentMethodCreateParams.AllowRedisplay; + /** + * If this is a Alma PaymentMethod, this hash contains details about the Alma payment method. + */ + alma?: PaymentMethodCreateParams.Alma; + /** * If this is a AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method. */ @@ -118,6 +123,11 @@ declare module 'stripe' { */ interac_present?: PaymentMethodCreateParams.InteracPresent; + /** + * If this is a `kakao_pay` PaymentMethod, this hash contains details about the Kakao Pay payment method. + */ + kakao_pay?: PaymentMethodCreateParams.KakaoPay; + /** * If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. */ @@ -128,6 +138,11 @@ declare module 'stripe' { */ konbini?: PaymentMethodCreateParams.Konbini; + /** + * If this is a `kr_card` PaymentMethod, this hash contains details about the Korean Card payment method. + */ + kr_card?: PaymentMethodCreateParams.KrCard; + /** * If this is an `Link` PaymentMethod, this hash contains details about the Link payment method. */ @@ -148,6 +163,11 @@ declare module 'stripe' { */ multibanco?: PaymentMethodCreateParams.Multibanco; + /** + * If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method. + */ + naver_pay?: PaymentMethodCreateParams.NaverPay; + /** * If this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method. */ @@ -158,6 +178,11 @@ declare module 'stripe' { */ p24?: PaymentMethodCreateParams.P24; + /** + * If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. + */ + payco?: PaymentMethodCreateParams.Payco; + /** * The PaymentMethod to share. */ @@ -193,6 +218,11 @@ declare module 'stripe' { */ revolut_pay?: PaymentMethodCreateParams.RevolutPay; + /** + * If this is a `samsung_pay` PaymentMethod, this hash contains details about the SamsungPay payment method. + */ + samsung_pay?: PaymentMethodCreateParams.SamsungPay; + /** * If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. */ @@ -260,6 +290,8 @@ declare module 'stripe' { type AllowRedisplay = 'always' | 'limited' | 'unspecified'; + interface Alma {} + interface AmazonPay {} interface AuBecsDebit { @@ -453,7 +485,7 @@ declare module 'stripe' { interface Ideal { /** - * The customer's bank. + * The customer's bank. Only use this parameter for existing customers. Don't use it for new customers. */ bank?: Ideal.Bank; } @@ -480,6 +512,8 @@ declare module 'stripe' { interface InteracPresent {} + interface KakaoPay {} + interface Klarna { /** * Customer's date of birth @@ -508,12 +542,25 @@ declare module 'stripe' { interface Konbini {} + interface KrCard {} + interface Link {} interface Mobilepay {} interface Multibanco {} + interface NaverPay { + /** + * Whether to use Naver Pay points or a card to fund this transaction. If not provided, this defaults to `card`. + */ + funding?: NaverPay.Funding; + } + + namespace NaverPay { + type Funding = 'card' | 'points'; + } + interface Oxxo {} interface P24 { @@ -553,6 +600,8 @@ declare module 'stripe' { | 'volkswagen_bank'; } + interface Payco {} + interface Paynow {} interface Paypal {} @@ -570,6 +619,8 @@ declare module 'stripe' { interface RevolutPay {} + interface SamsungPay {} + interface SepaDebit { /** * IBAN of the bank account. @@ -597,6 +648,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'amazon_pay' | 'au_becs_debit' | 'bacs_debit' @@ -611,18 +663,23 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'kakao_pay' | 'klarna' | 'konbini' + | 'kr_card' | 'link' | 'mobilepay' | 'multibanco' + | 'naver_pay' | 'oxxo' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'pix' | 'promptpay' | 'revolut_pay' + | 'samsung_pay' | 'sepa_debit' | 'sofort' | 'swish' @@ -707,6 +764,11 @@ declare module 'stripe' { */ metadata?: Stripe.Emptyable; + /** + * If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method. + */ + naver_pay?: PaymentMethodUpdateParams.NaverPay; + /** * If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. */ @@ -770,6 +832,17 @@ declare module 'stripe' { interface Link {} + interface NaverPay { + /** + * Whether to use Naver Pay points or a card to fund this transaction. If not provided, this defaults to `card`. + */ + funding?: NaverPay.Funding; + } + + namespace NaverPay { + type Funding = 'card' | 'points'; + } + interface UsBankAccount { /** * Bank account holder type. @@ -812,6 +885,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'amazon_pay' | 'au_becs_debit' | 'bacs_debit' @@ -826,18 +900,23 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'kakao_pay' | 'klarna' | 'konbini' + | 'kr_card' | 'link' | 'mobilepay' | 'multibanco' + | 'naver_pay' | 'oxxo' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'pix' | 'promptpay' | 'revolut_pay' + | 'samsung_pay' | 'sepa_debit' | 'sofort' | 'swish' diff --git a/types/Payouts.d.ts b/types/Payouts.d.ts index 5e79eaf6ea..92b9daa48c 100644 --- a/types/Payouts.d.ts +++ b/types/Payouts.d.ts @@ -137,6 +137,11 @@ declare module 'stripe' { */ status: string; + /** + * A value that generates from the beneficiary's bank that allows users to track payouts with their bank. Banks might call this a "reference number" or something similar. + */ + trace_id: Payout.TraceId | null; + /** * Can be `bank_account` or `card`. */ @@ -149,6 +154,18 @@ declare module 'stripe' { | 'in_progress' | 'not_applicable'; + interface TraceId { + /** + * Possible values are `pending`, `supported`, and `unsupported`. When `payout.status` is `pending` or `in_transit`, this will be `pending`. When the payout transitions to `paid`, `failed`, or `canceled`, this status will become `supported` or `unsupported` shortly after in most cases. In some cases, this may appear as `pending` for up to 10 days after `arrival_date` until transitioning to `supported` or `unsupported`. + */ + status: string; + + /** + * The trace ID value if `trace_id.status` is `supported`, otherwise `nil`. + */ + value: string | null; + } + type Type = 'bank_account' | 'card'; } } diff --git a/types/Persons.d.ts b/types/Persons.d.ts index 15c611f98c..b55e6bdb84 100644 --- a/types/Persons.d.ts +++ b/types/Persons.d.ts @@ -102,7 +102,7 @@ declare module 'stripe' { future_requirements?: Person.FutureRequirements | null; /** - * The person's gender (International regulations require either "male" or "female"). + * The person's gender. */ gender?: string | null; @@ -308,7 +308,7 @@ declare module 'stripe' { errors: Array; /** - * Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well, and the account's `future_requirements[current_deadline]` becomes set. + * Fields you must collect when all thresholds are reached. As they become required, they appear in `currently_due` as well, and the account's `future_requirements[current_deadline]` becomes set. */ eventually_due: Array; @@ -451,6 +451,11 @@ declare module 'stripe' { type PoliticalExposure = 'existing' | 'none'; interface Relationship { + /** + * Whether the person is the authorizer of the account's representative. + */ + authorizer: boolean | null; + /** * Whether the person is a director of the account's legal entity. Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations. */ @@ -504,7 +509,7 @@ declare module 'stripe' { errors: Array; /** - * Fields that need to be collected assuming all volume thresholds are reached. As they become required, they appear in `currently_due` as well, and the account's `current_deadline` becomes set. + * Fields you must collect when all thresholds are reached. As they become required, they appear in `currently_due` as well, and the account's `current_deadline` becomes set. */ eventually_due: Array; diff --git a/types/ProductsResource.d.ts b/types/ProductsResource.d.ts index fb1e54db28..e5fdab2bfd 100644 --- a/types/ProductsResource.d.ts +++ b/types/ProductsResource.d.ts @@ -101,6 +101,11 @@ declare module 'stripe' { [key: string]: DefaultPriceData.CurrencyOptions; }; + /** + * When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. + */ + custom_unit_amount?: DefaultPriceData.CustomUnitAmount; + /** * The recurring components of a price such as `interval` and `interval_count`. */ @@ -112,7 +117,7 @@ declare module 'stripe' { tax_behavior?: DefaultPriceData.TaxBehavior; /** - * A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required. + * A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. One of `unit_amount`, `unit_amount_decimal`, or `custom_unit_amount` is required. */ unit_amount?: number; @@ -203,6 +208,28 @@ declare module 'stripe' { } } + interface CustomUnitAmount { + /** + * Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. + */ + enabled: boolean; + + /** + * The maximum unit amount the customer can specify for this item. + */ + maximum?: number; + + /** + * The minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount. + */ + minimum?: number; + + /** + * The starting unit amount which can be updated by the customer. + */ + preset?: number; + } + interface Recurring { /** * Specifies billing frequency. Either `day`, `week`, `month` or `year`. diff --git a/types/PromotionCodes.d.ts b/types/PromotionCodes.d.ts index a89780e7fa..905af1ca04 100644 --- a/types/PromotionCodes.d.ts +++ b/types/PromotionCodes.d.ts @@ -23,7 +23,7 @@ declare module 'stripe' { active: boolean; /** - * The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer. + * The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer. Valid characters are lower case letters (a-z), upper case letters (A-Z), and digits (0-9). */ code: string; diff --git a/types/PromotionCodesResource.d.ts b/types/PromotionCodesResource.d.ts index 620838bb23..1381825bfe 100644 --- a/types/PromotionCodesResource.d.ts +++ b/types/PromotionCodesResource.d.ts @@ -14,7 +14,9 @@ declare module 'stripe' { active?: boolean; /** - * The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. If left blank, we will generate one automatically. + * The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. Valid characters are lower case letters (a-z), upper case letters (A-Z), and digits (0-9). + * + * If left blank, we will generate one automatically. */ code?: string; diff --git a/types/Refunds.d.ts b/types/Refunds.d.ts index e9bc8fd90a..d0dfaba75b 100644 --- a/types/Refunds.d.ts +++ b/types/Refunds.d.ts @@ -113,6 +113,8 @@ declare module 'stripe' { alipay?: DestinationDetails.Alipay; + alma?: DestinationDetails.Alma; + amazon_pay?: DestinationDetails.AmazonPay; au_bank_transfer?: DestinationDetails.AuBankTransfer; @@ -180,11 +182,18 @@ declare module 'stripe' { interface Alipay {} + interface Alma {} + interface AmazonPay {} interface AuBankTransfer {} interface Blik { + /** + * For refunds declined by the network, a decline code provided by the network which indicates the reason the refund failed. + */ + network_decline_code?: string | null; + /** * The reference assigned to the refund. */ @@ -329,6 +338,11 @@ declare module 'stripe' { interface Sofort {} interface Swish { + /** + * For refunds declined by the network, a decline code provided by the network which indicates the reason the refund failed. + */ + network_decline_code?: string | null; + /** * The reference assigned to the refund. */ @@ -370,10 +384,7 @@ declare module 'stripe' { } interface NextAction { - /** - * Contains the refund details. - */ - display_details: NextAction.DisplayDetails | null; + display_details?: NextAction.DisplayDetails; /** * Type of the next action to perform. diff --git a/types/SetupAttempts.d.ts b/types/SetupAttempts.d.ts index 39562514e2..4d5b439a8b 100644 --- a/types/SetupAttempts.d.ts +++ b/types/SetupAttempts.d.ts @@ -110,8 +110,12 @@ declare module 'stripe' { ideal?: PaymentMethodDetails.Ideal; + kakao_pay?: PaymentMethodDetails.KakaoPay; + klarna?: PaymentMethodDetails.Klarna; + kr_card?: PaymentMethodDetails.KrCard; + link?: PaymentMethodDetails.Link; paypal?: PaymentMethodDetails.Paypal; @@ -191,7 +195,7 @@ declare module 'stripe' { interface Card { /** - * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ brand: string | null; @@ -248,7 +252,7 @@ declare module 'stripe' { last4: string | null; /** - * Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. + * Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `link`, `mastercard`, `unionpay`, `visa`, or `unknown`. */ network: string | null; @@ -462,8 +466,12 @@ declare module 'stripe' { | 'TRIONL2U'; } + interface KakaoPay {} + interface Klarna {} + interface KrCard {} + interface Link {} interface Paypal {} @@ -549,6 +557,16 @@ declare module 'stripe' { */ message?: string; + /** + * For card errors resulting from a card issuer decline, a 2 digit code which indicates the advice given to merchant by the card network on how to proceed with an error. + */ + network_advice_code?: string; + + /** + * For card errors resulting from a card issuer decline, a brand specific 2, 3, or 4 digit code which indicates the reason the authorization failed. + */ + network_decline_code?: string; + /** * If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field. */ diff --git a/types/SetupIntents.d.ts b/types/SetupIntents.d.ts index 24c2168259..72d09a2d01 100644 --- a/types/SetupIntents.d.ts +++ b/types/SetupIntents.d.ts @@ -130,7 +130,7 @@ declare module 'stripe' { payment_method: string | Stripe.PaymentMethod | null; /** - * Information about the payment method configuration used for this Setup Intent. + * Information about the [payment method configuration](https://stripe.com/docs/api/payment_method_configurations) used for this Setup Intent. */ payment_method_configuration_details: SetupIntent.PaymentMethodConfigurationDetails | null; @@ -214,6 +214,16 @@ declare module 'stripe' { */ message?: string; + /** + * For card errors resulting from a card issuer decline, a 2 digit code which indicates the advice given to merchant by the card network on how to proceed with an error. + */ + network_advice_code?: string; + + /** + * For card errors resulting from a card issuer decline, a brand specific 2, 3, or 4 digit code which indicates the reason the authorization failed. + */ + network_decline_code?: string; + /** * If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field. */ @@ -651,7 +661,12 @@ declare module 'stripe' { } namespace BacsDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'DDIC' or 'STRIPE'. + */ + reference_prefix?: string; + } } interface Card { @@ -739,6 +754,7 @@ declare module 'stripe' { | 'girocard' | 'interac' | 'jcb' + | 'link' | 'mastercard' | 'unionpay' | 'unknown' @@ -769,7 +785,12 @@ declare module 'stripe' { } namespace SepaDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'STRIPE'. + */ + reference_prefix?: string; + } } interface UsBankAccount { diff --git a/types/SetupIntentsResource.d.ts b/types/SetupIntentsResource.d.ts index cff8638b11..1daf85fbf2 100644 --- a/types/SetupIntentsResource.d.ts +++ b/types/SetupIntentsResource.d.ts @@ -72,7 +72,7 @@ declare module 'stripe' { payment_method?: string; /** - * The ID of the payment method configuration to use with this SetupIntent. + * The ID of the [payment method configuration](https://stripe.com/docs/api/payment_method_configurations) to use with this SetupIntent. */ payment_method_configuration?: string; @@ -88,7 +88,7 @@ declare module 'stripe' { payment_method_options?: SetupIntentCreateParams.PaymentMethodOptions; /** - * The list of payment method types (for example, card) that this SetupIntent can use. If you don't provide this, it defaults to ["card"]. + * The list of payment method types (for example, card) that this SetupIntent can use. If you don't provide this, Stripe will dynamically show relevant payment methods from your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). */ payment_method_types?: Array; @@ -209,6 +209,11 @@ declare module 'stripe' { */ allow_redisplay?: PaymentMethodData.AllowRedisplay; + /** + * If this is a Alma PaymentMethod, this hash contains details about the Alma payment method. + */ + alma?: PaymentMethodData.Alma; + /** * If this is a AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method. */ @@ -284,6 +289,11 @@ declare module 'stripe' { */ interac_present?: PaymentMethodData.InteracPresent; + /** + * If this is a `kakao_pay` PaymentMethod, this hash contains details about the Kakao Pay payment method. + */ + kakao_pay?: PaymentMethodData.KakaoPay; + /** * If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. */ @@ -294,6 +304,11 @@ declare module 'stripe' { */ konbini?: PaymentMethodData.Konbini; + /** + * If this is a `kr_card` PaymentMethod, this hash contains details about the Korean Card payment method. + */ + kr_card?: PaymentMethodData.KrCard; + /** * If this is an `Link` PaymentMethod, this hash contains details about the Link payment method. */ @@ -314,6 +329,11 @@ declare module 'stripe' { */ multibanco?: PaymentMethodData.Multibanco; + /** + * If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method. + */ + naver_pay?: PaymentMethodData.NaverPay; + /** * If this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method. */ @@ -324,6 +344,11 @@ declare module 'stripe' { */ p24?: PaymentMethodData.P24; + /** + * If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. + */ + payco?: PaymentMethodData.Payco; + /** * If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. */ @@ -354,6 +379,11 @@ declare module 'stripe' { */ revolut_pay?: PaymentMethodData.RevolutPay; + /** + * If this is a `samsung_pay` PaymentMethod, this hash contains details about the SamsungPay payment method. + */ + samsung_pay?: PaymentMethodData.SamsungPay; + /** * If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. */ @@ -421,6 +451,8 @@ declare module 'stripe' { type AllowRedisplay = 'always' | 'limited' | 'unspecified'; + interface Alma {} + interface AmazonPay {} interface AuBecsDebit { @@ -569,7 +601,7 @@ declare module 'stripe' { interface Ideal { /** - * The customer's bank. + * The customer's bank. Only use this parameter for existing customers. Don't use it for new customers. */ bank?: Ideal.Bank; } @@ -596,6 +628,8 @@ declare module 'stripe' { interface InteracPresent {} + interface KakaoPay {} + interface Klarna { /** * Customer's date of birth @@ -624,12 +658,25 @@ declare module 'stripe' { interface Konbini {} + interface KrCard {} + interface Link {} interface Mobilepay {} interface Multibanco {} + interface NaverPay { + /** + * Whether to use Naver Pay points or a card to fund this transaction. If not provided, this defaults to `card`. + */ + funding?: NaverPay.Funding; + } + + namespace NaverPay { + type Funding = 'card' | 'points'; + } + interface Oxxo {} interface P24 { @@ -669,6 +716,8 @@ declare module 'stripe' { | 'volkswagen_bank'; } + interface Payco {} + interface Paynow {} interface Paypal {} @@ -686,6 +735,8 @@ declare module 'stripe' { interface RevolutPay {} + interface SamsungPay {} + interface SepaDebit { /** * IBAN of the bank account. @@ -713,6 +764,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'amazon_pay' | 'au_becs_debit' | 'bacs_debit' @@ -726,18 +778,23 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'kakao_pay' | 'klarna' | 'konbini' + | 'kr_card' | 'link' | 'mobilepay' | 'multibanco' + | 'naver_pay' | 'oxxo' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'pix' | 'promptpay' | 'revolut_pay' + | 'samsung_pay' | 'sepa_debit' | 'sofort' | 'swish' @@ -902,7 +959,12 @@ declare module 'stripe' { } namespace BacsDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'DDIC' or 'STRIPE'. + */ + reference_prefix?: Stripe.Emptyable; + } } interface Card { @@ -1003,6 +1065,7 @@ declare module 'stripe' { | 'girocard' | 'interac' | 'jcb' + | 'link' | 'mastercard' | 'unionpay' | 'unknown' @@ -1125,7 +1188,12 @@ declare module 'stripe' { } namespace SepaDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'STRIPE'. + */ + reference_prefix?: Stripe.Emptyable; + } } interface UsBankAccount { @@ -1286,7 +1354,7 @@ declare module 'stripe' { payment_method?: string; /** - * The ID of the payment method configuration to use with this SetupIntent. + * The ID of the [payment method configuration](https://stripe.com/docs/api/payment_method_configurations) to use with this SetupIntent. */ payment_method_configuration?: string; @@ -1302,7 +1370,7 @@ declare module 'stripe' { payment_method_options?: SetupIntentUpdateParams.PaymentMethodOptions; /** - * The list of payment method types (for example, card) that this SetupIntent can set up. If you don't provide this array, it defaults to ["card"]. + * The list of payment method types (for example, card) that this SetupIntent can set up. If you don't provide this, Stripe will dynamically show relevant payment methods from your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). */ payment_method_types?: Array; } @@ -1336,6 +1404,11 @@ declare module 'stripe' { */ allow_redisplay?: PaymentMethodData.AllowRedisplay; + /** + * If this is a Alma PaymentMethod, this hash contains details about the Alma payment method. + */ + alma?: PaymentMethodData.Alma; + /** * If this is a AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method. */ @@ -1411,6 +1484,11 @@ declare module 'stripe' { */ interac_present?: PaymentMethodData.InteracPresent; + /** + * If this is a `kakao_pay` PaymentMethod, this hash contains details about the Kakao Pay payment method. + */ + kakao_pay?: PaymentMethodData.KakaoPay; + /** * If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. */ @@ -1421,6 +1499,11 @@ declare module 'stripe' { */ konbini?: PaymentMethodData.Konbini; + /** + * If this is a `kr_card` PaymentMethod, this hash contains details about the Korean Card payment method. + */ + kr_card?: PaymentMethodData.KrCard; + /** * If this is an `Link` PaymentMethod, this hash contains details about the Link payment method. */ @@ -1441,6 +1524,11 @@ declare module 'stripe' { */ multibanco?: PaymentMethodData.Multibanco; + /** + * If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method. + */ + naver_pay?: PaymentMethodData.NaverPay; + /** * If this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method. */ @@ -1451,6 +1539,11 @@ declare module 'stripe' { */ p24?: PaymentMethodData.P24; + /** + * If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. + */ + payco?: PaymentMethodData.Payco; + /** * If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. */ @@ -1481,6 +1574,11 @@ declare module 'stripe' { */ revolut_pay?: PaymentMethodData.RevolutPay; + /** + * If this is a `samsung_pay` PaymentMethod, this hash contains details about the SamsungPay payment method. + */ + samsung_pay?: PaymentMethodData.SamsungPay; + /** * If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. */ @@ -1548,6 +1646,8 @@ declare module 'stripe' { type AllowRedisplay = 'always' | 'limited' | 'unspecified'; + interface Alma {} + interface AmazonPay {} interface AuBecsDebit { @@ -1696,7 +1796,7 @@ declare module 'stripe' { interface Ideal { /** - * The customer's bank. + * The customer's bank. Only use this parameter for existing customers. Don't use it for new customers. */ bank?: Ideal.Bank; } @@ -1723,6 +1823,8 @@ declare module 'stripe' { interface InteracPresent {} + interface KakaoPay {} + interface Klarna { /** * Customer's date of birth @@ -1751,12 +1853,25 @@ declare module 'stripe' { interface Konbini {} + interface KrCard {} + interface Link {} interface Mobilepay {} interface Multibanco {} + interface NaverPay { + /** + * Whether to use Naver Pay points or a card to fund this transaction. If not provided, this defaults to `card`. + */ + funding?: NaverPay.Funding; + } + + namespace NaverPay { + type Funding = 'card' | 'points'; + } + interface Oxxo {} interface P24 { @@ -1796,6 +1911,8 @@ declare module 'stripe' { | 'volkswagen_bank'; } + interface Payco {} + interface Paynow {} interface Paypal {} @@ -1813,6 +1930,8 @@ declare module 'stripe' { interface RevolutPay {} + interface SamsungPay {} + interface SepaDebit { /** * IBAN of the bank account. @@ -1840,6 +1959,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'amazon_pay' | 'au_becs_debit' | 'bacs_debit' @@ -1853,18 +1973,23 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'kakao_pay' | 'klarna' | 'konbini' + | 'kr_card' | 'link' | 'mobilepay' | 'multibanco' + | 'naver_pay' | 'oxxo' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'pix' | 'promptpay' | 'revolut_pay' + | 'samsung_pay' | 'sepa_debit' | 'sofort' | 'swish' @@ -2029,7 +2154,12 @@ declare module 'stripe' { } namespace BacsDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'DDIC' or 'STRIPE'. + */ + reference_prefix?: Stripe.Emptyable; + } } interface Card { @@ -2130,6 +2260,7 @@ declare module 'stripe' { | 'girocard' | 'interac' | 'jcb' + | 'link' | 'mastercard' | 'unionpay' | 'unknown' @@ -2252,7 +2383,12 @@ declare module 'stripe' { } namespace SepaDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'STRIPE'. + */ + reference_prefix?: Stripe.Emptyable; + } } interface UsBankAccount { @@ -2512,6 +2648,11 @@ declare module 'stripe' { */ allow_redisplay?: PaymentMethodData.AllowRedisplay; + /** + * If this is a Alma PaymentMethod, this hash contains details about the Alma payment method. + */ + alma?: PaymentMethodData.Alma; + /** * If this is a AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method. */ @@ -2587,6 +2728,11 @@ declare module 'stripe' { */ interac_present?: PaymentMethodData.InteracPresent; + /** + * If this is a `kakao_pay` PaymentMethod, this hash contains details about the Kakao Pay payment method. + */ + kakao_pay?: PaymentMethodData.KakaoPay; + /** * If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. */ @@ -2597,6 +2743,11 @@ declare module 'stripe' { */ konbini?: PaymentMethodData.Konbini; + /** + * If this is a `kr_card` PaymentMethod, this hash contains details about the Korean Card payment method. + */ + kr_card?: PaymentMethodData.KrCard; + /** * If this is an `Link` PaymentMethod, this hash contains details about the Link payment method. */ @@ -2617,6 +2768,11 @@ declare module 'stripe' { */ multibanco?: PaymentMethodData.Multibanco; + /** + * If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method. + */ + naver_pay?: PaymentMethodData.NaverPay; + /** * If this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method. */ @@ -2627,6 +2783,11 @@ declare module 'stripe' { */ p24?: PaymentMethodData.P24; + /** + * If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. + */ + payco?: PaymentMethodData.Payco; + /** * If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. */ @@ -2657,6 +2818,11 @@ declare module 'stripe' { */ revolut_pay?: PaymentMethodData.RevolutPay; + /** + * If this is a `samsung_pay` PaymentMethod, this hash contains details about the SamsungPay payment method. + */ + samsung_pay?: PaymentMethodData.SamsungPay; + /** * If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. */ @@ -2724,6 +2890,8 @@ declare module 'stripe' { type AllowRedisplay = 'always' | 'limited' | 'unspecified'; + interface Alma {} + interface AmazonPay {} interface AuBecsDebit { @@ -2872,7 +3040,7 @@ declare module 'stripe' { interface Ideal { /** - * The customer's bank. + * The customer's bank. Only use this parameter for existing customers. Don't use it for new customers. */ bank?: Ideal.Bank; } @@ -2899,6 +3067,8 @@ declare module 'stripe' { interface InteracPresent {} + interface KakaoPay {} + interface Klarna { /** * Customer's date of birth @@ -2927,12 +3097,25 @@ declare module 'stripe' { interface Konbini {} + interface KrCard {} + interface Link {} interface Mobilepay {} interface Multibanco {} + interface NaverPay { + /** + * Whether to use Naver Pay points or a card to fund this transaction. If not provided, this defaults to `card`. + */ + funding?: NaverPay.Funding; + } + + namespace NaverPay { + type Funding = 'card' | 'points'; + } + interface Oxxo {} interface P24 { @@ -2972,6 +3155,8 @@ declare module 'stripe' { | 'volkswagen_bank'; } + interface Payco {} + interface Paynow {} interface Paypal {} @@ -2989,6 +3174,8 @@ declare module 'stripe' { interface RevolutPay {} + interface SamsungPay {} + interface SepaDebit { /** * IBAN of the bank account. @@ -3016,6 +3203,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'amazon_pay' | 'au_becs_debit' | 'bacs_debit' @@ -3029,18 +3217,23 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'kakao_pay' | 'klarna' | 'konbini' + | 'kr_card' | 'link' | 'mobilepay' | 'multibanco' + | 'naver_pay' | 'oxxo' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'pix' | 'promptpay' | 'revolut_pay' + | 'samsung_pay' | 'sepa_debit' | 'sofort' | 'swish' @@ -3205,7 +3398,12 @@ declare module 'stripe' { } namespace BacsDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'DDIC' or 'STRIPE'. + */ + reference_prefix?: Stripe.Emptyable; + } } interface Card { @@ -3306,6 +3504,7 @@ declare module 'stripe' { | 'girocard' | 'interac' | 'jcb' + | 'link' | 'mastercard' | 'unionpay' | 'unknown' @@ -3428,7 +3627,12 @@ declare module 'stripe' { } namespace SepaDebit { - interface MandateOptions {} + interface MandateOptions { + /** + * Prefix used to generate the Mandate reference. Must be at most 12 characters long. Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'. Cannot begin with 'STRIPE'. + */ + reference_prefix?: Stripe.Emptyable; + } } interface UsBankAccount { diff --git a/types/Sources.d.ts b/types/Sources.d.ts index 8371931599..8b5984459f 100644 --- a/types/Sources.d.ts +++ b/types/Sources.d.ts @@ -33,6 +33,11 @@ declare module 'stripe' { alipay?: Source.Alipay; + /** + * This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to “unspecified”. + */ + allow_redisplay: Source.AllowRedisplay | null; + /** * A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount associated with the source. This is the amount for which the source will be chargeable once ready. Required for `single_use` sources. */ @@ -200,6 +205,8 @@ declare module 'stripe' { statement_descriptor?: string | null; } + type AllowRedisplay = 'always' | 'limited' | 'unspecified'; + interface AuBecsDebit { bsb_number?: string | null; diff --git a/types/SubscriptionSchedules.d.ts b/types/SubscriptionSchedules.d.ts index 5fe955a248..954a69e6f3 100644 --- a/types/SubscriptionSchedules.d.ts +++ b/types/SubscriptionSchedules.d.ts @@ -161,6 +161,11 @@ declare module 'stripe' { namespace DefaultSettings { interface AutomaticTax { + /** + * If Stripe disabled automatic tax, this enum describes why. + */ + disabled_reason: 'requires_location_inputs' | null; + /** * Whether Stripe automatically computes tax on invoices created during this phase. */ @@ -402,6 +407,11 @@ declare module 'stripe' { } interface AutomaticTax { + /** + * If Stripe disabled automatic tax, this enum describes why. + */ + disabled_reason: 'requires_location_inputs' | null; + /** * Whether Stripe automatically computes tax on invoices created during this phase. */ diff --git a/types/Subscriptions.d.ts b/types/Subscriptions.d.ts index 879ab18071..08e2cba9a6 100644 --- a/types/Subscriptions.d.ts +++ b/types/Subscriptions.d.ts @@ -172,7 +172,7 @@ declare module 'stripe' { on_behalf_of: string | Stripe.Account | null; /** - * If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/billing/subscriptions/pause-payment). + * If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/docs/billing/subscriptions/pause-payment). */ pause_collection: Subscription.PauseCollection | null; @@ -213,7 +213,7 @@ declare module 'stripe' { * * A subscription that is currently in a trial period is `trialing` and moves to `active` when the trial period is over. * - * A subscription can only enter a `paused` status [when a trial ends without a payment method](https://stripe.com/billing/subscriptions/trials#create-free-trials-without-payment). A `paused` subscription doesn't generate invoices and can be resumed after your customer adds their payment method. The `paused` status is different from [pausing collection](https://stripe.com/billing/subscriptions/pause-payment), which still generates invoices and leaves the subscription's status unchanged. + * A subscription can only enter a `paused` status [when a trial ends without a payment method](https://stripe.com/docs/billing/subscriptions/trials#create-free-trials-without-payment). A `paused` subscription doesn't generate invoices and can be resumed after your customer adds their payment method. The `paused` status is different from [pausing collection](https://stripe.com/docs/billing/subscriptions/pause-payment), which still generates invoices and leaves the subscription's status unchanged. * * If subscription `collection_method=charge_automatically`, it becomes `past_due` when payment is required but cannot be paid (due to failed payment or awaiting additional user actions). Once Stripe has exhausted all payment retry attempts, the subscription will become `canceled` or `unpaid` (depending on your subscriptions settings). * @@ -249,6 +249,11 @@ declare module 'stripe' { namespace Subscription { interface AutomaticTax { + /** + * If Stripe disabled automatic tax, this enum describes why. + */ + disabled_reason: 'requires_location_inputs' | null; + /** * Whether Stripe automatically computes tax on this subscription. */ @@ -534,6 +539,7 @@ declare module 'stripe' { | 'girocard' | 'interac' | 'jcb' + | 'link' | 'mastercard' | 'unionpay' | 'unknown' @@ -645,10 +651,15 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'jp_credit_transfer' + | 'kakao_pay' | 'konbini' + | 'kr_card' | 'link' | 'multibanco' + | 'naver_pay' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'promptpay' diff --git a/types/SubscriptionsResource.d.ts b/types/SubscriptionsResource.d.ts index 44484a8a14..6e290d7025 100644 --- a/types/SubscriptionsResource.d.ts +++ b/types/SubscriptionsResource.d.ts @@ -522,7 +522,7 @@ declare module 'stripe' { payment_method_options?: PaymentSettings.PaymentMethodOptions; /** - * The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). + * The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). Should not be specified with payment_method_configuration */ payment_method_types?: Stripe.Emptyable< Array @@ -663,6 +663,7 @@ declare module 'stripe' { | 'girocard' | 'interac' | 'jcb' + | 'link' | 'mastercard' | 'unionpay' | 'unknown' @@ -782,10 +783,15 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'jp_credit_transfer' + | 'kakao_pay' | 'konbini' + | 'kr_card' | 'link' | 'multibanco' + | 'naver_pay' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'promptpay' @@ -972,7 +978,7 @@ declare module 'stripe' { on_behalf_of?: Stripe.Emptyable; /** - * If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/billing/subscriptions/pause-payment). + * If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/docs/billing/subscriptions/pause-payment). */ pause_collection?: Stripe.Emptyable< SubscriptionUpdateParams.PauseCollection @@ -1239,7 +1245,7 @@ declare module 'stripe' { billing_thresholds?: Stripe.Emptyable; /** - * Delete all usage for a given subscription item. Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`. + * Delete all usage for a given subscription item. You must pass this when deleting a usage records subscription item. `clear_usage` has no effect if the plan has a billing meter attached. */ clear_usage?: boolean; @@ -1396,7 +1402,7 @@ declare module 'stripe' { payment_method_options?: PaymentSettings.PaymentMethodOptions; /** - * The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). + * The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). Should not be specified with payment_method_configuration */ payment_method_types?: Stripe.Emptyable< Array @@ -1537,6 +1543,7 @@ declare module 'stripe' { | 'girocard' | 'interac' | 'jcb' + | 'link' | 'mastercard' | 'unionpay' | 'unknown' @@ -1656,10 +1663,15 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'jp_credit_transfer' + | 'kakao_pay' | 'konbini' + | 'kr_card' | 'link' | 'multibanco' + | 'naver_pay' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'promptpay' @@ -1817,7 +1829,7 @@ declare module 'stripe' { expand?: Array; /** - * Will generate a final invoice that invoices for any un-invoiced metered usage and new/pending proration invoice items. Defaults to `true`. + * Will generate a final invoice that invoices for any un-invoiced metered usage and new/pending proration invoice items. Defaults to `false`. */ invoice_now?: boolean; @@ -1857,7 +1869,7 @@ declare module 'stripe' { interface SubscriptionResumeParams { /** - * Either `now` or `unchanged`. Setting the value to `now` resets the subscription's billing cycle anchor to the current time (in UTC). Setting the value to `unchanged` advances the subscription's billing cycle anchor to the period that surrounds the current time. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). + * The billing cycle anchor that applies when the subscription is resumed. Either `now` or `unchanged`. The default is `now`. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). */ billing_cycle_anchor?: SubscriptionResumeParams.BillingCycleAnchor; @@ -1948,7 +1960,7 @@ declare module 'stripe' { * A trial starts or ends. * * - * In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how [Stripe immediately attempts payment for subscription changes](https://stripe.com/billing/subscriptions/upgrade-downgrade#immediate-payment). + * In these cases, we apply a credit for the unused time on the previous price, immediately charge the customer using the new price, and reset the billing date. Learn about how [Stripe immediately attempts payment for subscription changes](https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#immediate-payment). * * If you want to charge for an upgrade immediately, pass proration_behavior as always_invoice to create prorations, automatically invoice the customer for those proration adjustments, and attempt to collect payment. If you pass create_prorations, the prorations are created but not automatically invoiced. If you want to bill the customer for the prorations before the subscription's renewal date, you need to manually [invoice the customer](https://stripe.com/docs/api/invoices/create). * @@ -1972,11 +1984,11 @@ declare module 'stripe' { list(options?: RequestOptions): ApiListPromise; /** - * Cancels a customer's subscription immediately. The customer will not be charged again for the subscription. + * Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata). * - * Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed. + * Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed. * - * By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. + * By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all. */ cancel( id: string, diff --git a/types/Tax/CalculationLineItems.d.ts b/types/Tax/CalculationLineItems.d.ts index 1b106c5de3..5ad96d0132 100644 --- a/types/Tax/CalculationLineItems.d.ts +++ b/types/Tax/CalculationLineItems.d.ts @@ -169,8 +169,10 @@ declare module 'stripe' { | 'lease_tax' | 'pst' | 'qst' + | 'retail_delivery_fee' | 'rst' | 'sales_tax' + | 'service_tax' | 'vat'; } } diff --git a/types/Tax/Calculations.d.ts b/types/Tax/Calculations.d.ts index 6d3364c255..9eddd136fe 100644 --- a/types/Tax/Calculations.d.ts +++ b/types/Tax/Calculations.d.ts @@ -120,7 +120,7 @@ declare module 'stripe' { interface TaxId { /** - * The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `hr_oib`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `no_voec`, `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`, `bh_vat`, `kz_bin`, `ng_tin`, `om_vat`, `de_stn`, `ch_uid`, or `unknown` + * The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `hr_oib`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `no_voec`, `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`, `li_vat`, `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`, `al_tin`, `bh_vat`, `kz_bin`, `ng_tin`, `om_vat`, `de_stn`, `ch_uid`, `tz_vat`, `uz_vat`, `uz_tin`, `md_vat`, `ma_vat`, `by_tin`, `ao_tin`, `bs_tin`, `bb_tin`, `cd_nif`, `mr_nif`, `me_pib`, `zw_tin`, `ba_tin`, `gn_nif`, `mk_vat`, `sr_fin`, `sn_ninea`, `am_tin`, `np_pan`, `tj_tin`, `ug_tin`, `zm_tin`, `kh_tin`, or `unknown` */ type: TaxId.Type; @@ -134,20 +134,28 @@ declare module 'stripe' { type Type = | 'ad_nrt' | 'ae_trn' + | 'al_tin' + | 'am_tin' + | 'ao_tin' | 'ar_cuit' | 'au_abn' | 'au_arn' + | 'ba_tin' + | 'bb_tin' | 'bg_uic' | 'bh_vat' | 'bo_tin' | 'br_cnpj' | 'br_cpf' + | 'bs_tin' + | 'by_tin' | 'ca_bn' | 'ca_gst_hst' | 'ca_pst_bc' | 'ca_pst_mb' | 'ca_pst_sk' | 'ca_qst' + | 'cd_nif' | 'ch_uid' | 'ch_vat' | 'cl_tin' @@ -163,6 +171,7 @@ declare module 'stripe' { | 'eu_vat' | 'gb_vat' | 'ge_vat' + | 'gn_nif' | 'hk_br' | 'hr_oib' | 'hu_tin' @@ -174,9 +183,16 @@ declare module 'stripe' { | 'jp_rn' | 'jp_trn' | 'ke_pin' + | 'kh_tin' | 'kr_brn' | 'kz_bin' | 'li_uid' + | 'li_vat' + | 'ma_vat' + | 'md_vat' + | 'me_pib' + | 'mk_vat' + | 'mr_nif' | 'mx_rfc' | 'my_frp' | 'my_itn' @@ -184,6 +200,7 @@ declare module 'stripe' { | 'ng_tin' | 'no_vat' | 'no_voec' + | 'np_pan' | 'nz_gst' | 'om_vat' | 'pe_ruc' @@ -196,17 +213,26 @@ declare module 'stripe' { | 'sg_gst' | 'sg_uen' | 'si_tin' + | 'sn_ninea' + | 'sr_fin' | 'sv_nit' | 'th_vat' + | 'tj_tin' | 'tr_tin' | 'tw_vat' + | 'tz_vat' | 'ua_vat' + | 'ug_tin' | 'unknown' | 'us_ein' | 'uy_ruc' + | 'uz_tin' + | 'uz_vat' | 've_rif' | 'vn_tin' - | 'za_vat'; + | 'za_vat' + | 'zm_tin' + | 'zw_tin'; } } @@ -352,8 +378,10 @@ declare module 'stripe' { | 'lease_tax' | 'pst' | 'qst' + | 'retail_delivery_fee' | 'rst' | 'sales_tax' + | 'service_tax' | 'vat'; } } @@ -407,11 +435,21 @@ declare module 'stripe' { */ country: string | null; + /** + * The amount of the tax rate when the `rate_type` is `flat_amount`. Tax rates with `rate_type` `percentage` can vary based on the transaction, resulting in this field being `null`. This field exposes the amount and currency of the flat tax rate. + */ + flat_amount: TaxRateDetails.FlatAmount | null; + /** * The tax rate percentage as a string. For example, 8.5% is represented as `"8.5"`. */ percentage_decimal: string; + /** + * Indicates the type of tax rate applied to the taxable amount. This value can be `null` when no tax applies to the location. + */ + rate_type: TaxRateDetails.RateType | null; + /** * State, county, province, or region. */ @@ -424,6 +462,20 @@ declare module 'stripe' { } namespace TaxRateDetails { + interface FlatAmount { + /** + * Amount of the tax when the `rate_type` is `flat_amount`. This positive integer represents how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). + */ + amount: number; + + /** + * Three-letter ISO currency code, in lowercase. + */ + currency: string; + } + + type RateType = 'flat_amount' | 'percentage'; + type TaxType = | 'amusement_tax' | 'communications_tax' @@ -434,8 +486,10 @@ declare module 'stripe' { | 'lease_tax' | 'pst' | 'qst' + | 'retail_delivery_fee' | 'rst' | 'sales_tax' + | 'service_tax' | 'vat'; } } diff --git a/types/Tax/CalculationsResource.d.ts b/types/Tax/CalculationsResource.d.ts index eee0312e72..26543cd5ed 100644 --- a/types/Tax/CalculationsResource.d.ts +++ b/types/Tax/CalculationsResource.d.ts @@ -115,7 +115,7 @@ declare module 'stripe' { interface TaxId { /** - * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `kz_bin`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat` + * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `ba_tin`, `bb_tin`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kh_tin`, `kr_brn`, `kz_bin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin` */ type: TaxId.Type; @@ -129,20 +129,28 @@ declare module 'stripe' { type Type = | 'ad_nrt' | 'ae_trn' + | 'al_tin' + | 'am_tin' + | 'ao_tin' | 'ar_cuit' | 'au_abn' | 'au_arn' + | 'ba_tin' + | 'bb_tin' | 'bg_uic' | 'bh_vat' | 'bo_tin' | 'br_cnpj' | 'br_cpf' + | 'bs_tin' + | 'by_tin' | 'ca_bn' | 'ca_gst_hst' | 'ca_pst_bc' | 'ca_pst_mb' | 'ca_pst_sk' | 'ca_qst' + | 'cd_nif' | 'ch_uid' | 'ch_vat' | 'cl_tin' @@ -158,6 +166,7 @@ declare module 'stripe' { | 'eu_vat' | 'gb_vat' | 'ge_vat' + | 'gn_nif' | 'hk_br' | 'hr_oib' | 'hu_tin' @@ -169,9 +178,16 @@ declare module 'stripe' { | 'jp_rn' | 'jp_trn' | 'ke_pin' + | 'kh_tin' | 'kr_brn' | 'kz_bin' | 'li_uid' + | 'li_vat' + | 'ma_vat' + | 'md_vat' + | 'me_pib' + | 'mk_vat' + | 'mr_nif' | 'mx_rfc' | 'my_frp' | 'my_itn' @@ -179,6 +195,7 @@ declare module 'stripe' { | 'ng_tin' | 'no_vat' | 'no_voec' + | 'np_pan' | 'nz_gst' | 'om_vat' | 'pe_ruc' @@ -191,16 +208,25 @@ declare module 'stripe' { | 'sg_gst' | 'sg_uen' | 'si_tin' + | 'sn_ninea' + | 'sr_fin' | 'sv_nit' | 'th_vat' + | 'tj_tin' | 'tr_tin' | 'tw_vat' + | 'tz_vat' | 'ua_vat' + | 'ug_tin' | 'us_ein' | 'uy_ruc' + | 'uz_tin' + | 'uz_vat' | 've_rif' | 'vn_tin' - | 'za_vat'; + | 'za_vat' + | 'zm_tin' + | 'zw_tin'; } } diff --git a/types/Tax/Registrations.d.ts b/types/Tax/Registrations.d.ts index afe8693a57..58b7cb4aeb 100644 --- a/types/Tax/Registrations.d.ts +++ b/types/Tax/Registrations.d.ts @@ -58,24 +58,42 @@ declare module 'stripe' { interface CountryOptions { ae?: CountryOptions.Ae; + al?: CountryOptions.Al; + + am?: CountryOptions.Am; + + ao?: CountryOptions.Ao; + at?: CountryOptions.At; au?: CountryOptions.Au; + ba?: CountryOptions.Ba; + + bb?: CountryOptions.Bb; + be?: CountryOptions.Be; bg?: CountryOptions.Bg; bh?: CountryOptions.Bh; + bs?: CountryOptions.Bs; + + by?: CountryOptions.By; + ca?: CountryOptions.Ca; + cd?: CountryOptions.Cd; + ch?: CountryOptions.Ch; cl?: CountryOptions.Cl; co?: CountryOptions.Co; + cr?: CountryOptions.Cr; + cy?: CountryOptions.Cy; cz?: CountryOptions.Cz; @@ -84,6 +102,8 @@ declare module 'stripe' { dk?: CountryOptions.Dk; + ec?: CountryOptions.Ec; + ee?: CountryOptions.Ee; eg?: CountryOptions.Eg; @@ -98,6 +118,8 @@ declare module 'stripe' { ge?: CountryOptions.Ge; + gn?: CountryOptions.Gn; + gr?: CountryOptions.Gr; hr?: CountryOptions.Hr; @@ -116,6 +138,8 @@ declare module 'stripe' { ke?: CountryOptions.Ke; + kh?: CountryOptions.Kh; + kr?: CountryOptions.Kr; kz?: CountryOptions.Kz; @@ -126,6 +150,16 @@ declare module 'stripe' { lv?: CountryOptions.Lv; + ma?: CountryOptions.Ma; + + md?: CountryOptions.Md; + + me?: CountryOptions.Me; + + mk?: CountryOptions.Mk; + + mr?: CountryOptions.Mr; + mt?: CountryOptions.Mt; mx?: CountryOptions.Mx; @@ -138,16 +172,24 @@ declare module 'stripe' { no?: CountryOptions.No; + np?: CountryOptions.Np; + nz?: CountryOptions.Nz; om?: CountryOptions.Om; + pe?: CountryOptions.Pe; + pl?: CountryOptions.Pl; pt?: CountryOptions.Pt; ro?: CountryOptions.Ro; + rs?: CountryOptions.Rs; + + ru?: CountryOptions.Ru; + sa?: CountryOptions.Sa; se?: CountryOptions.Se; @@ -158,15 +200,33 @@ declare module 'stripe' { sk?: CountryOptions.Sk; + sn?: CountryOptions.Sn; + + sr?: CountryOptions.Sr; + th?: CountryOptions.Th; + tj?: CountryOptions.Tj; + tr?: CountryOptions.Tr; + tz?: CountryOptions.Tz; + + ug?: CountryOptions.Ug; + us?: CountryOptions.Us; + uy?: CountryOptions.Uy; + + uz?: CountryOptions.Uz; + vn?: CountryOptions.Vn; za?: CountryOptions.Za; + + zm?: CountryOptions.Zm; + + zw?: CountryOptions.Zw; } namespace CountryOptions { @@ -177,6 +237,27 @@ declare module 'stripe' { type: 'standard'; } + interface Al { + /** + * Type of registration in `country`. + */ + type: 'standard'; + } + + interface Am { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + + interface Ao { + /** + * Type of registration in `country`. + */ + type: 'standard'; + } + interface At { standard?: At.Standard; @@ -208,6 +289,20 @@ declare module 'stripe' { type: 'standard'; } + interface Ba { + /** + * Type of registration in `country`. + */ + type: 'standard'; + } + + interface Bb { + /** + * Type of registration in `country`. + */ + type: 'standard'; + } + interface Be { standard?: Be.Standard; @@ -263,6 +358,20 @@ declare module 'stripe' { type: 'standard'; } + interface Bs { + /** + * Type of registration in `country`. + */ + type: 'standard'; + } + + interface By { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + interface Ca { province_standard?: Ca.ProvinceStandard; @@ -283,6 +392,13 @@ declare module 'stripe' { type Type = 'province_standard' | 'simplified' | 'standard'; } + interface Cd { + /** + * Type of registration in `country`. + */ + type: 'standard'; + } + interface Ch { /** * Type of registration in `country`. @@ -304,6 +420,13 @@ declare module 'stripe' { type: 'simplified'; } + interface Cr { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + interface Cy { standard?: Cy.Standard; @@ -400,6 +523,13 @@ declare module 'stripe' { type Type = 'ioss' | 'oss_non_union' | 'oss_union' | 'standard'; } + interface Ec { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + interface Ee { standard?: Ee.Standard; @@ -517,6 +647,13 @@ declare module 'stripe' { type: 'simplified'; } + interface Gn { + /** + * Type of registration in `country`. + */ + type: 'standard'; + } + interface Gr { standard?: Gr.Standard; @@ -665,6 +802,13 @@ declare module 'stripe' { type: 'simplified'; } + interface Kh { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + interface Kr { /** * Type of registration in `country`. @@ -751,6 +895,41 @@ declare module 'stripe' { type Type = 'ioss' | 'oss_non_union' | 'oss_union' | 'standard'; } + interface Ma { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + + interface Md { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + + interface Me { + /** + * Type of registration in `country`. + */ + type: 'standard'; + } + + interface Mk { + /** + * Type of registration in `country`. + */ + type: 'standard'; + } + + interface Mr { + /** + * Type of registration in `country`. + */ + type: 'standard'; + } + interface Mt { standard?: Mt.Standard; @@ -827,6 +1006,13 @@ declare module 'stripe' { type: 'standard'; } + interface Np { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + interface Nz { /** * Type of registration in `country`. @@ -841,6 +1027,13 @@ declare module 'stripe' { type: 'standard'; } + interface Pe { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + interface Pl { standard?: Pl.Standard; @@ -913,6 +1106,20 @@ declare module 'stripe' { type Type = 'ioss' | 'oss_non_union' | 'oss_union' | 'standard'; } + interface Rs { + /** + * Type of registration in `country`. + */ + type: 'standard'; + } + + interface Ru { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + interface Sa { /** * Type of registration in `country`. @@ -999,6 +1206,20 @@ declare module 'stripe' { type Type = 'ioss' | 'oss_non_union' | 'oss_union' | 'standard'; } + interface Sn { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + + interface Sr { + /** + * Type of registration in `country`. + */ + type: 'standard'; + } + interface Th { /** * Type of registration in `country`. @@ -1006,6 +1227,13 @@ declare module 'stripe' { type: 'simplified'; } + interface Tj { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + interface Tr { /** * Type of registration in `country`. @@ -1013,6 +1241,20 @@ declare module 'stripe' { type: 'simplified'; } + interface Tz { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + + interface Ug { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + interface Us { local_amusement_tax?: Us.LocalAmusementTax; @@ -1078,9 +1320,24 @@ declare module 'stripe' { | 'local_amusement_tax' | 'local_lease_tax' | 'state_communications_tax' + | 'state_retail_delivery_fee' | 'state_sales_tax'; } + interface Uy { + /** + * Type of registration in `country`. + */ + type: 'standard'; + } + + interface Uz { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + interface Vn { /** * Type of registration in `country`. @@ -1094,6 +1351,20 @@ declare module 'stripe' { */ type: 'standard'; } + + interface Zm { + /** + * Type of registration in `country`. + */ + type: 'simplified'; + } + + interface Zw { + /** + * Type of registration in `country`. + */ + type: 'standard'; + } } type Status = 'active' | 'expired' | 'scheduled'; diff --git a/types/Tax/RegistrationsResource.d.ts b/types/Tax/RegistrationsResource.d.ts index 0e95503407..938a9cdbfe 100644 --- a/types/Tax/RegistrationsResource.d.ts +++ b/types/Tax/RegistrationsResource.d.ts @@ -37,6 +37,21 @@ declare module 'stripe' { */ ae?: CountryOptions.Ae; + /** + * Options for the registration in AL. + */ + al?: CountryOptions.Al; + + /** + * Options for the registration in AM. + */ + am?: CountryOptions.Am; + + /** + * Options for the registration in AO. + */ + ao?: CountryOptions.Ao; + /** * Options for the registration in AT. */ @@ -47,6 +62,16 @@ declare module 'stripe' { */ au?: CountryOptions.Au; + /** + * Options for the registration in BA. + */ + ba?: CountryOptions.Ba; + + /** + * Options for the registration in BB. + */ + bb?: CountryOptions.Bb; + /** * Options for the registration in BE. */ @@ -62,11 +87,26 @@ declare module 'stripe' { */ bh?: CountryOptions.Bh; + /** + * Options for the registration in BS. + */ + bs?: CountryOptions.Bs; + + /** + * Options for the registration in BY. + */ + by?: CountryOptions.By; + /** * Options for the registration in CA. */ ca?: CountryOptions.Ca; + /** + * Options for the registration in CD. + */ + cd?: CountryOptions.Cd; + /** * Options for the registration in CH. */ @@ -82,6 +122,11 @@ declare module 'stripe' { */ co?: CountryOptions.Co; + /** + * Options for the registration in CR. + */ + cr?: CountryOptions.Cr; + /** * Options for the registration in CY. */ @@ -102,6 +147,11 @@ declare module 'stripe' { */ dk?: CountryOptions.Dk; + /** + * Options for the registration in EC. + */ + ec?: CountryOptions.Ec; + /** * Options for the registration in EE. */ @@ -137,6 +187,11 @@ declare module 'stripe' { */ ge?: CountryOptions.Ge; + /** + * Options for the registration in GN. + */ + gn?: CountryOptions.Gn; + /** * Options for the registration in GR. */ @@ -182,6 +237,11 @@ declare module 'stripe' { */ ke?: CountryOptions.Ke; + /** + * Options for the registration in KH. + */ + kh?: CountryOptions.Kh; + /** * Options for the registration in KR. */ @@ -207,6 +267,31 @@ declare module 'stripe' { */ lv?: CountryOptions.Lv; + /** + * Options for the registration in MA. + */ + ma?: CountryOptions.Ma; + + /** + * Options for the registration in MD. + */ + md?: CountryOptions.Md; + + /** + * Options for the registration in ME. + */ + me?: CountryOptions.Me; + + /** + * Options for the registration in MK. + */ + mk?: CountryOptions.Mk; + + /** + * Options for the registration in MR. + */ + mr?: CountryOptions.Mr; + /** * Options for the registration in MT. */ @@ -237,6 +322,11 @@ declare module 'stripe' { */ no?: CountryOptions.No; + /** + * Options for the registration in NP. + */ + np?: CountryOptions.Np; + /** * Options for the registration in NZ. */ @@ -247,6 +337,11 @@ declare module 'stripe' { */ om?: CountryOptions.Om; + /** + * Options for the registration in PE. + */ + pe?: CountryOptions.Pe; + /** * Options for the registration in PL. */ @@ -262,6 +357,16 @@ declare module 'stripe' { */ ro?: CountryOptions.Ro; + /** + * Options for the registration in RS. + */ + rs?: CountryOptions.Rs; + + /** + * Options for the registration in RU. + */ + ru?: CountryOptions.Ru; + /** * Options for the registration in SA. */ @@ -287,21 +392,56 @@ declare module 'stripe' { */ sk?: CountryOptions.Sk; + /** + * Options for the registration in SN. + */ + sn?: CountryOptions.Sn; + + /** + * Options for the registration in SR. + */ + sr?: CountryOptions.Sr; + /** * Options for the registration in TH. */ th?: CountryOptions.Th; + /** + * Options for the registration in TJ. + */ + tj?: CountryOptions.Tj; + /** * Options for the registration in TR. */ tr?: CountryOptions.Tr; + /** + * Options for the registration in TZ. + */ + tz?: CountryOptions.Tz; + + /** + * Options for the registration in UG. + */ + ug?: CountryOptions.Ug; + /** * Options for the registration in US. */ us?: CountryOptions.Us; + /** + * Options for the registration in UY. + */ + uy?: CountryOptions.Uy; + + /** + * Options for the registration in UZ. + */ + uz?: CountryOptions.Uz; + /** * Options for the registration in VN. */ @@ -311,6 +451,16 @@ declare module 'stripe' { * Options for the registration in ZA. */ za?: CountryOptions.Za; + + /** + * Options for the registration in ZM. + */ + zm?: CountryOptions.Zm; + + /** + * Options for the registration in ZW. + */ + zw?: CountryOptions.Zw; } namespace CountryOptions { @@ -321,6 +471,27 @@ declare module 'stripe' { type: 'standard'; } + interface Al { + /** + * Type of registration to be created in `country`. + */ + type: 'standard'; + } + + interface Am { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + + interface Ao { + /** + * Type of registration to be created in `country`. + */ + type: 'standard'; + } + interface At { /** * Options for the standard registration. @@ -355,6 +526,20 @@ declare module 'stripe' { type: 'standard'; } + interface Ba { + /** + * Type of registration to be created in `country`. + */ + type: 'standard'; + } + + interface Bb { + /** + * Type of registration to be created in `country`. + */ + type: 'standard'; + } + interface Be { /** * Options for the standard registration. @@ -416,6 +601,20 @@ declare module 'stripe' { type: 'standard'; } + interface Bs { + /** + * Type of registration to be created in `country`. + */ + type: 'standard'; + } + + interface By { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + interface Ca { /** * Options for the provincial tax registration. @@ -439,6 +638,13 @@ declare module 'stripe' { type Type = 'province_standard' | 'simplified' | 'standard'; } + interface Cd { + /** + * Type of registration to be created in `country`. + */ + type: 'standard'; + } + interface Ch { /** * Type of registration to be created in `country`. @@ -460,6 +666,13 @@ declare module 'stripe' { type: 'simplified'; } + interface Cr { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + interface Cy { /** * Options for the standard registration. @@ -568,6 +781,13 @@ declare module 'stripe' { type Type = 'ioss' | 'oss_non_union' | 'oss_union' | 'standard'; } + interface Ec { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + interface Ee { /** * Options for the standard registration. @@ -697,6 +917,13 @@ declare module 'stripe' { type: 'simplified'; } + interface Gn { + /** + * Type of registration to be created in `country`. + */ + type: 'standard'; + } + interface Gr { /** * Options for the standard registration. @@ -860,6 +1087,13 @@ declare module 'stripe' { type: 'simplified'; } + interface Kh { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + interface Kr { /** * Type of registration to be created in `country`. @@ -955,6 +1189,41 @@ declare module 'stripe' { type Type = 'ioss' | 'oss_non_union' | 'oss_union' | 'standard'; } + interface Ma { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + + interface Md { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + + interface Me { + /** + * Type of registration to be created in `country`. + */ + type: 'standard'; + } + + interface Mk { + /** + * Type of registration to be created in `country`. + */ + type: 'standard'; + } + + interface Mr { + /** + * Type of registration to be created in `country`. + */ + type: 'standard'; + } + interface Mt { /** * Options for the standard registration. @@ -1037,6 +1306,13 @@ declare module 'stripe' { type: 'standard'; } + interface Np { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + interface Nz { /** * Type of registration to be created in `country`. @@ -1051,6 +1327,13 @@ declare module 'stripe' { type: 'standard'; } + interface Pe { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + interface Pl { /** * Options for the standard registration. @@ -1132,6 +1415,20 @@ declare module 'stripe' { type Type = 'ioss' | 'oss_non_union' | 'oss_union' | 'standard'; } + interface Rs { + /** + * Type of registration to be created in `country`. + */ + type: 'standard'; + } + + interface Ru { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + interface Sa { /** * Type of registration to be created in `country`. @@ -1227,6 +1524,20 @@ declare module 'stripe' { type Type = 'ioss' | 'oss_non_union' | 'oss_union' | 'standard'; } + interface Sn { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + + interface Sr { + /** + * Type of registration to be created in `country`. + */ + type: 'standard'; + } + interface Th { /** * Type of registration to be created in `country`. @@ -1234,6 +1545,13 @@ declare module 'stripe' { type: 'simplified'; } + interface Tj { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + interface Tr { /** * Type of registration to be created in `country`. @@ -1241,6 +1559,20 @@ declare module 'stripe' { type: 'simplified'; } + interface Tz { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + + interface Ug { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + interface Us { /** * Options for the local amusement tax registration. @@ -1315,9 +1647,24 @@ declare module 'stripe' { | 'local_amusement_tax' | 'local_lease_tax' | 'state_communications_tax' + | 'state_retail_delivery_fee' | 'state_sales_tax'; } + interface Uy { + /** + * Type of registration to be created in `country`. + */ + type: 'standard'; + } + + interface Uz { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + interface Vn { /** * Type of registration to be created in `country`. @@ -1331,6 +1678,20 @@ declare module 'stripe' { */ type: 'standard'; } + + interface Zm { + /** + * Type of registration to be created in `country`. + */ + type: 'simplified'; + } + + interface Zw { + /** + * Type of registration to be created in `country`. + */ + type: 'standard'; + } } } diff --git a/types/Tax/Settings.d.ts b/types/Tax/Settings.d.ts index e8135e6f03..b21b988351 100644 --- a/types/Tax/Settings.d.ts +++ b/types/Tax/Settings.d.ts @@ -27,7 +27,7 @@ declare module 'stripe' { livemode: boolean; /** - * The `active` status indicates you have all required settings to calculate tax. A status can transition out of `active` when new required settings are introduced. + * The status of the Tax `Settings`. */ status: Settings.Status; diff --git a/types/Tax/Transactions.d.ts b/types/Tax/Transactions.d.ts index d3976e9fad..a398cd079a 100644 --- a/types/Tax/Transactions.d.ts +++ b/types/Tax/Transactions.d.ts @@ -125,7 +125,7 @@ declare module 'stripe' { interface TaxId { /** - * The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `hr_oib`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `no_voec`, `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`, `bh_vat`, `kz_bin`, `ng_tin`, `om_vat`, `de_stn`, `ch_uid`, or `unknown` + * The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `hr_oib`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `no_voec`, `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`, `li_vat`, `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`, `al_tin`, `bh_vat`, `kz_bin`, `ng_tin`, `om_vat`, `de_stn`, `ch_uid`, `tz_vat`, `uz_vat`, `uz_tin`, `md_vat`, `ma_vat`, `by_tin`, `ao_tin`, `bs_tin`, `bb_tin`, `cd_nif`, `mr_nif`, `me_pib`, `zw_tin`, `ba_tin`, `gn_nif`, `mk_vat`, `sr_fin`, `sn_ninea`, `am_tin`, `np_pan`, `tj_tin`, `ug_tin`, `zm_tin`, `kh_tin`, or `unknown` */ type: TaxId.Type; @@ -139,20 +139,28 @@ declare module 'stripe' { type Type = | 'ad_nrt' | 'ae_trn' + | 'al_tin' + | 'am_tin' + | 'ao_tin' | 'ar_cuit' | 'au_abn' | 'au_arn' + | 'ba_tin' + | 'bb_tin' | 'bg_uic' | 'bh_vat' | 'bo_tin' | 'br_cnpj' | 'br_cpf' + | 'bs_tin' + | 'by_tin' | 'ca_bn' | 'ca_gst_hst' | 'ca_pst_bc' | 'ca_pst_mb' | 'ca_pst_sk' | 'ca_qst' + | 'cd_nif' | 'ch_uid' | 'ch_vat' | 'cl_tin' @@ -168,6 +176,7 @@ declare module 'stripe' { | 'eu_vat' | 'gb_vat' | 'ge_vat' + | 'gn_nif' | 'hk_br' | 'hr_oib' | 'hu_tin' @@ -179,9 +188,16 @@ declare module 'stripe' { | 'jp_rn' | 'jp_trn' | 'ke_pin' + | 'kh_tin' | 'kr_brn' | 'kz_bin' | 'li_uid' + | 'li_vat' + | 'ma_vat' + | 'md_vat' + | 'me_pib' + | 'mk_vat' + | 'mr_nif' | 'mx_rfc' | 'my_frp' | 'my_itn' @@ -189,6 +205,7 @@ declare module 'stripe' { | 'ng_tin' | 'no_vat' | 'no_voec' + | 'np_pan' | 'nz_gst' | 'om_vat' | 'pe_ruc' @@ -201,17 +218,26 @@ declare module 'stripe' { | 'sg_gst' | 'sg_uen' | 'si_tin' + | 'sn_ninea' + | 'sr_fin' | 'sv_nit' | 'th_vat' + | 'tj_tin' | 'tr_tin' | 'tw_vat' + | 'tz_vat' | 'ua_vat' + | 'ug_tin' | 'unknown' | 'us_ein' | 'uy_ruc' + | 'uz_tin' + | 'uz_vat' | 've_rif' | 'vn_tin' - | 'za_vat'; + | 'za_vat' + | 'zm_tin' + | 'zw_tin'; } } @@ -364,8 +390,10 @@ declare module 'stripe' { | 'lease_tax' | 'pst' | 'qst' + | 'retail_delivery_fee' | 'rst' | 'sales_tax' + | 'service_tax' | 'vat'; } } diff --git a/types/TaxIds.d.ts b/types/TaxIds.d.ts index 8e40f4e485..221e982fb6 100644 --- a/types/TaxIds.d.ts +++ b/types/TaxIds.d.ts @@ -70,7 +70,7 @@ declare module 'stripe' { owner: TaxId.Owner | null; /** - * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `kz_bin`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat`. Note that some legacy tax IDs have type `unknown` + * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `ba_tin`, `bb_tin`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kh_tin`, `kr_brn`, `kz_bin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin`. Note that some legacy tax IDs have type `unknown` */ type: TaxId.Type; @@ -115,20 +115,28 @@ declare module 'stripe' { type Type = | 'ad_nrt' | 'ae_trn' + | 'al_tin' + | 'am_tin' + | 'ao_tin' | 'ar_cuit' | 'au_abn' | 'au_arn' + | 'ba_tin' + | 'bb_tin' | 'bg_uic' | 'bh_vat' | 'bo_tin' | 'br_cnpj' | 'br_cpf' + | 'bs_tin' + | 'by_tin' | 'ca_bn' | 'ca_gst_hst' | 'ca_pst_bc' | 'ca_pst_mb' | 'ca_pst_sk' | 'ca_qst' + | 'cd_nif' | 'ch_uid' | 'ch_vat' | 'cl_tin' @@ -144,6 +152,7 @@ declare module 'stripe' { | 'eu_vat' | 'gb_vat' | 'ge_vat' + | 'gn_nif' | 'hk_br' | 'hr_oib' | 'hu_tin' @@ -155,9 +164,16 @@ declare module 'stripe' { | 'jp_rn' | 'jp_trn' | 'ke_pin' + | 'kh_tin' | 'kr_brn' | 'kz_bin' | 'li_uid' + | 'li_vat' + | 'ma_vat' + | 'md_vat' + | 'me_pib' + | 'mk_vat' + | 'mr_nif' | 'mx_rfc' | 'my_frp' | 'my_itn' @@ -165,6 +181,7 @@ declare module 'stripe' { | 'ng_tin' | 'no_vat' | 'no_voec' + | 'np_pan' | 'nz_gst' | 'om_vat' | 'pe_ruc' @@ -177,17 +194,26 @@ declare module 'stripe' { | 'sg_gst' | 'sg_uen' | 'si_tin' + | 'sn_ninea' + | 'sr_fin' | 'sv_nit' | 'th_vat' + | 'tj_tin' | 'tr_tin' | 'tw_vat' + | 'tz_vat' | 'ua_vat' + | 'ug_tin' | 'unknown' | 'us_ein' | 'uy_ruc' + | 'uz_tin' + | 'uz_vat' | 've_rif' | 'vn_tin' - | 'za_vat'; + | 'za_vat' + | 'zm_tin' + | 'zw_tin'; interface Verification { /** diff --git a/types/TaxIdsResource.d.ts b/types/TaxIdsResource.d.ts index 2e4dc182d7..169ff5e5fe 100644 --- a/types/TaxIdsResource.d.ts +++ b/types/TaxIdsResource.d.ts @@ -4,7 +4,7 @@ declare module 'stripe' { namespace Stripe { interface TaxIdCreateParams { /** - * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `kz_bin`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat` + * Type of the tax ID, one of `ad_nrt`, `ae_trn`, `al_tin`, `am_tin`, `ao_tin`, `ar_cuit`, `au_abn`, `au_arn`, `ba_tin`, `bb_tin`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `bs_tin`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `cd_nif`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `gn_nif`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kh_tin`, `kr_brn`, `kz_bin`, `li_uid`, `li_vat`, `ma_vat`, `md_vat`, `me_pib`, `mk_vat`, `mr_nif`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `np_pan`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sn_ninea`, `sr_fin`, `sv_nit`, `th_vat`, `tj_tin`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `ug_tin`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, `za_vat`, `zm_tin`, or `zw_tin` */ type: TaxIdCreateParams.Type; @@ -49,20 +49,28 @@ declare module 'stripe' { type Type = | 'ad_nrt' | 'ae_trn' + | 'al_tin' + | 'am_tin' + | 'ao_tin' | 'ar_cuit' | 'au_abn' | 'au_arn' + | 'ba_tin' + | 'bb_tin' | 'bg_uic' | 'bh_vat' | 'bo_tin' | 'br_cnpj' | 'br_cpf' + | 'bs_tin' + | 'by_tin' | 'ca_bn' | 'ca_gst_hst' | 'ca_pst_bc' | 'ca_pst_mb' | 'ca_pst_sk' | 'ca_qst' + | 'cd_nif' | 'ch_uid' | 'ch_vat' | 'cl_tin' @@ -78,6 +86,7 @@ declare module 'stripe' { | 'eu_vat' | 'gb_vat' | 'ge_vat' + | 'gn_nif' | 'hk_br' | 'hr_oib' | 'hu_tin' @@ -89,9 +98,16 @@ declare module 'stripe' { | 'jp_rn' | 'jp_trn' | 'ke_pin' + | 'kh_tin' | 'kr_brn' | 'kz_bin' | 'li_uid' + | 'li_vat' + | 'ma_vat' + | 'md_vat' + | 'me_pib' + | 'mk_vat' + | 'mr_nif' | 'mx_rfc' | 'my_frp' | 'my_itn' @@ -99,6 +115,7 @@ declare module 'stripe' { | 'ng_tin' | 'no_vat' | 'no_voec' + | 'np_pan' | 'nz_gst' | 'om_vat' | 'pe_ruc' @@ -111,16 +128,25 @@ declare module 'stripe' { | 'sg_gst' | 'sg_uen' | 'si_tin' + | 'sn_ninea' + | 'sr_fin' | 'sv_nit' | 'th_vat' + | 'tj_tin' | 'tr_tin' | 'tw_vat' + | 'tz_vat' | 'ua_vat' + | 'ug_tin' | 'us_ein' | 'uy_ruc' + | 'uz_tin' + | 'uz_vat' | 've_rif' | 'vn_tin' - | 'za_vat'; + | 'za_vat' + | 'zm_tin' + | 'zw_tin'; } interface TaxIdRetrieveParams { diff --git a/types/TaxRates.d.ts b/types/TaxRates.d.ts index d720a5b6fe..367a957de6 100644 --- a/types/TaxRates.d.ts +++ b/types/TaxRates.d.ts @@ -50,6 +50,11 @@ declare module 'stripe' { */ effective_percentage: number | null; + /** + * The amount of the tax rate when the `rate_type` is `flat_amount`. Tax rates with `rate_type` `percentage` can vary based on the transaction, resulting in this field being `null`. This field exposes the amount and currency of the flat tax rate. + */ + flat_amount: TaxRate.FlatAmount | null; + /** * This specifies if the tax rate is inclusive or exclusive. */ @@ -80,6 +85,11 @@ declare module 'stripe' { */ percentage: number; + /** + * Indicates the type of tax rate applied to the taxable amount. This value can be `null` when no tax applies to the location. + */ + rate_type: TaxRate.RateType | null; + /** * [ISO 3166-2 subdivision code](https://en.wikipedia.org/wiki/ISO_3166-2:US), without country prefix. For example, "NY" for New York, United States. */ @@ -92,6 +102,18 @@ declare module 'stripe' { } namespace TaxRate { + interface FlatAmount { + /** + * Amount of the tax when the `rate_type` is `flat_amount`. This positive integer represents how much to charge in the smallest currency unit (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). + */ + amount: number; + + /** + * Three-letter ISO currency code, in lowercase. + */ + currency: string; + } + type JurisdictionLevel = | 'city' | 'country' @@ -100,6 +122,8 @@ declare module 'stripe' { | 'multiple' | 'state'; + type RateType = 'flat_amount' | 'percentage'; + type TaxType = | 'amusement_tax' | 'communications_tax' @@ -110,8 +134,10 @@ declare module 'stripe' { | 'lease_tax' | 'pst' | 'qst' + | 'retail_delivery_fee' | 'rst' | 'sales_tax' + | 'service_tax' | 'vat'; } } diff --git a/types/TaxRatesResource.d.ts b/types/TaxRatesResource.d.ts index 80730fa6b8..eb307b6f9b 100644 --- a/types/TaxRatesResource.d.ts +++ b/types/TaxRatesResource.d.ts @@ -70,8 +70,10 @@ declare module 'stripe' { | 'lease_tax' | 'pst' | 'qst' + | 'retail_delivery_fee' | 'rst' | 'sales_tax' + | 'service_tax' | 'vat'; } @@ -140,8 +142,10 @@ declare module 'stripe' { | 'lease_tax' | 'pst' | 'qst' + | 'retail_delivery_fee' | 'rst' | 'sales_tax' + | 'service_tax' | 'vat'; } diff --git a/types/Terminal/Configurations.d.ts b/types/Terminal/Configurations.d.ts index b2e3a0c330..270845a303 100644 --- a/types/Terminal/Configurations.d.ts +++ b/types/Terminal/Configurations.d.ts @@ -107,6 +107,8 @@ declare module 'stripe' { nzd?: Tipping.Nzd; + pln?: Tipping.Pln; + sek?: Tipping.Sek; sgd?: Tipping.Sgd; @@ -302,6 +304,23 @@ declare module 'stripe' { smart_tip_threshold?: number; } + interface Pln { + /** + * Fixed amounts displayed when collecting a tip + */ + fixed_amounts?: Array | null; + + /** + * Percentages displayed when collecting a tip + */ + percentages?: Array | null; + + /** + * Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + */ + smart_tip_threshold?: number; + } + interface Sek { /** * Fixed amounts displayed when collecting a tip diff --git a/types/Terminal/ConfigurationsResource.d.ts b/types/Terminal/ConfigurationsResource.d.ts index 663eeb88d7..c41207e35e 100644 --- a/types/Terminal/ConfigurationsResource.d.ts +++ b/types/Terminal/ConfigurationsResource.d.ts @@ -135,6 +135,11 @@ declare module 'stripe' { */ nzd?: Tipping.Nzd; + /** + * Tipping configuration for PLN + */ + pln?: Tipping.Pln; + /** * Tipping configuration for SEK */ @@ -339,6 +344,23 @@ declare module 'stripe' { smart_tip_threshold?: number; } + interface Pln { + /** + * Fixed amounts displayed when collecting a tip + */ + fixed_amounts?: Array; + + /** + * Percentages displayed when collecting a tip + */ + percentages?: Array; + + /** + * Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + */ + smart_tip_threshold?: number; + } + interface Sek { /** * Fixed amounts displayed when collecting a tip @@ -544,6 +566,11 @@ declare module 'stripe' { */ nzd?: Tipping.Nzd; + /** + * Tipping configuration for PLN + */ + pln?: Tipping.Pln; + /** * Tipping configuration for SEK */ @@ -748,6 +775,23 @@ declare module 'stripe' { smart_tip_threshold?: number; } + interface Pln { + /** + * Fixed amounts displayed when collecting a tip + */ + fixed_amounts?: Array; + + /** + * Percentages displayed when collecting a tip + */ + percentages?: Array; + + /** + * Below this amount, fixed amounts will be displayed; above it, percentages will be displayed + */ + smart_tip_threshold?: number; + } + interface Sek { /** * Fixed amounts displayed when collecting a tip diff --git a/types/Terminal/LocationsResource.d.ts b/types/Terminal/LocationsResource.d.ts index 1c2f44b4e8..ecb1399540 100644 --- a/types/Terminal/LocationsResource.d.ts +++ b/types/Terminal/LocationsResource.d.ts @@ -73,7 +73,7 @@ declare module 'stripe' { interface LocationUpdateParams { /** - * The full address of the location. If you're updating the `address` field, avoid changing the `country`. If you need to modify the `country` field, create a new `Location` object and re-register any existing readers to that location. + * The full address of the location. You can't change the location's `country`. If you need to modify the `country` field, create a new `Location` object and re-register any existing readers to that location. */ address?: Stripe.AddressParam; diff --git a/types/Terminal/ReadersResource.d.ts b/types/Terminal/ReadersResource.d.ts index f419ea13df..d8a4f2738a 100644 --- a/types/Terminal/ReadersResource.d.ts +++ b/types/Terminal/ReadersResource.d.ts @@ -123,6 +123,11 @@ declare module 'stripe' { namespace ReaderProcessPaymentIntentParams { interface ProcessConfig { + /** + * This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. + */ + allow_redisplay?: ProcessConfig.AllowRedisplay; + /** * Enables cancel button on transaction screens. */ @@ -140,6 +145,8 @@ declare module 'stripe' { } namespace ProcessConfig { + type AllowRedisplay = 'always' | 'limited' | 'unspecified'; + interface Tipping { /** * Amount used to calculate tip suggestions on tipping selection screen for this transaction. Must be a positive integer in the smallest currency unit (e.g., 100 cents to represent $1.00 or 100 to represent ¥100, a zero-decimal currency). @@ -151,14 +158,14 @@ declare module 'stripe' { interface ReaderProcessSetupIntentParams { /** - * SetupIntent ID + * This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. */ - setup_intent: string; + allow_redisplay: ReaderProcessSetupIntentParams.AllowRedisplay; /** - * Customer Consent Collected + * SetupIntent ID */ - customer_consent_collected?: boolean; + setup_intent: string; /** * Specifies which fields in the response should be expanded. @@ -172,6 +179,8 @@ declare module 'stripe' { } namespace ReaderProcessSetupIntentParams { + type AllowRedisplay = 'always' | 'limited' | 'unspecified'; + interface ProcessConfig { /** * Enables cancel button on transaction screens. diff --git a/types/TestHelpers/ConfirmationTokensResource.d.ts b/types/TestHelpers/ConfirmationTokensResource.d.ts index b7dadfed78..616b3cd522 100644 --- a/types/TestHelpers/ConfirmationTokensResource.d.ts +++ b/types/TestHelpers/ConfirmationTokensResource.d.ts @@ -64,6 +64,11 @@ declare module 'stripe' { */ allow_redisplay?: PaymentMethodData.AllowRedisplay; + /** + * If this is a Alma PaymentMethod, this hash contains details about the Alma payment method. + */ + alma?: PaymentMethodData.Alma; + /** * If this is a AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method. */ @@ -139,6 +144,11 @@ declare module 'stripe' { */ interac_present?: PaymentMethodData.InteracPresent; + /** + * If this is a `kakao_pay` PaymentMethod, this hash contains details about the Kakao Pay payment method. + */ + kakao_pay?: PaymentMethodData.KakaoPay; + /** * If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method. */ @@ -149,6 +159,11 @@ declare module 'stripe' { */ konbini?: PaymentMethodData.Konbini; + /** + * If this is a `kr_card` PaymentMethod, this hash contains details about the Korean Card payment method. + */ + kr_card?: PaymentMethodData.KrCard; + /** * If this is an `Link` PaymentMethod, this hash contains details about the Link payment method. */ @@ -169,6 +184,11 @@ declare module 'stripe' { */ multibanco?: PaymentMethodData.Multibanco; + /** + * If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method. + */ + naver_pay?: PaymentMethodData.NaverPay; + /** * If this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method. */ @@ -179,6 +199,11 @@ declare module 'stripe' { */ p24?: PaymentMethodData.P24; + /** + * If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method. + */ + payco?: PaymentMethodData.Payco; + /** * If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. */ @@ -209,6 +234,11 @@ declare module 'stripe' { */ revolut_pay?: PaymentMethodData.RevolutPay; + /** + * If this is a `samsung_pay` PaymentMethod, this hash contains details about the SamsungPay payment method. + */ + samsung_pay?: PaymentMethodData.SamsungPay; + /** * If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. */ @@ -276,6 +306,8 @@ declare module 'stripe' { type AllowRedisplay = 'always' | 'limited' | 'unspecified'; + interface Alma {} + interface AmazonPay {} interface AuBecsDebit { @@ -424,7 +456,7 @@ declare module 'stripe' { interface Ideal { /** - * The customer's bank. + * The customer's bank. Only use this parameter for existing customers. Don't use it for new customers. */ bank?: Ideal.Bank; } @@ -451,6 +483,8 @@ declare module 'stripe' { interface InteracPresent {} + interface KakaoPay {} + interface Klarna { /** * Customer's date of birth @@ -479,12 +513,25 @@ declare module 'stripe' { interface Konbini {} + interface KrCard {} + interface Link {} interface Mobilepay {} interface Multibanco {} + interface NaverPay { + /** + * Whether to use Naver Pay points or a card to fund this transaction. If not provided, this defaults to `card`. + */ + funding?: NaverPay.Funding; + } + + namespace NaverPay { + type Funding = 'card' | 'points'; + } + interface Oxxo {} interface P24 { @@ -524,6 +571,8 @@ declare module 'stripe' { | 'volkswagen_bank'; } + interface Payco {} + interface Paynow {} interface Paypal {} @@ -541,6 +590,8 @@ declare module 'stripe' { interface RevolutPay {} + interface SamsungPay {} + interface SepaDebit { /** * IBAN of the bank account. @@ -568,6 +619,7 @@ declare module 'stripe' { | 'affirm' | 'afterpay_clearpay' | 'alipay' + | 'alma' | 'amazon_pay' | 'au_becs_debit' | 'bacs_debit' @@ -581,18 +633,23 @@ declare module 'stripe' { | 'giropay' | 'grabpay' | 'ideal' + | 'kakao_pay' | 'klarna' | 'konbini' + | 'kr_card' | 'link' | 'mobilepay' | 'multibanco' + | 'naver_pay' | 'oxxo' | 'p24' + | 'payco' | 'paynow' | 'paypal' | 'pix' | 'promptpay' | 'revolut_pay' + | 'samsung_pay' | 'sepa_debit' | 'sofort' | 'swish' diff --git a/types/TestHelpers/Issuing/AuthorizationsResource.d.ts b/types/TestHelpers/Issuing/AuthorizationsResource.d.ts index 1734eff878..192ae042cd 100644 --- a/types/TestHelpers/Issuing/AuthorizationsResource.d.ts +++ b/types/TestHelpers/Issuing/AuthorizationsResource.d.ts @@ -6,14 +6,14 @@ declare module 'stripe' { namespace Issuing { interface AuthorizationCreateParams { /** - * The total amount to attempt to authorize. This amount is in the provided currency, or defaults to the card's currency, and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + * Card associated with this authorization. */ - amount: number; + card: string; /** - * Card associated with this authorization. + * The total amount to attempt to authorize. This amount is in the provided currency, or defaults to the card's currency, and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). */ - card: string; + amount?: number; /** * Detailed breakdown of amount components. These amounts are denominated in `currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). @@ -50,6 +50,16 @@ declare module 'stripe' { */ is_amount_controllable?: boolean; + /** + * The total amount to attempt to authorize. This amount is in the provided merchant currency, and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + */ + merchant_amount?: number; + + /** + * The currency of the authorization. If not provided, defaults to the currency of the card. 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). + */ + merchant_currency?: string; + /** * Details about the seller (grocery store, e-commerce website, etc.) where the card authorization happened. */ @@ -1178,6 +1188,20 @@ declare module 'stripe' { } } + namespace Issuing { + interface AuthorizationRespondParams { + /** + * Whether to simulate the user confirming that the transaction was legitimate (true) or telling Stripe that it was fraudulent (false). + */ + confirmed: boolean; + + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + } + namespace Issuing { interface AuthorizationReverseParams { /** @@ -1246,6 +1270,15 @@ declare module 'stripe' { options?: RequestOptions ): Promise>; + /** + * Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy. + */ + respond( + id: string, + params: AuthorizationRespondParams, + options?: RequestOptions + ): Promise>; + /** * Reverse a test-mode Authorization. */ diff --git a/types/TestHelpers/Issuing/CardsResource.d.ts b/types/TestHelpers/Issuing/CardsResource.d.ts index 5fa8f02d6a..7dfde8fc65 100644 --- a/types/TestHelpers/Issuing/CardsResource.d.ts +++ b/types/TestHelpers/Issuing/CardsResource.d.ts @@ -39,6 +39,15 @@ declare module 'stripe' { } } + namespace Issuing { + interface CardSubmitCardParams { + /** + * Specifies which fields in the response should be expanded. + */ + expand?: Array; + } + } + namespace Issuing { class CardsResource { /** @@ -92,6 +101,19 @@ declare module 'stripe' { id: string, options?: RequestOptions ): Promise>; + + /** + * Updates the shipping status of the specified Issuing Card object to submitted. This method requires Stripe Version ‘2024-09-30.acacia' or later. + */ + submitCard( + id: string, + params?: CardSubmitCardParams, + options?: RequestOptions + ): Promise>; + submitCard( + id: string, + options?: RequestOptions + ): Promise>; } } } diff --git a/types/ThinEvent.d.ts b/types/ThinEvent.d.ts new file mode 100644 index 0000000000..269ed2057a --- /dev/null +++ b/types/ThinEvent.d.ts @@ -0,0 +1,36 @@ +// This is a manually maintained file + +declare module 'stripe' { + namespace Stripe { + namespace Event { + /** + * Object containing the reference to API resource relevant to the event. + */ + interface RelatedObject { + /** + * Unique identifier for the object relevant to the event. + */ + id: string; + + /** + * Type of the object relevant to the event. + */ + type: string; + + /** + * URL to retrieve the resource. + */ + url: string; + } + } + /** + * The Event object as recieved from StripeClient.parseThinEvent. + */ + interface ThinEvent extends V2.EventBase { + /** + * Object containing the reference to API resource relevant to the event. + */ + related_object: Event.RelatedObject | null; + } + } +} diff --git a/types/TokensResource.d.ts b/types/TokensResource.d.ts index 94faccca7f..9c50737bcd 100644 --- a/types/TokensResource.d.ts +++ b/types/TokensResource.d.ts @@ -288,7 +288,7 @@ declare module 'stripe' { full_name_aliases?: Stripe.Emptyable>; /** - * The individual's gender (International regulations require either "male" or "female"). + * The individual's gender */ gender?: string; @@ -797,6 +797,11 @@ declare module 'stripe' { } interface Relationship { + /** + * Whether the person is the authorizer of the account's representative. + */ + authorizer?: boolean; + /** * Whether the person is a director of the account's legal entity. Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations. */ @@ -890,7 +895,7 @@ declare module 'stripe' { class TokensResource { /** * Creates a single-use token that represents a bank account's details. - * You can use this token with any API method in place of a bank account dictionary. You can only use this token once. To do so, attach it to a [connected account](https://stripe.com/docs/api#accounts) where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is application, which includes Custom accounts. + * You can use this token with any v1 API method in place of a bank account dictionary. You can only use this token once. To do so, attach it to a [connected account](https://stripe.com/docs/api#accounts) where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is application, which includes Custom accounts. */ create( params?: TokenCreateParams, diff --git a/types/Treasury/FinancialAccountFeatures.d.ts b/types/Treasury/FinancialAccountFeatures.d.ts index 4113f12889..f8b9b53652 100644 --- a/types/Treasury/FinancialAccountFeatures.d.ts +++ b/types/Treasury/FinancialAccountFeatures.d.ts @@ -235,7 +235,7 @@ declare module 'stripe' { interface InboundTransfers { /** - * Toggle settings for enabling/disabling an ACH specific feature + * Toggle settings for enabling/disabling an inbound ACH specific feature */ ach?: InboundTransfers.Ach; } @@ -360,7 +360,7 @@ declare module 'stripe' { interface OutboundPayments { /** - * Toggle settings for enabling/disabling an ACH specific feature + * Toggle settings for enabling/disabling an outbound ACH specific feature */ ach?: OutboundPayments.Ach; @@ -490,7 +490,7 @@ declare module 'stripe' { interface OutboundTransfers { /** - * Toggle settings for enabling/disabling an ACH specific feature + * Toggle settings for enabling/disabling an outbound ACH specific feature */ ach?: OutboundTransfers.Ach; diff --git a/types/Treasury/FinancialAccounts.d.ts b/types/Treasury/FinancialAccounts.d.ts index 08c100409e..ba166a4d08 100644 --- a/types/Treasury/FinancialAccounts.d.ts +++ b/types/Treasury/FinancialAccounts.d.ts @@ -75,7 +75,7 @@ declare module 'stripe' { restricted_features?: Array; /** - * The enum specifying what state the account is in. + * Status of this FinancialAccount. */ status: FinancialAccount.Status; diff --git a/types/Treasury/InboundTransfers.d.ts b/types/Treasury/InboundTransfers.d.ts index 0d6a4701b5..5c031a5064 100644 --- a/types/Treasury/InboundTransfers.d.ts +++ b/types/Treasury/InboundTransfers.d.ts @@ -74,7 +74,7 @@ declare module 'stripe' { /** * The origin payment method to be debited for an InboundTransfer. */ - origin_payment_method: string; + origin_payment_method: string | null; /** * Details about the PaymentMethod for an InboundTransfer. diff --git a/types/Treasury/ReceivedCredits.d.ts b/types/Treasury/ReceivedCredits.d.ts index 3716c3ff5d..f306394452 100644 --- a/types/Treasury/ReceivedCredits.d.ts +++ b/types/Treasury/ReceivedCredits.d.ts @@ -83,7 +83,11 @@ declare module 'stripe' { } namespace ReceivedCredit { - type FailureCode = 'account_closed' | 'account_frozen' | 'other'; + type FailureCode = + | 'account_closed' + | 'account_frozen' + | 'international_transaction' + | 'other'; interface InitiatingPaymentMethodDetails { /** diff --git a/types/UsageRecordSummaries.d.ts b/types/UsageRecordSummaries.d.ts index e5d8223d02..12c046e4fe 100644 --- a/types/UsageRecordSummaries.d.ts +++ b/types/UsageRecordSummaries.d.ts @@ -3,7 +3,7 @@ declare module 'stripe' { namespace Stripe { /** - * The UsageRecordSummary object. + * A usage record summary represents an aggregated view of how much usage was accrued for a subscription item within a subscription billing period. */ interface UsageRecordSummary { /** diff --git a/types/V2/Billing/MeterEventAdjustments.d.ts b/types/V2/Billing/MeterEventAdjustments.d.ts new file mode 100644 index 0000000000..f654b3a706 --- /dev/null +++ b/types/V2/Billing/MeterEventAdjustments.d.ts @@ -0,0 +1,65 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace V2 { + namespace Billing { + /** + * The MeterEventAdjustment object. + */ + interface MeterEventAdjustment { + /** + * The unique id of this meter event adjustment. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value of the object field. + */ + object: 'v2.billing.meter_event_adjustment'; + + /** + * Specifies which event to cancel. + */ + cancel: MeterEventAdjustment.Cancel; + + /** + * The time the adjustment was created. + */ + created: string; + + /** + * The name of the meter event. Corresponds with the `event_name` field on a meter. + */ + event_name: string; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Open Enum. The meter event adjustment's status. + */ + status: MeterEventAdjustment.Status; + + /** + * Open Enum. Specifies whether to cancel a single event or a range of events for a time period. Time period cancellation is not supported yet. + */ + type: 'cancel'; + } + + namespace MeterEventAdjustment { + interface Cancel { + /** + * Unique identifier for the event. You can only cancel events within 24 hours of Stripe receiving them. + */ + identifier: string; + } + + type Status = 'complete' | 'pending'; + } + } + } + } +} diff --git a/types/V2/Billing/MeterEventAdjustmentsResource.d.ts b/types/V2/Billing/MeterEventAdjustmentsResource.d.ts new file mode 100644 index 0000000000..310d13b7a5 --- /dev/null +++ b/types/V2/Billing/MeterEventAdjustmentsResource.d.ts @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace V2 { + namespace Billing { + interface MeterEventAdjustmentCreateParams { + /** + * Specifies which event to cancel. + */ + cancel: MeterEventAdjustmentCreateParams.Cancel; + + /** + * The name of the meter event. Corresponds with the `event_name` field on a meter. + */ + event_name: string; + + /** + * Specifies whether to cancel a single event or a range of events for a time period. Time period cancellation is not supported yet. + */ + type: 'cancel'; + } + + namespace MeterEventAdjustmentCreateParams { + interface Cancel { + /** + * Unique identifier for the event. You can only cancel events within 24 hours of Stripe receiving them. + */ + identifier: string; + } + } + } + + namespace Billing { + class MeterEventAdjustmentsResource { + /** + * Creates a meter event adjustment to cancel a previously sent meter event. + */ + create( + params: MeterEventAdjustmentCreateParams, + options?: RequestOptions + ): Promise>; + } + } + } + } +} diff --git a/types/V2/Billing/MeterEventSessionResource.d.ts b/types/V2/Billing/MeterEventSessionResource.d.ts new file mode 100644 index 0000000000..dadb405d8b --- /dev/null +++ b/types/V2/Billing/MeterEventSessionResource.d.ts @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace V2 { + namespace Billing { + interface MeterEventSessionCreateParams {} + } + + namespace Billing { + class MeterEventSessionResource { + /** + * Creates a meter event session to send usage on the high-throughput meter event stream. Authentication tokens are only valid for 15 minutes, so you will need to create a new meter event session when your token expires. + */ + create( + params?: MeterEventSessionCreateParams, + options?: RequestOptions + ): Promise>; + create( + options?: RequestOptions + ): Promise>; + } + } + } + } +} diff --git a/types/V2/Billing/MeterEventSessions.d.ts b/types/V2/Billing/MeterEventSessions.d.ts new file mode 100644 index 0000000000..28943444d3 --- /dev/null +++ b/types/V2/Billing/MeterEventSessions.d.ts @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace V2 { + namespace Billing { + /** + * The MeterEventSession object. + */ + interface MeterEventSession { + /** + * The unique id of this auth session. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value of the object field. + */ + object: 'v2.billing.meter_event_session'; + + /** + * The authentication token for this session. Use this token when calling the + * high-throughput meter event API. + */ + authentication_token: string; + + /** + * The creation time of this session. + */ + created: string; + + /** + * The time at which this session will expire. + */ + expires_at: string; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + } + } + } + } +} diff --git a/types/V2/Billing/MeterEventStreamResource.d.ts b/types/V2/Billing/MeterEventStreamResource.d.ts new file mode 100644 index 0000000000..fc4e65e3d4 --- /dev/null +++ b/types/V2/Billing/MeterEventStreamResource.d.ts @@ -0,0 +1,62 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace V2 { + namespace Billing { + interface MeterEventStreamCreateParams { + /** + * List of meter events to include in the request. + */ + events: Array; + } + + namespace MeterEventStreamCreateParams { + interface Event { + /** + * The name of the meter event. Corresponds with the `event_name` field on a meter. + */ + event_name: string; + + /** + * A unique identifier for the event. If not provided, one will be generated. + * We recommend using a globally unique identifier for this. We'll enforce + * uniqueness within a rolling 24 hour period. + */ + identifier?: string; + + /** + * The payload of the event. This must contain the fields corresponding to a meter's + * `customer_mapping.event_payload_key` (default is `stripe_customer_id`) and + * `value_settings.event_payload_key` (default is `value`). Read more about + * the + * [payload](https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#payload-key-overrides). + */ + payload: { + [key: string]: string; + }; + + /** + * The time of the event. Must be within the past 35 calendar days or up to + * 5 minutes in the future. Defaults to current timestamp if not specified. + */ + timestamp?: string; + } + } + } + + namespace Billing { + class MeterEventStreamResource { + /** + * Creates meter events. Events are processed asynchronously, including validation. Requires a meter event session for authentication. Supports up to 10,000 requests per second in livemode. For even higher rate-limits, contact sales. + * @throws Stripe.TemporarySessionExpiredError + */ + create( + params: MeterEventStreamCreateParams, + options?: RequestOptions + ): Promise; + } + } + } + } +} diff --git a/types/V2/Billing/MeterEvents.d.ts b/types/V2/Billing/MeterEvents.d.ts new file mode 100644 index 0000000000..0a0949c901 --- /dev/null +++ b/types/V2/Billing/MeterEvents.d.ts @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace V2 { + namespace Billing { + /** + * Fix me empty_doc_string. + */ + interface MeterEvent { + /** + * String representing the object's type. Objects of the same type share the same value of the object field. + */ + object: 'v2.billing.meter_event'; + + /** + * The creation time of this meter event. + */ + created: string; + + /** + * The name of the meter event. Corresponds with the `event_name` field on a meter. + */ + event_name: string; + + /** + * A unique identifier for the event. If not provided, one will be generated. We recommend using a globally unique identifier for this. We'll enforce uniqueness within a rolling 24 hour period. + */ + identifier: string; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * The payload of the event. This must contain the fields corresponding to a meter's + * `customer_mapping.event_payload_key` (default is `stripe_customer_id`) and + * `value_settings.event_payload_key` (default is `value`). Read more about the payload. + */ + payload: { + [key: string]: string; + }; + + /** + * The time of the event. Must be within the past 35 calendar days or up to + * 5 minutes in the future. Defaults to current timestamp if not specified. + */ + timestamp: string; + } + } + } + } +} diff --git a/types/V2/Billing/MeterEventsResource.d.ts b/types/V2/Billing/MeterEventsResource.d.ts new file mode 100644 index 0000000000..00def8d19f --- /dev/null +++ b/types/V2/Billing/MeterEventsResource.d.ts @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace V2 { + namespace Billing { + interface MeterEventCreateParams { + /** + * The name of the meter event. Corresponds with the `event_name` field on a meter. + */ + event_name: string; + + /** + * The payload of the event. This must contain the fields corresponding to a meter's + * `customer_mapping.event_payload_key` (default is `stripe_customer_id`) and + * `value_settings.event_payload_key` (default is `value`). Read more about + * the + * [payload](https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#payload-key-overrides). + */ + payload: { + [key: string]: string; + }; + + /** + * A unique identifier for the event. If not provided, one will be generated. + * We recommend using a globally unique identifier for this. We'll enforce + * uniqueness within a rolling 24 hour period. + */ + identifier?: string; + + /** + * The time of the event. Must be within the past 35 calendar days or up to + * 5 minutes in the future. Defaults to current timestamp if not specified. + */ + timestamp?: string; + } + } + + namespace Billing { + class MeterEventsResource { + /** + * Creates a meter event. Events are validated synchronously, but are processed asynchronously. Supports up to 1,000 events per second in livemode. For higher rate-limits, please use meter event streams instead. + */ + create( + params: MeterEventCreateParams, + options?: RequestOptions + ): Promise>; + } + } + } + } +} diff --git a/types/V2/Core/EventDestinationsResource.d.ts b/types/V2/Core/EventDestinationsResource.d.ts new file mode 100644 index 0000000000..f6c2fe9b7b --- /dev/null +++ b/types/V2/Core/EventDestinationsResource.d.ts @@ -0,0 +1,281 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace V2 { + namespace Core { + interface EventDestinationCreateParams { + /** + * The list of events to enable for this endpoint. + */ + enabled_events: Array; + + /** + * Payload type of events being subscribed to. + */ + event_payload: EventDestinationCreateParams.EventPayload; + + /** + * Event destination name. + */ + name: string; + + /** + * Event destination type. + */ + type: EventDestinationCreateParams.Type; + + /** + * Amazon EventBridge configuration. + */ + amazon_eventbridge?: EventDestinationCreateParams.AmazonEventbridge; + + /** + * An optional description of what the event destination is used for. + */ + description?: string; + + /** + * Where events should be routed from. + */ + events_from?: Array; + + /** + * Additional fields to include in the response. + */ + include?: Array; + + /** + * Metadata. + */ + metadata?: Stripe.MetadataParam; + + /** + * If using the snapshot event payload, the API version events are rendered as. + */ + snapshot_api_version?: string; + + /** + * Webhook endpoint configuration. + */ + webhook_endpoint?: EventDestinationCreateParams.WebhookEndpoint; + } + + namespace EventDestinationCreateParams { + interface AmazonEventbridge { + /** + * The AWS account ID. + */ + aws_account_id: string; + + /** + * The region of the AWS event source. + */ + aws_region: string; + } + + type EventPayload = 'snapshot' | 'thin'; + + type EventsFrom = 'other_accounts' | 'self'; + + type Include = + | 'webhook_endpoint.signing_secret' + | 'webhook_endpoint.url'; + + type Type = 'amazon_eventbridge' | 'webhook_endpoint'; + + interface WebhookEndpoint { + /** + * The URL of the webhook endpoint. + */ + url: string; + } + } + } + + namespace Core { + interface EventDestinationRetrieveParams { + /** + * Additional fields to include in the response. + */ + include?: Array<'webhook_endpoint.url'>; + } + } + + namespace Core { + interface EventDestinationUpdateParams { + /** + * An optional description of what the event destination is used for. + */ + description?: string; + + /** + * The list of events to enable for this endpoint. + */ + enabled_events?: Array; + + /** + * Additional fields to include in the response. Currently supports `webhook_endpoint.url`. + */ + include?: Array<'webhook_endpoint.url'>; + + /** + * Metadata. + */ + metadata?: Stripe.MetadataParam; + + /** + * Event destination name. + */ + name?: string; + + /** + * Webhook endpoint configuration. + */ + webhook_endpoint?: EventDestinationUpdateParams.WebhookEndpoint; + } + + namespace EventDestinationUpdateParams { + interface WebhookEndpoint { + /** + * The URL of the webhook endpoint. + */ + url: string; + } + } + } + + namespace Core { + interface EventDestinationListParams { + /** + * Additional fields to include in the response. Currently supports `webhook_endpoint.url`. + */ + include?: Array<'webhook_endpoint.url'>; + + /** + * The page size. + */ + limit?: number; + + /** + * The requested page. + */ + page?: string; + } + } + + namespace Core { + interface EventDestinationDeleteParams {} + } + + namespace Core { + interface EventDestinationDisableParams {} + } + + namespace Core { + interface EventDestinationEnableParams {} + } + + namespace Core { + interface EventDestinationPingParams {} + } + + namespace Core { + class EventDestinationsResource { + /** + * Create a new event destination. + */ + create( + params: EventDestinationCreateParams, + options?: RequestOptions + ): Promise>; + + /** + * Retrieves the details of an event destination. + */ + retrieve( + id: string, + params?: EventDestinationRetrieveParams, + options?: RequestOptions + ): Promise>; + retrieve( + id: string, + options?: RequestOptions + ): Promise>; + + /** + * Update the details of an event destination. + */ + update( + id: string, + params?: EventDestinationUpdateParams, + options?: RequestOptions + ): Promise>; + + /** + * Lists all event destinations. + */ + list( + params?: EventDestinationListParams, + options?: RequestOptions + ): ApiListPromise; + list( + options?: RequestOptions + ): ApiListPromise; + + /** + * Delete an event destination. + */ + del( + id: string, + params?: EventDestinationDeleteParams, + options?: RequestOptions + ): Promise>; + del( + id: string, + options?: RequestOptions + ): Promise>; + + /** + * Disable an event destination. + */ + disable( + id: string, + params?: EventDestinationDisableParams, + options?: RequestOptions + ): Promise>; + disable( + id: string, + options?: RequestOptions + ): Promise>; + + /** + * Enable an event destination. + */ + enable( + id: string, + params?: EventDestinationEnableParams, + options?: RequestOptions + ): Promise>; + enable( + id: string, + options?: RequestOptions + ): Promise>; + + /** + * Send a `ping` event to an event destination. + */ + ping( + id: string, + params?: EventDestinationPingParams, + options?: RequestOptions + ): Promise>; + ping( + id: string, + options?: RequestOptions + ): Promise>; + } + } + } + } +} diff --git a/types/V2/Core/EventsResource.d.ts b/types/V2/Core/EventsResource.d.ts new file mode 100644 index 0000000000..bb3489e290 --- /dev/null +++ b/types/V2/Core/EventsResource.d.ts @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec + +/// + +declare module 'stripe' { + namespace Stripe { + namespace V2 { + namespace Core { + interface EventRetrieveParams {} + } + + namespace Core { + interface EventListParams { + /** + * Primary object ID used to retrieve related events. + */ + object_id: string; + + /** + * The page size. + */ + limit?: number; + + /** + * The requested page. + */ + page?: string; + } + } + + namespace Core { + class EventsResource { + /** + * Retrieves the details of an event. + */ + retrieve( + id: string, + params?: EventRetrieveParams, + options?: RequestOptions + ): Promise>; + retrieve( + id: string, + options?: RequestOptions + ): Promise>; + + /** + * List events, going back up to 30 days. + */ + list( + params: EventListParams, + options?: RequestOptions + ): ApiListPromise; + } + } + } + } +} diff --git a/types/V2/EventDestinations.d.ts b/types/V2/EventDestinations.d.ts new file mode 100644 index 0000000000..5eb69f715d --- /dev/null +++ b/types/V2/EventDestinations.d.ts @@ -0,0 +1,164 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace V2 { + /** + * The EventDestination object. + */ + interface EventDestination { + /** + * Unique identifier for the object. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value of the object field. + */ + object: 'v2.core.event_destination'; + + /** + * Amazon EventBridge configuration. + */ + amazon_eventbridge: EventDestination.AmazonEventbridge | null; + + /** + * Time at which the object was created. + */ + created: string; + + /** + * An optional description of what the event destination is used for. + */ + description: string; + + /** + * The list of events to enable for this endpoint. + */ + enabled_events: Array; + + /** + * Payload type of events being subscribed to. + */ + event_payload: EventDestination.EventPayload; + + /** + * Where events should be routed from. + */ + events_from: Array | 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; + + /** + * Metadata. + */ + metadata: Stripe.Metadata | null; + + /** + * Event destination name. + */ + name: string; + + /** + * If using the snapshot event payload, the API version events are rendered as. + */ + snapshot_api_version: string | null; + + /** + * Status. It can be set to either enabled or disabled. + */ + status: EventDestination.Status; + + /** + * Additional information about event destination status. + */ + status_details: EventDestination.StatusDetails | null; + + /** + * Event destination type. + */ + type: EventDestination.Type; + + /** + * Time at which the object was last updated. + */ + updated: string; + + /** + * Webhook endpoint configuration. + */ + webhook_endpoint: EventDestination.WebhookEndpoint | null; + } + + namespace EventDestination { + interface AmazonEventbridge { + /** + * The AWS account ID. + */ + aws_account_id: string; + + /** + * The ARN of the AWS event source. + */ + aws_event_source_arn: string; + + /** + * The state of the AWS event source. + */ + aws_event_source_status: AmazonEventbridge.AwsEventSourceStatus; + } + + namespace AmazonEventbridge { + type AwsEventSourceStatus = + | 'active' + | 'deleted' + | 'pending' + | 'unknown'; + } + + type EventPayload = 'snapshot' | 'thin'; + + type EventsFrom = 'other_accounts' | 'self'; + + type Status = 'disabled' | 'enabled'; + + interface StatusDetails { + /** + * Details about why the event destination has been disabled. + */ + disabled: StatusDetails.Disabled | null; + } + + namespace StatusDetails { + interface Disabled { + /** + * Reason event destination has been disabled. + */ + reason: Disabled.Reason; + } + + namespace Disabled { + type Reason = 'no_aws_event_source_exists' | 'user'; + } + } + + type Type = 'amazon_eventbridge' | 'webhook_endpoint'; + + interface WebhookEndpoint { + /** + * The signing secret of the webhook endpoint, only includable on creation. + */ + signing_secret: string | null; + + /** + * The URL of the webhook endpoint, includable. + */ + url: string | null; + } + } + } + } +} diff --git a/types/V2/EventTypes.d.ts b/types/V2/EventTypes.d.ts new file mode 100644 index 0000000000..a5a3110b45 --- /dev/null +++ b/types/V2/EventTypes.d.ts @@ -0,0 +1,216 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe.V2 { + export type Event = + | Stripe.Events.V1BillingMeterErrorReportTriggeredEvent + | Stripe.Events.V1BillingMeterNoMeterFoundEvent; + } + + namespace Stripe.Events { + /** + * This event occurs when there are invalid async usage events for a given meter. + */ + export interface V1BillingMeterErrorReportTriggeredEvent + extends V2.EventBase { + type: 'v1.billing.meter.error_report_triggered'; + // Retrieves data specific to this event. + data: V1BillingMeterErrorReportTriggeredEvent.Data; + // Object containing the reference to API resource relevant to the event. + related_object: Event.RelatedObject; + // Retrieves the object associated with the event. + fetchRelatedObject(): Promise; + } + + namespace V1BillingMeterErrorReportTriggeredEvent { + export interface Data { + /** + * Extra field included in the event's `data` when fetched from /v2/events. + */ + developer_message_summary: string; + + /** + * This contains information about why meter error happens. + */ + reason: Data.Reason; + + /** + * The end of the window that is encapsulated by this summary. + */ + validation_end: string; + + /** + * The start of the window that is encapsulated by this summary. + */ + validation_start: string; + } + + namespace Data { + export interface Reason { + /** + * The total error count within this window. + */ + error_count: number; + + /** + * The error details. + */ + error_types: Array; + } + + namespace Reason { + export interface ErrorType { + /** + * Open Enum. + */ + code: ErrorType.Code; + + /** + * The number of errors of this type. + */ + error_count: number; + + /** + * A list of sample errors of this type. + */ + sample_errors: Array; + } + + namespace ErrorType { + export type Code = + | 'archived_meter' + | 'meter_event_customer_not_found' + | 'meter_event_dimension_count_too_high' + | 'meter_event_invalid_value' + | 'meter_event_no_customer_defined' + | 'missing_dimension_payload_keys' + | 'no_meter' + | 'timestamp_in_future' + | 'timestamp_too_far_in_past'; + + export interface SampleError { + /** + * The error message. + */ + error_message: string; + + /** + * The request causes the error. + */ + request: SampleError.Request; + } + + namespace SampleError { + export interface Request { + /** + * The request idempotency key. + */ + identifier: string; + } + } + } + } + } + } + + /** + * This event occurs when async usage events have missing or invalid meter ids. + */ + export interface V1BillingMeterNoMeterFoundEvent extends V2.EventBase { + type: 'v1.billing.meter.no_meter_found'; + // Retrieves data specific to this event. + data: V1BillingMeterNoMeterFoundEvent.Data; + } + + namespace V1BillingMeterNoMeterFoundEvent { + export interface Data { + /** + * Extra field included in the event's `data` when fetched from /v2/events. + */ + developer_message_summary: string; + + /** + * This contains information about why meter error happens. + */ + reason: Data.Reason; + + /** + * The end of the window that is encapsulated by this summary. + */ + validation_end: string; + + /** + * The start of the window that is encapsulated by this summary. + */ + validation_start: string; + } + + namespace Data { + export interface Reason { + /** + * The total error count within this window. + */ + error_count: number; + + /** + * The error details. + */ + error_types: Array; + } + + namespace Reason { + export interface ErrorType { + /** + * Open Enum. + */ + code: ErrorType.Code; + + /** + * The number of errors of this type. + */ + error_count: number; + + /** + * A list of sample errors of this type. + */ + sample_errors: Array; + } + + namespace ErrorType { + export type Code = + | 'archived_meter' + | 'meter_event_customer_not_found' + | 'meter_event_dimension_count_too_high' + | 'meter_event_invalid_value' + | 'meter_event_no_customer_defined' + | 'missing_dimension_payload_keys' + | 'no_meter' + | 'timestamp_in_future' + | 'timestamp_too_far_in_past'; + + export interface SampleError { + /** + * The error message. + */ + error_message: string; + + /** + * The request causes the error. + */ + request: SampleError.Request; + } + + namespace SampleError { + export interface Request { + /** + * The request idempotency key. + */ + identifier: string; + } + } + } + } + } + } + } +} diff --git a/types/V2/Events.d.ts b/types/V2/Events.d.ts new file mode 100644 index 0000000000..6dac16c035 --- /dev/null +++ b/types/V2/Events.d.ts @@ -0,0 +1,75 @@ +// File generated from our OpenAPI spec + +declare module 'stripe' { + namespace Stripe { + namespace V2 { + namespace Event { + interface Reason { + /** + * Event reason type. + */ + type: 'request'; + + /** + * Information on the API request that instigated the event. + */ + request: Reason.Request | null; + } + + namespace Reason { + interface Request { + /** + * ID of the API request that caused the event. + */ + id: string; + + /** + * The idempotency key transmitted during the request. + */ + idempotency_key: string; + } + } + } + + /** + * The Event object. + */ + interface EventBase { + /** + * Unique identifier for the event. + */ + id: string; + + /** + * String representing the object's type. Objects of the same type share the same value of the object field. + */ + object: 'v2.core.event'; + + /** + * Authentication context needed to fetch the event or related object. + */ + context: string | null; + + /** + * Time at which the object was created. + */ + created: string; + + /** + * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + */ + livemode: boolean; + + /** + * Reason for the event. + */ + reason: Event.Reason | null; + + /** + * The type of the event. + */ + type: string; + } + } + } +} diff --git a/types/WebhookEndpointsResource.d.ts b/types/WebhookEndpointsResource.d.ts index eebd26330d..6deb382e90 100644 --- a/types/WebhookEndpointsResource.d.ts +++ b/types/WebhookEndpointsResource.d.ts @@ -142,7 +142,11 @@ declare module 'stripe' { | '2023-08-16' | '2023-10-16' | '2024-04-10' - | '2024-06-20'; + | '2024-06-20' + | '2024-09-30.acacia' + | '2024-10-28.acacia' + | '2024-11-20.acacia' + | '2024-12-18.acacia'; type EnabledEvent = | '*' @@ -266,6 +270,7 @@ declare module 'stripe' { | 'issuing_token.created' | 'issuing_token.updated' | 'issuing_transaction.created' + | 'issuing_transaction.purchase_details_receipt_updated' | 'issuing_transaction.updated' | 'mandate.updated' | 'payment_intent.amount_capturable_updated' @@ -309,6 +314,7 @@ declare module 'stripe' { | 'radar.early_fraud_warning.created' | 'radar.early_fraud_warning.updated' | 'refund.created' + | 'refund.failed' | 'refund.updated' | 'reporting.report_run.failed' | 'reporting.report_run.succeeded' @@ -547,6 +553,7 @@ declare module 'stripe' { | 'issuing_token.created' | 'issuing_token.updated' | 'issuing_transaction.created' + | 'issuing_transaction.purchase_details_receipt_updated' | 'issuing_transaction.updated' | 'mandate.updated' | 'payment_intent.amount_capturable_updated' @@ -590,6 +597,7 @@ declare module 'stripe' { | 'radar.early_fraud_warning.created' | 'radar.early_fraud_warning.updated' | 'refund.created' + | 'refund.failed' | 'refund.updated' | 'reporting.report_run.failed' | 'reporting.report_run.succeeded' diff --git a/types/index.d.ts b/types/index.d.ts index dea69dcf12..fe2c0df35a 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -8,6 +8,8 @@ /// /// /// +/// +/// // Imports: The beginning of the section generated from our OpenAPI spec /// /// @@ -18,6 +20,9 @@ /// /// /// +/// +/// +/// /// /// /// @@ -124,6 +129,12 @@ /// /// /// +/// +/// +/// +/// +/// +/// /// /// /// @@ -138,6 +149,9 @@ /// /// /// +/// +/// +/// /// /// /// @@ -262,6 +276,11 @@ /// /// /// +/// +/// +/// +/// +/// /// // Imports: The end of the section generated from our OpenAPI spec @@ -339,6 +358,9 @@ declare module 'stripe' { }; billing: { alerts: Stripe.Billing.AlertsResource; + creditBalanceSummary: Stripe.Billing.CreditBalanceSummaryResource; + creditBalanceTransactions: Stripe.Billing.CreditBalanceTransactionsResource; + creditGrants: Stripe.Billing.CreditGrantsResource; meters: Stripe.Billing.MetersResource; meterEvents: Stripe.Billing.MeterEventsResource; meterEventAdjustments: Stripe.Billing.MeterEventAdjustmentsResource; @@ -439,6 +461,18 @@ declare module 'stripe' { transactions: Stripe.Treasury.TransactionsResource; transactionEntries: Stripe.Treasury.TransactionEntriesResource; }; + v2: { + billing: { + meterEventSession: Stripe.V2.Billing.MeterEventSessionResource; + meterEventAdjustments: Stripe.V2.Billing.MeterEventAdjustmentsResource; + meterEventStream: Stripe.V2.Billing.MeterEventStreamResource; + meterEvents: Stripe.V2.Billing.MeterEventsResource; + }; + core: { + eventDestinations: Stripe.V2.Core.EventDestinationsResource; + events: Stripe.V2.Core.EventsResource; + }; + }; // Fields: The end of the section generated from our OpenAPI spec webhooks: Stripe.Webhooks; oauth: Stripe.OAuthResource; @@ -459,6 +493,68 @@ declare module 'stripe' { event: 'response', handler: (event: Stripe.ResponseEvent) => void ): void; + + /** + * Allows for sending "raw" requests to the Stripe API, which can be used for + * testing new API endpoints or performing requests that the library does + * not support yet. + * + * This is an experimental interface and is not yet stable. + * + * @param method - HTTP request method, 'GET', 'POST', or 'DELETE' + * @param path - The path of the request, e.g. '/v1/beta_endpoint' + * @param params - The parameters to include in the request body. + * @param options - Additional request options. + */ + rawRequest( + method: string, + path: string, + params?: {[key: string]: unknown}, + options?: Stripe.RawRequestOptions + ): Promise>; + + /** + * Parses webhook event payload into a ThinEvent and verifies webhook signature. + * To get more information on the event, pass the id from the returned object to + * `stripe.v2.core.events.retrieve()` + * + * @throws Stripe.errors.StripeSignatureVerificationError + */ + parseThinEvent: ( + /** + * Raw text body payload received from Stripe. + */ + payload: string | Buffer, + /** + * Value of the `stripe-signature` header from Stripe. + * Typically a string. + * + * Note that this is typed to accept an array of strings + * so that it works seamlessly with express's types, + * but will throw if an array is passed in practice + * since express should never return this header as an array, + * only a string. + */ + header: string | Buffer | Array, + /** + * Your Webhook Signing Secret for this endpoint (e.g., 'whsec_...'). + * You can get this [in your dashboard](https://dashboard.stripe.com/webhooks). + */ + secret: string, + /** + * Seconds of tolerance on timestamps. + */ + tolerance?: number, + /** + * Optional CryptoProvider to use for computing HMAC signatures. + */ + cryptoProvider?: Stripe.CryptoProvider, + + /** + * Optional: timestamp to use when checking signature validity. Defaults to Date.now(). + */ + receivedAt?: number + ) => Stripe.ThinEvent; } export default Stripe; diff --git a/types/lib.d.ts b/types/lib.d.ts index d82037bbf7..35068219bd 100644 --- a/types/lib.d.ts +++ b/types/lib.d.ts @@ -27,7 +27,7 @@ declare module 'stripe' { }): (...args: any[]) => Response; //eslint-disable-line @typescript-eslint/no-explicit-any static MAX_BUFFERED_REQUEST_METRICS: number; } - export type LatestApiVersion = '2024-06-20'; + export type LatestApiVersion = '2024-12-18.acacia'; export type HttpAgent = Agent; export type HttpProtocol = 'http' | 'https'; @@ -153,6 +153,13 @@ declare module 'stripe' { host?: string; } + export type RawRequestOptions = RequestOptions & { + /** + * Specify additional request headers. This is an experimental interface and is not yet stable. + */ + additionalHeaders?: {[headerName: string]: string}; + }; + export type Response = T & { lastResponse: { headers: {[key: string]: string}; diff --git a/types/test/typescriptTest.ts b/types/test/typescriptTest.ts index 09a0c3e58f..2cb3ecb10b 100644 --- a/types/test/typescriptTest.ts +++ b/types/test/typescriptTest.ts @@ -9,7 +9,7 @@ import Stripe from 'stripe'; let stripe = new Stripe('sk_test_123', { - apiVersion: '2024-06-20', + apiVersion: '2024-12-18.acacia', }); stripe = new Stripe('sk_test_123'); @@ -26,7 +26,7 @@ stripe = new Stripe('sk_test_123', { // Check config object. stripe = new Stripe('sk_test_123', { - apiVersion: '2024-06-20', + apiVersion: '2024-12-18.acacia', typescript: true, maxNetworkRetries: 1, timeout: 1000, @@ -44,7 +44,7 @@ stripe = new Stripe('sk_test_123', { description: 'test', }; const opts: Stripe.RequestOptions = { - apiVersion: '2024-06-20', + apiVersion: '2024-12-18.acacia', }; const customer: Stripe.Customer = await stripe.customers.create(params, opts);