stripe 22.2.0-alpha.3 → 22.2.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/OPENAPI_VERSION +1 -1
  3. package/README.md +0 -1
  4. package/VERSION +1 -1
  5. package/cjs/StripeEventNotificationHandler.d.ts +21 -0
  6. package/cjs/StripeEventNotificationHandler.js +466 -0
  7. package/cjs/StripeEventNotificationHandler.js.map +1 -0
  8. package/cjs/resources/Accounts.d.ts +40 -0
  9. package/cjs/resources/Apps/index.d.ts +4 -4
  10. package/cjs/resources/Billing/Analytics/index.d.ts +1 -1
  11. package/cjs/resources/Billing/index.d.ts +24 -24
  12. package/cjs/resources/BillingPortal/index.d.ts +5 -5
  13. package/cjs/resources/Capabilities.d.ts +23 -0
  14. package/cjs/resources/Capital/index.d.ts +6 -6
  15. package/cjs/resources/Checkout/index.d.ts +7 -7
  16. package/cjs/resources/Climate/index.d.ts +9 -9
  17. package/cjs/resources/ConfirmationTokens.d.ts +31 -1
  18. package/cjs/resources/Customers.d.ts +1 -1
  19. package/cjs/resources/DelegatedCheckout/RequestedSessions.d.ts +125 -0
  20. package/cjs/resources/DelegatedCheckout/index.d.ts +5 -5
  21. package/cjs/resources/Entitlements/index.d.ts +6 -6
  22. package/cjs/resources/Files.d.ts +2 -0
  23. package/cjs/resources/Files.js +5 -0
  24. package/cjs/resources/Files.js.map +1 -1
  25. package/cjs/resources/FinancialConnections/index.d.ts +15 -15
  26. package/cjs/resources/Forwarding/index.d.ts +3 -3
  27. package/cjs/resources/Identity/index.d.ts +12 -12
  28. package/cjs/resources/InvoiceItems.d.ts +25 -0
  29. package/cjs/resources/Invoices.d.ts +0 -3
  30. package/cjs/resources/Issuing/Disputes.d.ts +50 -0
  31. package/cjs/resources/Issuing/index.d.ts +44 -44
  32. package/cjs/resources/OAuth.d.ts +7 -8
  33. package/cjs/resources/Orchestration/index.d.ts +1 -1
  34. package/cjs/resources/PaymentAttemptRecords.d.ts +4 -0
  35. package/cjs/resources/PaymentIntents.d.ts +49 -7
  36. package/cjs/resources/PaymentLocations.d.ts +178 -0
  37. package/cjs/resources/PaymentLocations.js +41 -0
  38. package/cjs/resources/PaymentLocations.js.map +1 -0
  39. package/cjs/resources/PaymentMethods.d.ts +43 -3
  40. package/cjs/resources/PaymentRecords.d.ts +12 -0
  41. package/cjs/resources/Privacy/index.d.ts +8 -8
  42. package/cjs/resources/ProductCatalog/index.d.ts +1 -1
  43. package/cjs/resources/QuotePreviewInvoices.d.ts +0 -1
  44. package/cjs/resources/Radar/CustomerEvaluations.d.ts +20 -7
  45. package/cjs/resources/Radar/CustomerEvaluations.js.map +1 -1
  46. package/cjs/resources/Radar/index.d.ts +18 -18
  47. package/cjs/resources/Reporting/index.d.ts +5 -5
  48. package/cjs/resources/Reserve/index.d.ts +5 -5
  49. package/cjs/resources/SetupIntents.d.ts +48 -6
  50. package/cjs/resources/SharedPayment/GrantedTokens.d.ts +31 -1
  51. package/cjs/resources/SharedPayment/index.d.ts +4 -4
  52. package/cjs/resources/Sigma/index.d.ts +2 -2
  53. package/cjs/resources/Subscriptions.d.ts +43 -4
  54. package/cjs/resources/Subscriptions.js.map +1 -1
  55. package/cjs/resources/Tax/index.d.ts +20 -20
  56. package/cjs/resources/Terminal/index.d.ts +26 -26
  57. package/cjs/resources/TestHelpers/ConfirmationTokens.d.ts +11 -1
  58. package/cjs/resources/TestHelpers/Issuing/Disputes.d.ts +57 -0
  59. package/cjs/resources/TestHelpers/Issuing/Disputes.js +21 -0
  60. package/cjs/resources/TestHelpers/Issuing/Disputes.js.map +1 -0
  61. package/cjs/resources/TestHelpers/Issuing/index.d.ts +2 -0
  62. package/cjs/resources/TestHelpers/Issuing/index.js +2 -0
  63. package/cjs/resources/TestHelpers/Issuing/index.js.map +1 -1
  64. package/cjs/resources/TestHelpers/index.d.ts +5 -5
  65. package/cjs/resources/Treasury/index.d.ts +33 -33
  66. package/cjs/resources/V2/Billing/index.d.ts +68 -68
  67. package/cjs/resources/V2/Core/Events.d.ts +75 -3
  68. package/cjs/resources/V2/Core/FeeBatches.d.ts +172 -0
  69. package/cjs/resources/V2/Core/FeeBatches.js +23 -0
  70. package/cjs/resources/V2/Core/FeeBatches.js.map +1 -0
  71. package/cjs/resources/V2/Core/FeeEntries.d.ts +178 -0
  72. package/cjs/resources/V2/Core/FeeEntries.js +23 -0
  73. package/cjs/resources/V2/Core/FeeEntries.js.map +1 -0
  74. package/cjs/resources/V2/Core/Vault/index.d.ts +13 -13
  75. package/cjs/resources/V2/Core/index.d.ts +44 -32
  76. package/cjs/resources/V2/Core/index.js +4 -0
  77. package/cjs/resources/V2/Core/index.js.map +1 -1
  78. package/cjs/resources/V2/Data/Reporting/index.d.ts +2 -2
  79. package/cjs/resources/V2/Extend/index.d.ts +5 -5
  80. package/cjs/resources/V2/Iam/index.d.ts +7 -7
  81. package/cjs/resources/V2/MoneyManagement/DebitDisputes.d.ts +171 -0
  82. package/cjs/resources/V2/MoneyManagement/DebitDisputes.js +29 -0
  83. package/cjs/resources/V2/MoneyManagement/DebitDisputes.js.map +1 -0
  84. package/cjs/resources/V2/MoneyManagement/FinancialAccountStatements.d.ts +103 -0
  85. package/cjs/resources/V2/MoneyManagement/FinancialAccountStatements.js +4 -0
  86. package/cjs/resources/V2/MoneyManagement/FinancialAccountStatements.js.map +1 -0
  87. package/cjs/resources/V2/MoneyManagement/FinancialAccounts/Statements.d.ts +44 -0
  88. package/cjs/resources/V2/MoneyManagement/FinancialAccounts/Statements.js +53 -0
  89. package/cjs/resources/V2/MoneyManagement/FinancialAccounts/Statements.js.map +1 -0
  90. package/cjs/resources/V2/MoneyManagement/FinancialAccounts.d.ts +5 -0
  91. package/cjs/resources/V2/MoneyManagement/FinancialAccounts.js +6 -0
  92. package/cjs/resources/V2/MoneyManagement/FinancialAccounts.js.map +1 -1
  93. package/cjs/resources/V2/MoneyManagement/OutboundSetupIntents.d.ts +1 -0
  94. package/cjs/resources/V2/MoneyManagement/ReceivedDebits.d.ts +14 -0
  95. package/cjs/resources/V2/MoneyManagement/TransactionEntries.d.ts +6 -2
  96. package/cjs/resources/V2/MoneyManagement/Transactions.d.ts +6 -2
  97. package/cjs/resources/V2/MoneyManagement/index.d.ts +71 -61
  98. package/cjs/resources/V2/MoneyManagement/index.js +2 -0
  99. package/cjs/resources/V2/MoneyManagement/index.js.map +1 -1
  100. package/cjs/resources/V2/Network/index.d.ts +2 -2
  101. package/cjs/resources/V2/OrchestratedCommerce/index.d.ts +5 -5
  102. package/cjs/resources/V2/Payments/index.d.ts +13 -13
  103. package/cjs/resources/V2/Reporting/index.d.ts +3 -3
  104. package/cjs/resources/V2/Tax/index.d.ts +5 -5
  105. package/cjs/resources.d.ts +1 -0
  106. package/cjs/resources.js +14 -4
  107. package/cjs/resources.js.map +1 -1
  108. package/cjs/stripe.core.d.ts +9 -0
  109. package/cjs/stripe.core.js +7 -1
  110. package/cjs/stripe.core.js.map +1 -1
  111. package/esm/StripeEventNotificationHandler.d.ts +21 -0
  112. package/esm/StripeEventNotificationHandler.js +462 -0
  113. package/esm/StripeEventNotificationHandler.js.map +1 -0
  114. package/esm/resources/Accounts.d.ts +40 -0
  115. package/esm/resources/Apps/index.d.ts +4 -4
  116. package/esm/resources/Billing/Analytics/index.d.ts +1 -1
  117. package/esm/resources/Billing/index.d.ts +24 -24
  118. package/esm/resources/BillingPortal/index.d.ts +5 -5
  119. package/esm/resources/Capabilities.d.ts +23 -0
  120. package/esm/resources/Capital/index.d.ts +6 -6
  121. package/esm/resources/Checkout/index.d.ts +7 -7
  122. package/esm/resources/Climate/index.d.ts +9 -9
  123. package/esm/resources/ConfirmationTokens.d.ts +31 -1
  124. package/esm/resources/Customers.d.ts +1 -1
  125. package/esm/resources/DelegatedCheckout/RequestedSessions.d.ts +125 -0
  126. package/esm/resources/DelegatedCheckout/index.d.ts +5 -5
  127. package/esm/resources/Entitlements/index.d.ts +6 -6
  128. package/esm/resources/Files.d.ts +2 -0
  129. package/esm/resources/Files.js +5 -0
  130. package/esm/resources/Files.js.map +1 -1
  131. package/esm/resources/FinancialConnections/index.d.ts +15 -15
  132. package/esm/resources/Forwarding/index.d.ts +3 -3
  133. package/esm/resources/Identity/index.d.ts +12 -12
  134. package/esm/resources/InvoiceItems.d.ts +25 -0
  135. package/esm/resources/Invoices.d.ts +0 -3
  136. package/esm/resources/Issuing/Disputes.d.ts +50 -0
  137. package/esm/resources/Issuing/index.d.ts +44 -44
  138. package/esm/resources/OAuth.d.ts +7 -8
  139. package/esm/resources/Orchestration/index.d.ts +1 -1
  140. package/esm/resources/PaymentAttemptRecords.d.ts +4 -0
  141. package/esm/resources/PaymentIntents.d.ts +49 -7
  142. package/esm/resources/PaymentLocations.d.ts +178 -0
  143. package/esm/resources/PaymentLocations.js +37 -0
  144. package/esm/resources/PaymentLocations.js.map +1 -0
  145. package/esm/resources/PaymentMethods.d.ts +43 -3
  146. package/esm/resources/PaymentRecords.d.ts +12 -0
  147. package/esm/resources/Privacy/index.d.ts +8 -8
  148. package/esm/resources/ProductCatalog/index.d.ts +1 -1
  149. package/esm/resources/QuotePreviewInvoices.d.ts +0 -1
  150. package/esm/resources/Radar/CustomerEvaluations.d.ts +20 -7
  151. package/esm/resources/Radar/CustomerEvaluations.js.map +1 -1
  152. package/esm/resources/Radar/index.d.ts +18 -18
  153. package/esm/resources/Reporting/index.d.ts +5 -5
  154. package/esm/resources/Reserve/index.d.ts +5 -5
  155. package/esm/resources/SetupIntents.d.ts +48 -6
  156. package/esm/resources/SharedPayment/GrantedTokens.d.ts +31 -1
  157. package/esm/resources/SharedPayment/index.d.ts +4 -4
  158. package/esm/resources/Sigma/index.d.ts +2 -2
  159. package/esm/resources/Subscriptions.d.ts +43 -4
  160. package/esm/resources/Subscriptions.js.map +1 -1
  161. package/esm/resources/Tax/index.d.ts +20 -20
  162. package/esm/resources/Terminal/index.d.ts +26 -26
  163. package/esm/resources/TestHelpers/ConfirmationTokens.d.ts +11 -1
  164. package/esm/resources/TestHelpers/Issuing/Disputes.d.ts +57 -0
  165. package/esm/resources/TestHelpers/Issuing/Disputes.js +17 -0
  166. package/esm/resources/TestHelpers/Issuing/Disputes.js.map +1 -0
  167. package/esm/resources/TestHelpers/Issuing/index.d.ts +2 -0
  168. package/esm/resources/TestHelpers/Issuing/index.js +2 -0
  169. package/esm/resources/TestHelpers/Issuing/index.js.map +1 -1
  170. package/esm/resources/TestHelpers/index.d.ts +5 -5
  171. package/esm/resources/Treasury/index.d.ts +33 -33
  172. package/esm/resources/V2/Billing/index.d.ts +68 -68
  173. package/esm/resources/V2/Core/Events.d.ts +75 -3
  174. package/esm/resources/V2/Core/FeeBatches.d.ts +172 -0
  175. package/esm/resources/V2/Core/FeeBatches.js +19 -0
  176. package/esm/resources/V2/Core/FeeBatches.js.map +1 -0
  177. package/esm/resources/V2/Core/FeeEntries.d.ts +178 -0
  178. package/esm/resources/V2/Core/FeeEntries.js +19 -0
  179. package/esm/resources/V2/Core/FeeEntries.js.map +1 -0
  180. package/esm/resources/V2/Core/Vault/index.d.ts +13 -13
  181. package/esm/resources/V2/Core/index.d.ts +44 -32
  182. package/esm/resources/V2/Core/index.js +4 -0
  183. package/esm/resources/V2/Core/index.js.map +1 -1
  184. package/esm/resources/V2/Data/Reporting/index.d.ts +2 -2
  185. package/esm/resources/V2/Extend/index.d.ts +5 -5
  186. package/esm/resources/V2/Iam/index.d.ts +7 -7
  187. package/esm/resources/V2/MoneyManagement/DebitDisputes.d.ts +171 -0
  188. package/esm/resources/V2/MoneyManagement/DebitDisputes.js +25 -0
  189. package/esm/resources/V2/MoneyManagement/DebitDisputes.js.map +1 -0
  190. package/esm/resources/V2/MoneyManagement/FinancialAccountStatements.d.ts +103 -0
  191. package/esm/resources/V2/MoneyManagement/FinancialAccountStatements.js +3 -0
  192. package/esm/resources/V2/MoneyManagement/FinancialAccountStatements.js.map +1 -0
  193. package/esm/resources/V2/MoneyManagement/FinancialAccounts/Statements.d.ts +44 -0
  194. package/esm/resources/V2/MoneyManagement/FinancialAccounts/Statements.js +49 -0
  195. package/esm/resources/V2/MoneyManagement/FinancialAccounts/Statements.js.map +1 -0
  196. package/esm/resources/V2/MoneyManagement/FinancialAccounts.d.ts +5 -0
  197. package/esm/resources/V2/MoneyManagement/FinancialAccounts.js +6 -0
  198. package/esm/resources/V2/MoneyManagement/FinancialAccounts.js.map +1 -1
  199. package/esm/resources/V2/MoneyManagement/OutboundSetupIntents.d.ts +1 -0
  200. package/esm/resources/V2/MoneyManagement/ReceivedDebits.d.ts +14 -0
  201. package/esm/resources/V2/MoneyManagement/TransactionEntries.d.ts +6 -2
  202. package/esm/resources/V2/MoneyManagement/Transactions.d.ts +6 -2
  203. package/esm/resources/V2/MoneyManagement/index.d.ts +71 -61
  204. package/esm/resources/V2/MoneyManagement/index.js +2 -0
  205. package/esm/resources/V2/MoneyManagement/index.js.map +1 -1
  206. package/esm/resources/V2/Network/index.d.ts +2 -2
  207. package/esm/resources/V2/OrchestratedCommerce/index.d.ts +5 -5
  208. package/esm/resources/V2/Payments/index.d.ts +13 -13
  209. package/esm/resources/V2/Reporting/index.d.ts +3 -3
  210. package/esm/resources/V2/Tax/index.d.ts +5 -5
  211. package/esm/resources.d.ts +1 -0
  212. package/esm/resources.js +9 -0
  213. package/esm/resources.js.map +1 -1
  214. package/esm/stripe.core.d.ts +9 -0
  215. package/esm/stripe.core.js +7 -1
  216. package/esm/stripe.core.js.map +1 -1
  217. package/esm/stripe.esm.node.d.ts +9 -0
  218. package/esm/stripe.esm.node.js +7 -1
  219. package/esm/stripe.esm.node.js.map +1 -1
  220. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # Changelog
2
2
 
3
+ ## 22.2.0-alpha.5 - 2026-05-13
4
+ * [#2708](https://github.com/stripe/stripe-node/pull/2708) Update generated code for private-preview
5
+ * Add support for new resources `V2.Core.FeeBatch`, `V2.Core.FeeEntry`, `V2.MoneyManagement.DebitDispute`, and `V2.MoneyManagement.FinancialAccountStatement`
6
+ * Add support for `simulate_network_lifecycle_pre_arbitration_response` and `simulate_network_lifecycle_pre_arbitration_submission` test helper methods on resource `Issuing.Dispute`
7
+ * Add support for `list` method on resource `PaymentLocation`
8
+ * Add support for `list` and `retrieve` methods on resources `V2.Core.FeeBatch`, `V2.Core.FeeEntry`, and `V2.MoneyManagement.FinancialAccountStatement`
9
+ * Add support for `create`, `list`, and `retrieve` methods on resource `V2.MoneyManagement.DebitDispute`
10
+ * Add support for `discounts` on `DelegatedCheckout.RequestedSessionCreateParams`, `DelegatedCheckout.RequestedSessionUpdateParams`, and `DelegatedCheckout.RequestedSession`
11
+ * Add support for `amount_sale` on `DelegatedCheckout.RequestedSession.line_item_details[]` and `DelegatedCheckout.RequestedSession.total_details`
12
+ * Add support for `amount_discount` and `breakdown` on `DelegatedCheckout.RequestedSession.total_details`
13
+ * ⚠️ Remove support for `check_deposit_address` on `Invoice.payment_settings.payment_method_options.check_scan`, `InvoiceCreateParams.payment_settings.payment_method_options.check_scan`, `InvoiceUpdateParams.payment_settings.payment_method_options.check_scan`, `QuotePreviewInvoice.payment_settings.payment_method_options.check_scan`, `Subscription.payment_settings.payment_method_options.check_scan`, `SubscriptionCreateParams.payment_settings.payment_method_options.check_scan`, and `SubscriptionUpdateParams.payment_settings.payment_method_options.check_scan`
14
+ * Add support for `payment_evaluations` on `PaymentAttemptRecordReportGuaranteedParams`, `PaymentRecordReportPaymentAttemptGuaranteedParams`, `PaymentRecordReportPaymentAttemptParams.guaranteed`, and `PaymentRecordReportPaymentParams.guaranteed`
15
+ * Add support for `location` on `PaymentIntentConfirmParams.payment_details`, `PaymentIntentCreateParams.payment_details`, `PaymentIntentUpdateParams.payment_details`, `SetupIntentConfirmParams.setup_details`, `SetupIntentCreateParams.setup_details`, and `SetupIntentUpdateParams.setup_details`
16
+ * Add support for `onboarding_data_update_acknowledged` on `PaymentLocationUpdateParams`
17
+ * Change `PaymentLocationCreateParams.address.country` and `PaymentLocationUpdateParams.address.country` to be optional
18
+ * Add support for `customer` on `Radar.CustomerEvaluationUpdateParams`
19
+ * Add support for `status` on `Radar.CustomerEvaluationUpdateParams` and `Radar.CustomerEvaluation`
20
+ * Change `Radar.CustomerEvaluationUpdateParams.type` to be optional
21
+ * Add support for `payment_behavior` on `SubscriptionResumeParams`
22
+ * Add support for `dispute_details` on `V2.MoneyManagement.ReceivedDebit`
23
+ * ⚠️ Add support for new value `debit_dispute` on enums `V2.MoneyManagement.Transaction.category` and `V2.MoneyManagement.TransactionEntry.transaction_details.category`
24
+ * Add support for `debit_dispute` on `V2.MoneyManagement.Transaction.flow` and `V2.MoneyManagement.TransactionEntry.transaction_details.flow`
25
+ * ⚠️ Add support for new value `debit_dispute` on enums `V2.MoneyManagement.Transaction.flow.type` and `V2.MoneyManagement.TransactionEntry.transaction_details.flow.type`
26
+ * Add support for `payment_attempt_record` on `EventsV2PaymentsOffSessionPaymentAttemptFailedEvent` and `EventsV2PaymentsOffSessionPaymentFailedEvent`
27
+ * Add support for event notifications `V2MoneyManagementFinancialAccountStatementCreatedEvent` and `V2MoneyManagementFinancialAccountStatementRestatedEvent` with related object `V2.MoneyManagement.FinancialAccountStatement`
28
+
29
+ ## 22.2.0-alpha.4 - 2026-05-06
30
+ * [#2699](https://github.com/stripe/stripe-node/pull/2699) Update generated code for private-preview
31
+ * Add support for new resource `PaymentLocation`
32
+ * Add support for `create`, `del`, `retrieve`, and `update` methods on resource `PaymentLocation`
33
+ * Add support for `protections` on `AccountCreateParams.capabilities.card_payments`, `AccountUpdateParams.capabilities.card_payments`, and `Capability`
34
+ * Add support for `gift_card` on `ConfirmationToken.payment_method_preview`, `ConfirmationTokenCreateParams.testHelpers.payment_method_data`, `PaymentIntentConfirmParams.payment_method_data`, `PaymentIntentCreateParams.payment_method_data`, `PaymentIntentUpdateParams.payment_method_data`, `PaymentMethodCreateParams`, `PaymentMethod`, `SetupIntentConfirmParams.payment_method_data`, `SetupIntentCreateParams.payment_method_data`, `SetupIntentUpdateParams.payment_method_data`, and `SharedPayment.GrantedToken.payment_method_details`
35
+ * Add support for new value `gift_card` 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`
36
+ * ⚠️ Add support for new value `gift_card` on enums `ConfirmationToken.payment_method_preview.type`, `PaymentMethod.type`, and `SharedPayment.GrantedToken.payment_method_details.type`
37
+ * Add support for new value `gift_card` on enums `CustomerListPaymentMethodsParams.type`, `PaymentMethodCreateParams.type`, and `PaymentMethodListParams.type`
38
+ * Add support for `metadata` on `DelegatedCheckout.RequestedSessionConfirmParams`
39
+ * Add support for `credited_items` on `InvoiceItem.proration_details`
40
+ * Add support for `network_lifecycle` on `Issuing.Dispute`
41
+ * Add support for new value `gift_card` on enums `PaymentIntentConfirmParams.excluded_payment_method_types`, `PaymentIntentCreateParams.excluded_payment_method_types`, `PaymentIntentUpdateParams.excluded_payment_method_types`, `SetupIntentCreateParams.excluded_payment_method_types`, and `SetupIntentUpdateParams.excluded_payment_method_types`
42
+ * ⚠️ Add support for new value `gift_card` on enums `PaymentIntent.excluded_payment_method_types` and `SetupIntent.excluded_payment_method_types`
43
+ * Add support for `status_details` on `Subscription`
44
+ * [#2702](https://github.com/stripe/stripe-node/pull/2702) Add EventNotificationHandler (private preview)
45
+
3
46
  ## 22.2.0-alpha.3 - 2026-04-28
4
47
  * [#2696](https://github.com/stripe/stripe-node/pull/2696) Update generated code for private-preview
5
48
  * Add support for `debit_card` on `V2.Core.Account.configuration.card_creator.capabilities.consumer.lead`, `V2.Core.Account.identity.attestations.terms_of_service.card_creator.consumer.lead`, `V2.Core.AccountCreateParams.configuration.card_creator.capabilities.consumer.lead`, `V2.Core.AccountCreateParams.identity.attestations.terms_of_service.card_creator.consumer.lead`, `V2.Core.AccountUpdateParams.configuration.card_creator.capabilities.consumer.lead`, and `V2.Core.AccountUpdateParams.identity.attestations.terms_of_service.card_creator.consumer.lead`
@@ -217,6 +260,14 @@ This release changes the pinned API version to 2026-04-22.private.
217
260
  * Add support for error type `FxQuoteExpiredError`
218
261
  * Add support for error codes `invalid_workflow_input_parameters` and `workflow_not_invokable` on `CannotProceedError`
219
262
 
263
+ ## 22.1.1 - 2026-05-06
264
+ * [#2703](https://github.com/stripe/stripe-node/pull/2703) Export Decimal type from Stripe namespace
265
+
266
+ - Added `Stripe.Decimal` as a usable type in the `Stripe` namespace, enabling type annotations like `function takesDecimal(d: Stripe.Decimal)`.
267
+ * [#2704](https://github.com/stripe/stripe-node/pull/2704) Fix file upload regression: restore multipart request data processor
268
+
269
+ - Fixed file uploads failing with `StripeInvalidRequestError` on the `/v1/files` endpoint since v22.
270
+
220
271
  ## 22.1.0 - 2026-04-23
221
272
  This release changes the pinned API version to 2026-04-22.dahlia.
222
273
 
package/OPENAPI_VERSION CHANGED
@@ -1 +1 @@
1
- v2254
1
+ v2261
package/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  [![Version](https://img.shields.io/npm/v/stripe.svg)](https://www.npmjs.org/package/stripe)
4
4
  [![Build Status](https://github.com/stripe/stripe-node/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-node/actions?query=branch%3Amaster)
5
5
  [![Downloads](https://img.shields.io/npm/dm/stripe.svg)](https://www.npmjs.com/package/stripe)
6
- [![Try on RunKit](https://badge.runkitcdn.com/stripe.svg)](https://runkit.com/npm/stripe)
7
6
 
8
7
  > [!TIP]
9
8
  > Want to chat live with Stripe engineers? Join us on our [Discord server](https://stripe.com/go/discord/node).
package/VERSION CHANGED
@@ -1 +1 @@
1
- 22.2.0-alpha.3
1
+ 22.2.0-alpha.5
@@ -0,0 +1,21 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { Stripe } from './stripe.core.js';
4
+ import * as Events from './resources/V2/Core/Events.js';
5
+ export interface UnhandledNotificationDetails {
6
+ isKnownEventType: boolean;
7
+ }
8
+ export type FallbackCallback = (event: Events.UnknownEventNotification, client: Stripe, details: UnhandledNotificationDetails) => Promise<void>;
9
+ export declare class StripeEventNotificationHandler {
10
+ private client;
11
+ private webhookSecret;
12
+ private fallbackCallback;
13
+ private registeredHandlers;
14
+ private hasHandledEvent;
15
+ constructor(client: Stripe, webhookSecret: string, fallbackCallback: FallbackCallback);
16
+ on<T extends Stripe.V2.Core.EventNotification['type']>(type: T, callback: (event: Extract<Stripe.V2.Core.EventNotification, {
17
+ type: T;
18
+ }>, client: Stripe) => Promise<void>): this;
19
+ registeredEventTypes(): string[];
20
+ handle(rawBody: string | Buffer, signature: string | Buffer): Promise<void>;
21
+ }
@@ -0,0 +1,466 @@
1
+ "use strict";
2
+ // File copied from our code generator; changes here will be overwritten.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.StripeEventNotificationHandler = void 0;
5
+ // most languages can check if we have an UnknownEventNotification at runtime
6
+ // but JS only has interfaces so we fall back to a string match to determine known events
7
+ const KNOWN_EVENT_TYPES = new Set([
8
+ // event-types: The beginning of the section generated from our OpenAPI spec
9
+ 'v1.account.application.authorized',
10
+ 'v1.account.application.deauthorized',
11
+ 'v1.account.external_account.created',
12
+ 'v1.account.external_account.deleted',
13
+ 'v1.account.external_account.updated',
14
+ 'v1.account.updated',
15
+ 'v1.account_signals[delinquency].created',
16
+ 'v1.application_fee.created',
17
+ 'v1.application_fee.refund.updated',
18
+ 'v1.application_fee.refunded',
19
+ 'v1.balance.available',
20
+ 'v1.billing.alert.triggered',
21
+ 'v1.billing.meter.error_report_triggered',
22
+ 'v1.billing.meter.no_meter_found',
23
+ 'v1.billing_portal.configuration.created',
24
+ 'v1.billing_portal.configuration.updated',
25
+ 'v1.billing_portal.session.created',
26
+ 'v1.capability.updated',
27
+ 'v1.cash_balance.funds_available',
28
+ 'v1.charge.captured',
29
+ 'v1.charge.dispute.closed',
30
+ 'v1.charge.dispute.created',
31
+ 'v1.charge.dispute.funds_reinstated',
32
+ 'v1.charge.dispute.funds_withdrawn',
33
+ 'v1.charge.dispute.updated',
34
+ 'v1.charge.expired',
35
+ 'v1.charge.failed',
36
+ 'v1.charge.pending',
37
+ 'v1.charge.refund.updated',
38
+ 'v1.charge.refunded',
39
+ 'v1.charge.succeeded',
40
+ 'v1.charge.updated',
41
+ 'v1.checkout.session.async_payment_failed',
42
+ 'v1.checkout.session.async_payment_succeeded',
43
+ 'v1.checkout.session.completed',
44
+ 'v1.checkout.session.expired',
45
+ 'v1.climate.order.canceled',
46
+ 'v1.climate.order.created',
47
+ 'v1.climate.order.delayed',
48
+ 'v1.climate.order.delivered',
49
+ 'v1.climate.order.product_substituted',
50
+ 'v1.climate.product.created',
51
+ 'v1.climate.product.pricing_updated',
52
+ 'v1.coupon.created',
53
+ 'v1.coupon.deleted',
54
+ 'v1.coupon.updated',
55
+ 'v1.credit_note.created',
56
+ 'v1.credit_note.updated',
57
+ 'v1.credit_note.voided',
58
+ 'v1.customer.created',
59
+ 'v1.customer.deleted',
60
+ 'v1.customer.subscription.created',
61
+ 'v1.customer.subscription.deleted',
62
+ 'v1.customer.subscription.paused',
63
+ 'v1.customer.subscription.pending_update_applied',
64
+ 'v1.customer.subscription.pending_update_expired',
65
+ 'v1.customer.subscription.resumed',
66
+ 'v1.customer.subscription.trial_will_end',
67
+ 'v1.customer.subscription.updated',
68
+ 'v1.customer.tax_id.created',
69
+ 'v1.customer.tax_id.deleted',
70
+ 'v1.customer.tax_id.updated',
71
+ 'v1.customer.updated',
72
+ 'v1.customer_cash_balance_transaction.created',
73
+ 'v1.entitlements.active_entitlement_summary.updated',
74
+ 'v1.file.created',
75
+ 'v1.financial_connections.account.created',
76
+ 'v1.financial_connections.account.deactivated',
77
+ 'v1.financial_connections.account.disconnected',
78
+ 'v1.financial_connections.account.reactivated',
79
+ 'v1.financial_connections.account.refreshed_balance',
80
+ 'v1.financial_connections.account.refreshed_ownership',
81
+ 'v1.financial_connections.account.refreshed_transactions',
82
+ 'v1.identity.verification_session.canceled',
83
+ 'v1.identity.verification_session.created',
84
+ 'v1.identity.verification_session.processing',
85
+ 'v1.identity.verification_session.redacted',
86
+ 'v1.identity.verification_session.requires_input',
87
+ 'v1.identity.verification_session.verified',
88
+ 'v1.invoice.created',
89
+ 'v1.invoice.deleted',
90
+ 'v1.invoice.finalization_failed',
91
+ 'v1.invoice.finalized',
92
+ 'v1.invoice.marked_uncollectible',
93
+ 'v1.invoice.overdue',
94
+ 'v1.invoice.overpaid',
95
+ 'v1.invoice.paid',
96
+ 'v1.invoice.payment_action_required',
97
+ 'v1.invoice.payment_failed',
98
+ 'v1.invoice.payment_succeeded',
99
+ 'v1.invoice.sent',
100
+ 'v1.invoice.upcoming',
101
+ 'v1.invoice.updated',
102
+ 'v1.invoice.voided',
103
+ 'v1.invoice.will_be_due',
104
+ 'v1.invoice_payment.paid',
105
+ 'v1.invoiceitem.created',
106
+ 'v1.invoiceitem.deleted',
107
+ 'v1.issuing_authorization.created',
108
+ 'v1.issuing_authorization.request',
109
+ 'v1.issuing_authorization.updated',
110
+ 'v1.issuing_card.created',
111
+ 'v1.issuing_card.updated',
112
+ 'v1.issuing_cardholder.created',
113
+ 'v1.issuing_cardholder.updated',
114
+ 'v1.issuing_dispute.closed',
115
+ 'v1.issuing_dispute.created',
116
+ 'v1.issuing_dispute.funds_reinstated',
117
+ 'v1.issuing_dispute.funds_rescinded',
118
+ 'v1.issuing_dispute.submitted',
119
+ 'v1.issuing_dispute.updated',
120
+ 'v1.issuing_personalization_design.activated',
121
+ 'v1.issuing_personalization_design.deactivated',
122
+ 'v1.issuing_personalization_design.rejected',
123
+ 'v1.issuing_personalization_design.updated',
124
+ 'v1.issuing_token.created',
125
+ 'v1.issuing_token.updated',
126
+ 'v1.issuing_transaction.created',
127
+ 'v1.issuing_transaction.purchase_details_receipt_updated',
128
+ 'v1.issuing_transaction.updated',
129
+ 'v1.mandate.updated',
130
+ 'v1.payment_intent.amount_capturable_updated',
131
+ 'v1.payment_intent.canceled',
132
+ 'v1.payment_intent.created',
133
+ 'v1.payment_intent.partially_funded',
134
+ 'v1.payment_intent.payment_failed',
135
+ 'v1.payment_intent.processing',
136
+ 'v1.payment_intent.requires_action',
137
+ 'v1.payment_intent.succeeded',
138
+ 'v1.payment_link.created',
139
+ 'v1.payment_link.updated',
140
+ 'v1.payment_method.attached',
141
+ 'v1.payment_method.automatically_updated',
142
+ 'v1.payment_method.detached',
143
+ 'v1.payment_method.updated',
144
+ 'v1.payout.canceled',
145
+ 'v1.payout.created',
146
+ 'v1.payout.failed',
147
+ 'v1.payout.paid',
148
+ 'v1.payout.reconciliation_completed',
149
+ 'v1.payout.updated',
150
+ 'v1.person.created',
151
+ 'v1.person.deleted',
152
+ 'v1.person.updated',
153
+ 'v1.plan.created',
154
+ 'v1.plan.deleted',
155
+ 'v1.plan.updated',
156
+ 'v1.price.created',
157
+ 'v1.price.deleted',
158
+ 'v1.price.updated',
159
+ 'v1.product.created',
160
+ 'v1.product.deleted',
161
+ 'v1.product.updated',
162
+ 'v1.promotion_code.created',
163
+ 'v1.promotion_code.updated',
164
+ 'v1.quote.accepted',
165
+ 'v1.quote.canceled',
166
+ 'v1.quote.created',
167
+ 'v1.quote.finalized',
168
+ 'v1.radar.early_fraud_warning.created',
169
+ 'v1.radar.early_fraud_warning.updated',
170
+ 'v1.refund.created',
171
+ 'v1.refund.failed',
172
+ 'v1.refund.updated',
173
+ 'v1.review.closed',
174
+ 'v1.review.opened',
175
+ 'v1.setup_intent.canceled',
176
+ 'v1.setup_intent.created',
177
+ 'v1.setup_intent.requires_action',
178
+ 'v1.setup_intent.setup_failed',
179
+ 'v1.setup_intent.succeeded',
180
+ 'v1.sigma.scheduled_query_run.created',
181
+ 'v1.source.canceled',
182
+ 'v1.source.chargeable',
183
+ 'v1.source.failed',
184
+ 'v1.source.refund_attributes_required',
185
+ 'v1.subscription_schedule.aborted',
186
+ 'v1.subscription_schedule.canceled',
187
+ 'v1.subscription_schedule.completed',
188
+ 'v1.subscription_schedule.created',
189
+ 'v1.subscription_schedule.expiring',
190
+ 'v1.subscription_schedule.released',
191
+ 'v1.subscription_schedule.updated',
192
+ 'v1.tax.settings.updated',
193
+ 'v1.tax_rate.created',
194
+ 'v1.tax_rate.updated',
195
+ 'v1.terminal.reader.action_failed',
196
+ 'v1.terminal.reader.action_succeeded',
197
+ 'v1.terminal.reader.action_updated',
198
+ 'v1.test_helpers.test_clock.advancing',
199
+ 'v1.test_helpers.test_clock.created',
200
+ 'v1.test_helpers.test_clock.deleted',
201
+ 'v1.test_helpers.test_clock.internal_failure',
202
+ 'v1.test_helpers.test_clock.ready',
203
+ 'v1.topup.canceled',
204
+ 'v1.topup.created',
205
+ 'v1.topup.failed',
206
+ 'v1.topup.reversed',
207
+ 'v1.topup.succeeded',
208
+ 'v1.transfer.created',
209
+ 'v1.transfer.reversed',
210
+ 'v1.transfer.updated',
211
+ 'v2.billing.cadence.billed',
212
+ 'v2.billing.cadence.canceled',
213
+ 'v2.billing.cadence.created',
214
+ 'v2.billing.license_fee.created',
215
+ 'v2.billing.license_fee.updated',
216
+ 'v2.billing.license_fee_version.created',
217
+ 'v2.billing.licensed_item.created',
218
+ 'v2.billing.licensed_item.updated',
219
+ 'v2.billing.metered_item.created',
220
+ 'v2.billing.metered_item.updated',
221
+ 'v2.billing.pricing_plan.created',
222
+ 'v2.billing.pricing_plan.updated',
223
+ 'v2.billing.pricing_plan_component.created',
224
+ 'v2.billing.pricing_plan_component.updated',
225
+ 'v2.billing.pricing_plan_subscription.collection_awaiting_customer_action',
226
+ 'v2.billing.pricing_plan_subscription.collection_current',
227
+ 'v2.billing.pricing_plan_subscription.collection_past_due',
228
+ 'v2.billing.pricing_plan_subscription.collection_paused',
229
+ 'v2.billing.pricing_plan_subscription.collection_unpaid',
230
+ 'v2.billing.pricing_plan_subscription.servicing_activated',
231
+ 'v2.billing.pricing_plan_subscription.servicing_canceled',
232
+ 'v2.billing.pricing_plan_subscription.servicing_paused',
233
+ 'v2.billing.pricing_plan_version.created',
234
+ 'v2.billing.rate_card.created',
235
+ 'v2.billing.rate_card.updated',
236
+ 'v2.billing.rate_card_custom_pricing_unit_overage_rate.created',
237
+ 'v2.billing.rate_card_rate.created',
238
+ 'v2.billing.rate_card_subscription.activated',
239
+ 'v2.billing.rate_card_subscription.canceled',
240
+ 'v2.billing.rate_card_subscription.collection_awaiting_customer_action',
241
+ 'v2.billing.rate_card_subscription.collection_current',
242
+ 'v2.billing.rate_card_subscription.collection_past_due',
243
+ 'v2.billing.rate_card_subscription.collection_paused',
244
+ 'v2.billing.rate_card_subscription.collection_unpaid',
245
+ 'v2.billing.rate_card_subscription.servicing_activated',
246
+ 'v2.billing.rate_card_subscription.servicing_canceled',
247
+ 'v2.billing.rate_card_subscription.servicing_paused',
248
+ 'v2.billing.rate_card_version.created',
249
+ 'v2.commerce.product_catalog.imports.failed',
250
+ 'v2.commerce.product_catalog.imports.processing',
251
+ 'v2.commerce.product_catalog.imports.succeeded',
252
+ 'v2.commerce.product_catalog.imports.succeeded_with_errors',
253
+ 'v2.core.account.closed',
254
+ 'v2.core.account.created',
255
+ 'v2.core.account.updated',
256
+ 'v2.core.account[configuration.card_creator].capability_status_updated',
257
+ 'v2.core.account[configuration.card_creator].updated',
258
+ 'v2.core.account[configuration.customer].capability_status_updated',
259
+ 'v2.core.account[configuration.customer].updated',
260
+ 'v2.core.account[configuration.merchant].capability_status_updated',
261
+ 'v2.core.account[configuration.merchant].updated',
262
+ 'v2.core.account[configuration.recipient].capability_status_updated',
263
+ 'v2.core.account[configuration.recipient].updated',
264
+ 'v2.core.account[configuration.storer].capability_status_updated',
265
+ 'v2.core.account[configuration.storer].updated',
266
+ 'v2.core.account[defaults].updated',
267
+ 'v2.core.account[future_requirements].updated',
268
+ 'v2.core.account[identity].updated',
269
+ 'v2.core.account[requirements].updated',
270
+ 'v2.core.account_link.returned',
271
+ 'v2.core.account_person.created',
272
+ 'v2.core.account_person.deleted',
273
+ 'v2.core.account_person.updated',
274
+ 'v2.core.account_signals.fraudulent_website_ready',
275
+ 'v2.core.approval_request.approved',
276
+ 'v2.core.approval_request.canceled',
277
+ 'v2.core.approval_request.created',
278
+ 'v2.core.approval_request.expired',
279
+ 'v2.core.approval_request.failed',
280
+ 'v2.core.approval_request.rejected',
281
+ 'v2.core.approval_request.succeeded',
282
+ 'v2.core.batch_job.batch_failed',
283
+ 'v2.core.batch_job.canceled',
284
+ 'v2.core.batch_job.completed',
285
+ 'v2.core.batch_job.created',
286
+ 'v2.core.batch_job.ready_for_upload',
287
+ 'v2.core.batch_job.timeout',
288
+ 'v2.core.batch_job.updated',
289
+ 'v2.core.batch_job.upload_timeout',
290
+ 'v2.core.batch_job.validating',
291
+ 'v2.core.batch_job.validation_failed',
292
+ 'v2.core.claimable_sandbox.claimed',
293
+ 'v2.core.claimable_sandbox.created',
294
+ 'v2.core.claimable_sandbox.expired',
295
+ 'v2.core.claimable_sandbox.expiring',
296
+ 'v2.core.claimable_sandbox.updated',
297
+ 'v2.core.event_destination.ping',
298
+ 'v2.core.health.api_error.firing',
299
+ 'v2.core.health.api_error.resolved',
300
+ 'v2.core.health.api_latency.firing',
301
+ 'v2.core.health.api_latency.resolved',
302
+ 'v2.core.health.authorization_rate_drop.firing',
303
+ 'v2.core.health.authorization_rate_drop.resolved',
304
+ 'v2.core.health.event_generation_failure.resolved',
305
+ 'v2.core.health.fraud_rate.increased',
306
+ 'v2.core.health.issuing_authorization_request_errors.firing',
307
+ 'v2.core.health.issuing_authorization_request_errors.resolved',
308
+ 'v2.core.health.issuing_authorization_request_timeout.firing',
309
+ 'v2.core.health.issuing_authorization_request_timeout.resolved',
310
+ 'v2.core.health.meter_event_summaries_delayed.firing',
311
+ 'v2.core.health.meter_event_summaries_delayed.resolved',
312
+ 'v2.core.health.payment_method_error.firing',
313
+ 'v2.core.health.payment_method_error.resolved',
314
+ 'v2.core.health.sepa_debit_delayed.firing',
315
+ 'v2.core.health.sepa_debit_delayed.resolved',
316
+ 'v2.core.health.traffic_volume_drop.firing',
317
+ 'v2.core.health.traffic_volume_drop.resolved',
318
+ 'v2.core.health.webhook_latency.firing',
319
+ 'v2.core.health.webhook_latency.resolved',
320
+ 'v2.data.reporting.query_run.created',
321
+ 'v2.data.reporting.query_run.failed',
322
+ 'v2.data.reporting.query_run.succeeded',
323
+ 'v2.data.reporting.query_run.updated',
324
+ 'v2.extend.extension_run.failed',
325
+ 'v2.extend.workflow_run.failed',
326
+ 'v2.extend.workflow_run.started',
327
+ 'v2.extend.workflow_run.succeeded',
328
+ 'v2.iam.api_key.created',
329
+ 'v2.iam.api_key.default_secret_revealed',
330
+ 'v2.iam.api_key.expired',
331
+ 'v2.iam.api_key.permissions_updated',
332
+ 'v2.iam.api_key.rotated',
333
+ 'v2.iam.api_key.updated',
334
+ 'v2.iam.stripe_access_grant.approved',
335
+ 'v2.iam.stripe_access_grant.canceled',
336
+ 'v2.iam.stripe_access_grant.denied',
337
+ 'v2.iam.stripe_access_grant.removed',
338
+ 'v2.iam.stripe_access_grant.requested',
339
+ 'v2.iam.stripe_access_grant.updated',
340
+ 'v2.money_management.adjustment.created',
341
+ 'v2.money_management.financial_account.created',
342
+ 'v2.money_management.financial_account.updated',
343
+ 'v2.money_management.financial_account_statement.created',
344
+ 'v2.money_management.financial_account_statement.restated',
345
+ 'v2.money_management.financial_address.activated',
346
+ 'v2.money_management.financial_address.failed',
347
+ 'v2.money_management.inbound_transfer.available',
348
+ 'v2.money_management.inbound_transfer.bank_debit_failed',
349
+ 'v2.money_management.inbound_transfer.bank_debit_processing',
350
+ 'v2.money_management.inbound_transfer.bank_debit_queued',
351
+ 'v2.money_management.inbound_transfer.bank_debit_returned',
352
+ 'v2.money_management.inbound_transfer.bank_debit_succeeded',
353
+ 'v2.money_management.outbound_payment.canceled',
354
+ 'v2.money_management.outbound_payment.created',
355
+ 'v2.money_management.outbound_payment.failed',
356
+ 'v2.money_management.outbound_payment.posted',
357
+ 'v2.money_management.outbound_payment.returned',
358
+ 'v2.money_management.outbound_payment.updated',
359
+ 'v2.money_management.outbound_transfer.canceled',
360
+ 'v2.money_management.outbound_transfer.created',
361
+ 'v2.money_management.outbound_transfer.failed',
362
+ 'v2.money_management.outbound_transfer.posted',
363
+ 'v2.money_management.outbound_transfer.returned',
364
+ 'v2.money_management.outbound_transfer.updated',
365
+ 'v2.money_management.payout_method.created',
366
+ 'v2.money_management.payout_method.updated',
367
+ 'v2.money_management.received_credit.available',
368
+ 'v2.money_management.received_credit.failed',
369
+ 'v2.money_management.received_credit.returned',
370
+ 'v2.money_management.received_credit.succeeded',
371
+ 'v2.money_management.received_debit.canceled',
372
+ 'v2.money_management.received_debit.failed',
373
+ 'v2.money_management.received_debit.pending',
374
+ 'v2.money_management.received_debit.succeeded',
375
+ 'v2.money_management.received_debit.updated',
376
+ 'v2.money_management.recipient_verification.created',
377
+ 'v2.money_management.recipient_verification.updated',
378
+ 'v2.money_management.transaction.created',
379
+ 'v2.money_management.transaction.updated',
380
+ 'v2.orchestrated_commerce.agreement.confirmed',
381
+ 'v2.orchestrated_commerce.agreement.created',
382
+ 'v2.orchestrated_commerce.agreement.partially_confirmed',
383
+ 'v2.orchestrated_commerce.agreement.terminated',
384
+ 'v2.payments.off_session_payment.attempt_failed',
385
+ 'v2.payments.off_session_payment.attempt_started',
386
+ 'v2.payments.off_session_payment.authorization_attempt_failed',
387
+ 'v2.payments.off_session_payment.authorization_attempt_started',
388
+ 'v2.payments.off_session_payment.canceled',
389
+ 'v2.payments.off_session_payment.created',
390
+ 'v2.payments.off_session_payment.failed',
391
+ 'v2.payments.off_session_payment.paused',
392
+ 'v2.payments.off_session_payment.requires_capture',
393
+ 'v2.payments.off_session_payment.resumed',
394
+ 'v2.payments.off_session_payment.succeeded',
395
+ 'v2.payments.settlement_allocation_intent.canceled',
396
+ 'v2.payments.settlement_allocation_intent.created',
397
+ 'v2.payments.settlement_allocation_intent.errored',
398
+ 'v2.payments.settlement_allocation_intent.funds_not_received',
399
+ 'v2.payments.settlement_allocation_intent.matched',
400
+ 'v2.payments.settlement_allocation_intent.not_found',
401
+ 'v2.payments.settlement_allocation_intent.settled',
402
+ 'v2.payments.settlement_allocation_intent.submitted',
403
+ 'v2.payments.settlement_allocation_intent_split.canceled',
404
+ 'v2.payments.settlement_allocation_intent_split.created',
405
+ 'v2.payments.settlement_allocation_intent_split.settled',
406
+ 'v2.reporting.report_run.created',
407
+ 'v2.reporting.report_run.failed',
408
+ 'v2.reporting.report_run.succeeded',
409
+ 'v2.reporting.report_run.updated',
410
+ 'v2.signals.account_signal.fraudulent_merchant_ready',
411
+ // event-types: The end of the section generated from our OpenAPI spec
412
+ ]);
413
+ class StripeEventNotificationHandler {
414
+ // eslint-disable-next-line no-useless-constructor
415
+ constructor(client, webhookSecret, fallbackCallback) {
416
+ this.client = client;
417
+ this.webhookSecret = webhookSecret;
418
+ this.fallbackCallback = fallbackCallback;
419
+ this.registeredHandlers = {};
420
+ this.hasHandledEvent = false;
421
+ }
422
+ on(type, callback) {
423
+ if (this.hasHandledEvent) {
424
+ throw new Error('Cannot register new handlers after an event has been handled. This is indicative of a bug.');
425
+ }
426
+ // the matched types are validated by the type system
427
+ if (this.registeredHandlers[type]) {
428
+ throw new Error(`Handler already registered for event type: ${type}`);
429
+ }
430
+ this.registeredHandlers[type] = callback;
431
+ return this;
432
+ }
433
+ registeredEventTypes() {
434
+ const keys = Object.keys(this.registeredHandlers);
435
+ keys.sort();
436
+ return keys;
437
+ }
438
+ async handle(
439
+ // these types are duplicated in the manual types, so they're just here for internal use
440
+ rawBody, signature) {
441
+ // we're not worried about thread safety here because we expect callbacks will be registered synchronously on app startup
442
+ this.hasHandledEvent = true;
443
+ const event = this.client.parseEventNotification(rawBody, signature, this.webhookSecret);
444
+ // Create a new client with the event's context instead of modifying the shared client
445
+ // This ensures thread-safety when processing webhooks in parallel
446
+ // We create a shallow copy and override _api with a new object containing the event context
447
+ // This reuses expensive resources like httpClient (Flyweight pattern)
448
+ const eventClient = Object.create(Object.getPrototypeOf(this.client));
449
+ Object.assign(eventClient, this.client);
450
+ eventClient._api = {
451
+ ...this.client._api,
452
+ stripeContext: event.context,
453
+ };
454
+ const handler = this.registeredHandlers[event.type];
455
+ if (handler) {
456
+ return await handler(event, eventClient);
457
+ }
458
+ else {
459
+ return await this.fallbackCallback(event, eventClient, {
460
+ isKnownEventType: KNOWN_EVENT_TYPES.has(event.type),
461
+ });
462
+ }
463
+ }
464
+ }
465
+ exports.StripeEventNotificationHandler = StripeEventNotificationHandler;
466
+ //# sourceMappingURL=StripeEventNotificationHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StripeEventNotificationHandler.js","sourceRoot":"","sources":["../src/StripeEventNotificationHandler.ts"],"names":[],"mappings":";AAAA,yEAAyE;;;AAkBzE,6EAA6E;AAC7E,yFAAyF;AACzF,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,4EAA4E;IAC5E,mCAAmC;IACnC,qCAAqC;IACrC,qCAAqC;IACrC,qCAAqC;IACrC,qCAAqC;IACrC,oBAAoB;IACpB,yCAAyC;IACzC,4BAA4B;IAC5B,mCAAmC;IACnC,6BAA6B;IAC7B,sBAAsB;IACtB,4BAA4B;IAC5B,yCAAyC;IACzC,iCAAiC;IACjC,yCAAyC;IACzC,yCAAyC;IACzC,mCAAmC;IACnC,uBAAuB;IACvB,iCAAiC;IACjC,oBAAoB;IACpB,0BAA0B;IAC1B,2BAA2B;IAC3B,oCAAoC;IACpC,mCAAmC;IACnC,2BAA2B;IAC3B,mBAAmB;IACnB,kBAAkB;IAClB,mBAAmB;IACnB,0BAA0B;IAC1B,oBAAoB;IACpB,qBAAqB;IACrB,mBAAmB;IACnB,0CAA0C;IAC1C,6CAA6C;IAC7C,+BAA+B;IAC/B,6BAA6B;IAC7B,2BAA2B;IAC3B,0BAA0B;IAC1B,0BAA0B;IAC1B,4BAA4B;IAC5B,sCA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I,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,MAAM;IACjB,wFAAwF;IACxF,OAAwB,EACxB,SAA0B;QAE1B,yHAAyH;QACzH,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAC9C,OAAO,EACP,SAAS,EACT,IAAI,CAAC,aAAa,CACnB,CAAC;QAEF,sFAAsF;QACtF,kEAAkE;QAClE,4FAA4F;QAC5F,sEAAsE;QACtE,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QACtE,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACxC,WAAW,CAAC,IAAI,GAAG;YACjB,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI;YACnB,aAAa,EAAE,KAAK,CAAC,OAAO;SAC7B,CAAC;QAEF,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACpD,IAAI,OAAO,EAAE;YACX,OAAO,MAAM,OAAO,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;SAC1C;aAAM;YACL,OAAO,MAAM,IAAI,CAAC,gBAAgB,CAChC,KAAwC,EACxC,WAAW,EACX;gBACE,gBAAgB,EAAE,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;aACpD,CACF,CAAC;SACH;IACH,CAAC;CACF;AA7ED,wEA6EC"}
@@ -2424,6 +2424,10 @@ export declare namespace AccountCreateParams {
2424
2424
  requested?: boolean;
2425
2425
  }
2426
2426
  interface CardPayments {
2427
+ /**
2428
+ * Protections to apply to this capability.
2429
+ */
2430
+ protections?: CardPayments.Protections;
2427
2431
  /**
2428
2432
  * 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.
2429
2433
  */
@@ -2795,6 +2799,22 @@ export declare namespace AccountCreateParams {
2795
2799
  */
2796
2800
  requested?: boolean;
2797
2801
  }
2802
+ namespace CardPayments {
2803
+ interface Protections {
2804
+ /**
2805
+ * Protection for connected accounts migrating from another PSP.
2806
+ */
2807
+ psp_migration: Protections.PspMigration;
2808
+ }
2809
+ namespace Protections {
2810
+ interface PspMigration {
2811
+ /**
2812
+ * Passing true requests the protection.
2813
+ */
2814
+ requested: boolean;
2815
+ }
2816
+ }
2817
+ }
2798
2818
  }
2799
2819
  namespace Company {
2800
2820
  interface DirectorshipDeclaration {
@@ -4332,6 +4352,10 @@ export declare namespace AccountUpdateParams {
4332
4352
  requested?: boolean;
4333
4353
  }
4334
4354
  interface CardPayments {
4355
+ /**
4356
+ * Protections to apply to this capability.
4357
+ */
4358
+ protections?: CardPayments.Protections;
4335
4359
  /**
4336
4360
  * 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.
4337
4361
  */
@@ -4703,6 +4727,22 @@ export declare namespace AccountUpdateParams {
4703
4727
  */
4704
4728
  requested?: boolean;
4705
4729
  }
4730
+ namespace CardPayments {
4731
+ interface Protections {
4732
+ /**
4733
+ * Protection for connected accounts migrating from another PSP.
4734
+ */
4735
+ psp_migration: Protections.PspMigration;
4736
+ }
4737
+ namespace Protections {
4738
+ interface PspMigration {
4739
+ /**
4740
+ * Passing true requests the protection.
4741
+ */
4742
+ requested: boolean;
4743
+ }
4744
+ }
4745
+ }
4706
4746
  }
4707
4747
  namespace Company {
4708
4748
  interface DirectorshipDeclaration {