@stripe/stripe-react-native 0.63.0 → 0.64.1

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 (285) hide show
  1. package/README.md +2 -2
  2. package/android/build.gradle +2 -2
  3. package/android/detekt/detekt-baseline.xml +81 -0
  4. package/android/detekt/detekt.gradle +45 -0
  5. package/android/detekt/detekt.yml +722 -0
  6. package/android/gradle.properties +4 -4
  7. package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +3 -1
  8. package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormViewManager.kt +2 -1
  9. package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +5 -1
  10. package/android/src/main/java/com/reactnativestripesdk/CurrencySelectorElementView.kt +26 -0
  11. package/android/src/main/java/com/reactnativestripesdk/CurrencySelectorElementViewManager.kt +42 -0
  12. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +105 -49
  13. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +72 -12
  14. package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetManager.kt +8 -4
  15. package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt +2 -1
  16. package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +26 -11
  17. package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherManager.kt +2 -1
  18. package/android/src/main/java/com/reactnativestripesdk/NavigationBarView.kt +14 -5
  19. package/android/src/main/java/com/reactnativestripesdk/PaymentElementConfig.kt +6 -2
  20. package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherManager.kt +2 -2
  21. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +24 -1
  22. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodMessagingElementConfig.kt +7 -4
  23. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodMessagingElementViewManager.kt +2 -1
  24. package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +8 -4
  25. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +9 -3
  26. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetManager.kt +110 -29
  27. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +256 -12
  28. package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +6 -5
  29. package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherManager.kt +2 -1
  30. package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +3 -1
  31. package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetManager.kt +6 -2
  32. package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerAdapter.kt +3 -1
  33. package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerSessionProvider.kt +2 -1
  34. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +2 -1
  35. package/android/src/main/java/com/reactnativestripesdk/utils/CheckoutAddressUpdate.kt +45 -0
  36. package/android/src/main/java/com/reactnativestripesdk/utils/CheckoutMappers.kt +101 -0
  37. package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +4 -2
  38. package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +5 -1
  39. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +31 -17
  40. package/android/src/main/java/com/reactnativestripesdk/utils/PostalCodeUtilities.kt +2 -1
  41. package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerDelegate.java +6 -0
  42. package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerInterface.java +2 -0
  43. package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeCurrencySelectorElementManagerDelegate.java +35 -0
  44. package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeCurrencySelectorElementManagerInterface.java +18 -0
  45. package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +44 -0
  46. package/android/src/onramp/java/com/reactnativestripesdk/OnrampMappers.kt +43 -0
  47. package/android/src/onramp/java/com/reactnativestripesdk/OnrampSdkModule.kt +5 -1
  48. package/android/src/test/java/com/reactnativestripesdk/PaymentMethodMessagingElementConfigTest.kt +3 -3
  49. package/android/src/test/java/com/reactnativestripesdk/mappers/MappersTest.kt +93 -0
  50. package/android/src/test/java/com/reactnativestripesdk/mappers/OnrampMappersTest.kt +336 -0
  51. package/android/src/test/java/com/reactnativestripesdk/mappers/PaymentOptionDisplayDataMapperTest.kt +9 -4
  52. package/android/src/test/java/com/reactnativestripesdk/utils/CheckoutMappersTest.kt +89 -0
  53. package/android/src/test/java/com/reactnativestripesdk/utils/CheckoutTestFixtures.java +49 -0
  54. package/ios/AddressSheet/AddressSheetUtils.swift +23 -0
  55. package/ios/AddressSheet/AddressSheetView.swift +9 -14
  56. package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewController.swift +6 -8
  57. package/ios/CurrencySelectorElementManager.m +9 -0
  58. package/ios/CurrencySelectorElementManager.swift +12 -0
  59. package/ios/CurrencySelectorElementView.swift +24 -0
  60. package/ios/Mappers+Checkout.swift +193 -0
  61. package/ios/Mappers.swift +74 -5
  62. package/ios/NewArch/EmbeddedPaymentElementViewComponentView.mm +16 -2
  63. package/ios/NewArch/StripeCurrencySelectorElementComponentView.h +10 -0
  64. package/ios/NewArch/StripeCurrencySelectorElementComponentView.mm +75 -0
  65. package/ios/PaymentMethodFactory.swift +19 -0
  66. package/ios/PaymentMethodMessagingElementConfig.swift +6 -3
  67. package/ios/PaymentMethodMessagingElementView.swift +19 -0
  68. package/ios/StripeSdk-Bridging-Header.h +1 -0
  69. package/ios/StripeSdk.mm +124 -1
  70. package/ios/StripeSdkImpl+Checkout.swift +308 -0
  71. package/ios/StripeSdkImpl+Embedded.swift +108 -27
  72. package/ios/StripeSdkImpl+PaymentSheet.swift +18 -2
  73. package/ios/StripeSdkImpl.swift +41 -103
  74. package/ios/StripeSwiftInterop.h +1 -0
  75. package/jest/mock.js +16 -1
  76. package/lib/commonjs/components/AddToWalletButton.js +1 -1
  77. package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
  78. package/lib/commonjs/components/AddressSheet.js +1 -1
  79. package/lib/commonjs/components/AddressSheet.js.map +1 -1
  80. package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
  81. package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
  82. package/lib/commonjs/components/CardField.js +1 -1
  83. package/lib/commonjs/components/CardField.js.map +1 -1
  84. package/lib/commonjs/components/CardForm.js +1 -1
  85. package/lib/commonjs/components/CardForm.js.map +1 -1
  86. package/lib/commonjs/components/CurrencySelectorElement.js +2 -0
  87. package/lib/commonjs/components/CurrencySelectorElement.js.map +1 -0
  88. package/lib/commonjs/components/PaymentMethodMessagingElement.js +2 -0
  89. package/lib/commonjs/components/PaymentMethodMessagingElement.js.map +1 -0
  90. package/lib/commonjs/components/PlatformPayButton.js +1 -1
  91. package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
  92. package/lib/commonjs/components/StripeContainer.js +1 -1
  93. package/lib/commonjs/components/StripeContainer.js.map +1 -1
  94. package/lib/commonjs/components/StripeProvider.js +1 -1
  95. package/lib/commonjs/components/StripeProvider.js.map +1 -1
  96. package/lib/commonjs/connect/Components.js +1 -1
  97. package/lib/commonjs/connect/Components.js.map +1 -1
  98. package/lib/commonjs/connect/ConnectComponentsProvider.js +1 -1
  99. package/lib/commonjs/connect/ConnectComponentsProvider.js.map +1 -1
  100. package/lib/commonjs/connect/EmbeddedComponent.js +1 -1
  101. package/lib/commonjs/connect/EmbeddedComponent.js.map +1 -1
  102. package/lib/commonjs/connect/ModalCloseButton.js +1 -1
  103. package/lib/commonjs/connect/ModalCloseButton.js.map +1 -1
  104. package/lib/commonjs/connect/NavigationBar.js +1 -1
  105. package/lib/commonjs/connect/NavigationBar.js.map +1 -1
  106. package/lib/commonjs/connect/testUtils.js +1 -1
  107. package/lib/commonjs/connect/testUtils.js.map +1 -1
  108. package/lib/commonjs/events.js +1 -1
  109. package/lib/commonjs/events.js.map +1 -1
  110. package/lib/commonjs/functions.js +1 -1
  111. package/lib/commonjs/functions.js.map +1 -1
  112. package/lib/commonjs/helpers.js +1 -1
  113. package/lib/commonjs/hooks/useCheckout.js +2 -0
  114. package/lib/commonjs/hooks/useCheckout.js.map +1 -0
  115. package/lib/commonjs/hooks/useOnramp.js +1 -1
  116. package/lib/commonjs/hooks/useOnramp.js.map +1 -1
  117. package/lib/commonjs/index.js +1 -1
  118. package/lib/commonjs/index.js.map +1 -1
  119. package/lib/commonjs/specs/NativeAddToWalletButton.js +1 -1
  120. package/lib/commonjs/specs/NativeAddressSheet.js +1 -1
  121. package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
  122. package/lib/commonjs/specs/NativeAuBECSDebitForm.js +1 -1
  123. package/lib/commonjs/specs/NativeCardField.js +1 -1
  124. package/lib/commonjs/specs/NativeCardField.js.map +1 -1
  125. package/lib/commonjs/specs/NativeCardForm.js +1 -1
  126. package/lib/commonjs/specs/NativeCardForm.js.map +1 -1
  127. package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js +1 -1
  128. package/lib/commonjs/specs/NativeCurrencySelectorElement.js +2 -0
  129. package/lib/commonjs/specs/NativeCurrencySelectorElement.js.map +1 -0
  130. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +1 -1
  131. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -1
  132. package/lib/commonjs/specs/NativeGooglePayButton.js +1 -1
  133. package/lib/commonjs/specs/NativeNavigationBar.js +1 -1
  134. package/lib/commonjs/specs/NativeOnrampSdkModule.js +1 -1
  135. package/lib/commonjs/specs/NativeOnrampSdkModule.js.map +1 -1
  136. package/lib/commonjs/specs/NativePaymentMethodMessagingElement.js +1 -1
  137. package/lib/commonjs/specs/NativePaymentMethodMessagingElement.js.map +1 -1
  138. package/lib/commonjs/specs/NativeStripeContainer.js +1 -1
  139. package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
  140. package/lib/commonjs/types/Checkout.js +2 -0
  141. package/lib/commonjs/types/Checkout.js.map +1 -0
  142. package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
  143. package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
  144. package/lib/commonjs/types/Onramp.js.map +1 -1
  145. package/lib/commonjs/types/PaymentIntent.js.map +1 -1
  146. package/lib/commonjs/types/PaymentSheet.js.map +1 -1
  147. package/lib/module/components/AddToWalletButton.js +1 -1
  148. package/lib/module/components/AddToWalletButton.js.map +1 -1
  149. package/lib/module/components/AddressSheet.js +1 -1
  150. package/lib/module/components/AddressSheet.js.map +1 -1
  151. package/lib/module/components/AuBECSDebitForm.js +1 -1
  152. package/lib/module/components/AuBECSDebitForm.js.map +1 -1
  153. package/lib/module/components/CardField.js +1 -1
  154. package/lib/module/components/CardField.js.map +1 -1
  155. package/lib/module/components/CardForm.js +1 -1
  156. package/lib/module/components/CardForm.js.map +1 -1
  157. package/lib/module/components/CurrencySelectorElement.js +2 -0
  158. package/lib/module/components/CurrencySelectorElement.js.map +1 -0
  159. package/lib/module/components/PaymentMethodMessagingElement.js +2 -0
  160. package/lib/module/components/PaymentMethodMessagingElement.js.map +1 -0
  161. package/lib/module/components/PlatformPayButton.js +1 -1
  162. package/lib/module/components/PlatformPayButton.js.map +1 -1
  163. package/lib/module/components/StripeContainer.js +1 -1
  164. package/lib/module/components/StripeContainer.js.map +1 -1
  165. package/lib/module/components/StripeProvider.js +1 -1
  166. package/lib/module/components/StripeProvider.js.map +1 -1
  167. package/lib/module/connect/Components.js +1 -1
  168. package/lib/module/connect/Components.js.map +1 -1
  169. package/lib/module/connect/ConnectComponentsProvider.js +1 -1
  170. package/lib/module/connect/ConnectComponentsProvider.js.map +1 -1
  171. package/lib/module/connect/EmbeddedComponent.js +1 -1
  172. package/lib/module/connect/EmbeddedComponent.js.map +1 -1
  173. package/lib/module/connect/ModalCloseButton.js +1 -1
  174. package/lib/module/connect/ModalCloseButton.js.map +1 -1
  175. package/lib/module/connect/NavigationBar.js +1 -1
  176. package/lib/module/connect/NavigationBar.js.map +1 -1
  177. package/lib/module/connect/testUtils.js +1 -1
  178. package/lib/module/connect/testUtils.js.map +1 -1
  179. package/lib/module/events.js +1 -1
  180. package/lib/module/events.js.map +1 -1
  181. package/lib/module/functions.js +1 -1
  182. package/lib/module/functions.js.map +1 -1
  183. package/lib/module/helpers.js +1 -1
  184. package/lib/module/hooks/useCheckout.js +2 -0
  185. package/lib/module/hooks/useCheckout.js.map +1 -0
  186. package/lib/module/hooks/useOnramp.js +1 -1
  187. package/lib/module/hooks/useOnramp.js.map +1 -1
  188. package/lib/module/index.js +1 -1
  189. package/lib/module/index.js.map +1 -1
  190. package/lib/module/specs/NativeAddToWalletButton.js +1 -1
  191. package/lib/module/specs/NativeAddressSheet.js +1 -1
  192. package/lib/module/specs/NativeApplePayButton.js +1 -1
  193. package/lib/module/specs/NativeAuBECSDebitForm.js +1 -1
  194. package/lib/module/specs/NativeCardField.js +1 -1
  195. package/lib/module/specs/NativeCardField.js.map +1 -1
  196. package/lib/module/specs/NativeCardForm.js +1 -1
  197. package/lib/module/specs/NativeCardForm.js.map +1 -1
  198. package/lib/module/specs/NativeConnectAccountOnboardingView.js +1 -1
  199. package/lib/module/specs/NativeCurrencySelectorElement.js +2 -0
  200. package/lib/module/specs/NativeCurrencySelectorElement.js.map +1 -0
  201. package/lib/module/specs/NativeEmbeddedPaymentElement.js +1 -1
  202. package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -1
  203. package/lib/module/specs/NativeGooglePayButton.js +1 -1
  204. package/lib/module/specs/NativeNavigationBar.js +1 -1
  205. package/lib/module/specs/NativeOnrampSdkModule.js +1 -1
  206. package/lib/module/specs/NativeOnrampSdkModule.js.map +1 -1
  207. package/lib/module/specs/NativePaymentMethodMessagingElement.js +1 -1
  208. package/lib/module/specs/NativePaymentMethodMessagingElement.js.map +1 -1
  209. package/lib/module/specs/NativeStripeContainer.js +1 -1
  210. package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
  211. package/lib/module/types/Checkout.js +2 -0
  212. package/lib/module/types/Checkout.js.map +1 -0
  213. package/lib/module/types/EmbeddedPaymentElement.js +1 -1
  214. package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
  215. package/lib/module/types/Onramp.js.map +1 -1
  216. package/lib/module/types/PaymentIntent.js.map +1 -1
  217. package/lib/module/types/PaymentSheet.js.map +1 -1
  218. package/lib/typescript/src/components/CurrencySelectorElement.d.ts +62 -0
  219. package/lib/typescript/src/components/CurrencySelectorElement.d.ts.map +1 -0
  220. package/lib/typescript/src/components/PaymentMethodMessagingElement.d.ts +41 -0
  221. package/lib/typescript/src/components/PaymentMethodMessagingElement.d.ts.map +1 -0
  222. package/lib/typescript/src/connect/testUtils.d.ts +4 -0
  223. package/lib/typescript/src/connect/testUtils.d.ts.map +1 -1
  224. package/lib/typescript/src/events.d.ts +11 -0
  225. package/lib/typescript/src/events.d.ts.map +1 -1
  226. package/lib/typescript/src/functions.d.ts +2 -0
  227. package/lib/typescript/src/functions.d.ts.map +1 -1
  228. package/lib/typescript/src/hooks/useCheckout.d.ts +21 -0
  229. package/lib/typescript/src/hooks/useCheckout.d.ts.map +1 -0
  230. package/lib/typescript/src/hooks/useOnramp.d.ts +9 -3
  231. package/lib/typescript/src/hooks/useOnramp.d.ts.map +1 -1
  232. package/lib/typescript/src/index.d.ts +3 -0
  233. package/lib/typescript/src/index.d.ts.map +1 -1
  234. package/lib/typescript/src/specs/NativeCurrencySelectorElement.d.ts +25 -0
  235. package/lib/typescript/src/specs/NativeCurrencySelectorElement.d.ts.map +1 -0
  236. package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts +5 -1
  237. package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts.map +1 -1
  238. package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts +1 -1
  239. package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts.map +1 -1
  240. package/lib/typescript/src/specs/NativePaymentMethodMessagingElement.d.ts +1 -6
  241. package/lib/typescript/src/specs/NativePaymentMethodMessagingElement.d.ts.map +1 -1
  242. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +19 -2
  243. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
  244. package/lib/typescript/src/types/Checkout.d.ts +336 -0
  245. package/lib/typescript/src/types/Checkout.d.ts.map +1 -0
  246. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +36 -1
  247. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
  248. package/lib/typescript/src/types/NextAction.d.ts +8 -1
  249. package/lib/typescript/src/types/NextAction.d.ts.map +1 -1
  250. package/lib/typescript/src/types/Onramp.d.ts +40 -1
  251. package/lib/typescript/src/types/Onramp.d.ts.map +1 -1
  252. package/lib/typescript/src/types/PaymentIntent.d.ts +11 -1
  253. package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -1
  254. package/lib/typescript/src/types/PaymentMethod.d.ts +10 -6
  255. package/lib/typescript/src/types/PaymentMethod.d.ts.map +1 -1
  256. package/lib/typescript/src/types/PaymentSheet.d.ts +22 -6
  257. package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
  258. package/lib/typescript/src/types/components/PaymentMethodMessagingElementComponent.d.ts +16 -1
  259. package/lib/typescript/src/types/components/PaymentMethodMessagingElementComponent.d.ts.map +1 -1
  260. package/package.json +21 -7
  261. package/src/components/CurrencySelectorElement.tsx +95 -0
  262. package/src/components/PaymentMethodMessagingElement.tsx +109 -0
  263. package/src/components/StripeProvider.tsx +1 -1
  264. package/src/connect/testUtils.ts +2 -0
  265. package/src/events.ts +20 -3
  266. package/src/functions.ts +31 -2
  267. package/src/hooks/useCheckout.tsx +207 -0
  268. package/src/hooks/useOnramp.tsx +45 -24
  269. package/src/index.tsx +4 -0
  270. package/src/specs/NativeCurrencySelectorElement.ts +35 -0
  271. package/src/specs/NativeEmbeddedPaymentElement.ts +12 -2
  272. package/src/specs/NativeOnrampSdkModule.ts +1 -1
  273. package/src/specs/NativePaymentMethodMessagingElement.ts +0 -7
  274. package/src/specs/NativeStripeSdkModule.ts +61 -2
  275. package/src/types/Checkout.ts +377 -0
  276. package/src/types/EmbeddedPaymentElement.tsx +117 -26
  277. package/src/types/NextAction.ts +9 -0
  278. package/src/types/Onramp.ts +45 -1
  279. package/src/types/PaymentIntent.ts +10 -0
  280. package/src/types/PaymentMethod.ts +9 -6
  281. package/src/types/PaymentSheet.ts +29 -6
  282. package/src/types/components/PaymentMethodMessagingElementComponent.tsx +17 -1
  283. package/stripe-react-native.podspec +8 -8
  284. package/android/spotless.gradle +0 -19
  285. package/android/src/main/java/com/reactnativestripesdk/FakeOnrampSdkModule.kt +0 -155
@@ -0,0 +1,377 @@
1
+ /**
2
+ * All types for the Checkout Session API.
3
+ * @internal
4
+ */
5
+ export namespace Checkout {
6
+ /**
7
+ * Configuration options for a `useCheckout` instance.
8
+ * @internal
9
+ */
10
+ export interface Configuration {
11
+ /**
12
+ * Controls whether adaptive pricing is requested for this session.
13
+ *
14
+ * When allowed, Stripe may present prices in the customer's local
15
+ * currency alongside the merchant's settlement currency.
16
+ *
17
+ * Default: `{ allowed: false }`.
18
+ */
19
+ adaptivePricing?: AdaptivePricing;
20
+ }
21
+
22
+ /**
23
+ * Options for adaptive pricing behavior.
24
+ * @internal
25
+ */
26
+ export interface AdaptivePricing {
27
+ /**
28
+ * Whether the integration allows adaptive pricing for this session.
29
+ *
30
+ * Set to `false` to prevent Stripe from activating adaptive pricing even
31
+ * if the Checkout Session is configured for it on the server.
32
+ *
33
+ * Default: `false`.
34
+ */
35
+ allowed: boolean;
36
+ }
37
+
38
+ /**
39
+ * The loading state of the checkout session.
40
+ *
41
+ * Returned as `state` from `useCheckout`. React re-renders automatically
42
+ * whenever the session changes.
43
+ *
44
+ * - `loading` – a mutation or refresh is in flight; `session` is the most
45
+ * recently loaded value and may be stale.
46
+ * - `loaded` – session is current and ready.
47
+ *
48
+ * Before the initial session load completes, `state` is `null`.
49
+ * @internal
50
+ */
51
+ export type State =
52
+ | {
53
+ /**
54
+ * `loading` while a mutation or refresh is in flight.
55
+ *
56
+ * The associated `session` value is the most recently loaded copy and
57
+ * may be stale.
58
+ */
59
+ status: 'loading';
60
+ /** The most recently loaded session value. */
61
+ session: Session;
62
+ }
63
+ | {
64
+ /** `loaded` when the session is current and ready to use. */
65
+ status: 'loaded';
66
+ /** The latest checkout session value from Stripe. */
67
+ session: Session;
68
+ };
69
+
70
+ /**
71
+ * The status of a checkout session.
72
+ *
73
+ * - `unknown` - A status not recognized by this version of the SDK.
74
+ * - `open` - The checkout session is still in progress.
75
+ * - `complete` - The checkout session is complete.
76
+ * - `expired` - The checkout session has expired.
77
+ * @internal
78
+ */
79
+ export type Status = 'unknown' | 'open' | 'complete' | 'expired';
80
+
81
+ /**
82
+ * The payment status of a checkout session.
83
+ *
84
+ * - `unknown` - A payment status not recognized by this version of the SDK.
85
+ * - `paid` - The payment funds are available in your account.
86
+ * - `unpaid` - The payment funds are not yet available in your account.
87
+ * - `noPaymentRequired` - No payment is currently required for the session.
88
+ * @internal
89
+ */
90
+ export type PaymentStatus =
91
+ | 'unknown'
92
+ | 'paid'
93
+ | 'unpaid'
94
+ | 'noPaymentRequired';
95
+
96
+ /**
97
+ * A read-only snapshot of a Stripe Checkout Session.
98
+ * @internal
99
+ */
100
+ export interface Session {
101
+ /** Unique identifier for this checkout session. */
102
+ id: string;
103
+ /** The current session state, if available. */
104
+ status?: Status;
105
+ /** The payment status for this checkout session. */
106
+ paymentStatus: PaymentStatus;
107
+ /** Three-letter ISO 4217 currency code in lowercase (e.g. `"usd"`). */
108
+ currency?: string;
109
+ /** Indicates whether this session was created in live mode. */
110
+ livemode: boolean;
111
+ /** A summary of monetary totals for this session, if available. */
112
+ totals?: Totals;
113
+ /** The line items purchased by the customer. */
114
+ lineItems: LineItem[];
115
+ /** The shipping rate options available for this session. */
116
+ shippingOptions: ShippingOption[];
117
+ /** The discounts applied to this session. */
118
+ discounts: Discount[];
119
+ /** The Stripe customer ID attached to this session, if any. */
120
+ customerId?: string;
121
+ /** The customer's email address, if available. */
122
+ customerEmail?: string;
123
+ /** The billing address set via `updateBillingAddress`, if any. */
124
+ billingAddress?: AddressUpdate;
125
+ /** The shipping address set via `updateShippingAddress`, if any. */
126
+ shippingAddress?: AddressUpdate;
127
+ }
128
+
129
+ /**
130
+ * Monetary totals for a checkout session.
131
+ *
132
+ * All amounts are in the smallest currency unit (e.g. cents for USD).
133
+ * @internal
134
+ */
135
+ export interface Totals {
136
+ /** The subtotal amount before discounts, shipping, and tax. */
137
+ subtotal: number;
138
+ /** The final total after discounts, shipping, and tax. */
139
+ total: number;
140
+ /** The amount currently due from the customer. */
141
+ due: number;
142
+ /** The total discount amount applied to the session. */
143
+ discount: number;
144
+ /** The total shipping amount. */
145
+ shipping: number;
146
+ /** The total tax amount applied to the session. */
147
+ tax: number;
148
+ }
149
+
150
+ /**
151
+ * A line item in a checkout session.
152
+ * @internal
153
+ */
154
+ export interface LineItem {
155
+ /** Unique identifier for this line item. */
156
+ id: string;
157
+ /** The display name shown for this line item. */
158
+ name: string;
159
+ /** The quantity for this line item. */
160
+ quantity: number;
161
+ /** The per-unit price in the smallest currency unit. */
162
+ unitAmount: number;
163
+ /** Three-letter ISO 4217 currency code in lowercase. */
164
+ currency: string;
165
+ }
166
+
167
+ /**
168
+ * A shipping option available in a checkout session.
169
+ * @internal
170
+ */
171
+ export interface ShippingOption {
172
+ /** The shipping rate identifier. */
173
+ id: string;
174
+ /** The display name shown to the customer. */
175
+ displayName: string;
176
+ /** The shipping amount in the smallest currency unit. */
177
+ amount: number;
178
+ /** Three-letter ISO 4217 currency code in lowercase. */
179
+ currency: string;
180
+ /** The estimated delivery window shown to the customer, if available. */
181
+ deliveryEstimate?: string;
182
+ }
183
+
184
+ /**
185
+ * A discount applied to a checkout session.
186
+ * @internal
187
+ */
188
+ export interface Discount {
189
+ /** The coupon associated with this discount. */
190
+ coupon: Coupon;
191
+ /** The promotion code used to apply this discount, if any. */
192
+ promotionCode?: string;
193
+ /** The discount amount in the smallest currency unit. */
194
+ amount: number;
195
+ }
196
+
197
+ /**
198
+ * A coupon associated with a checkout discount.
199
+ * @internal
200
+ */
201
+ export interface Coupon {
202
+ /** The coupon identifier. */
203
+ id: string;
204
+ /** The display name of the coupon, if one exists. */
205
+ name?: string;
206
+ /** The percentage off, if this is a percentage-based coupon. */
207
+ percentOff?: number;
208
+ /** The fixed amount off, in the smallest currency unit, if applicable. */
209
+ amountOff?: number;
210
+ }
211
+
212
+ /**
213
+ * A locally stored address override for checkout.
214
+ *
215
+ * Address updates are merged into PaymentSheet configuration and may also be
216
+ * sent to Stripe when tax calculation depends on the billing or shipping
217
+ * address.
218
+ * @internal
219
+ */
220
+ export interface AddressUpdate {
221
+ /** The customer's or recipient's name, if provided. */
222
+ name?: string;
223
+ /** The customer's or recipient's phone number, if provided. */
224
+ phone?: string;
225
+ /** The postal address to use for the update. */
226
+ address: Address;
227
+ }
228
+
229
+ /**
230
+ * A postal address used for billing, shipping, or tax updates.
231
+ * @internal
232
+ */
233
+ export interface Address {
234
+ /** The country for this address, such as `"US"`. */
235
+ country: string;
236
+ /** The first address line. */
237
+ line1?: string;
238
+ /** The second address line. */
239
+ line2?: string;
240
+ /** The city, district, suburb, town, or village. */
241
+ city?: string;
242
+ /** The state, county, province, or region. */
243
+ state?: string;
244
+ /** The postal or ZIP code. */
245
+ postalCode?: string;
246
+ }
247
+
248
+ /**
249
+ * A Checkout-specific error returned from `useCheckout` or a Checkout
250
+ * mutation method.
251
+ * @internal
252
+ */
253
+ export interface Error {
254
+ /** A machine-readable error code describing the failure. */
255
+ code: ErrorCode;
256
+ /** A human-readable message describing the failure. */
257
+ message: string;
258
+ }
259
+
260
+ /**
261
+ * The set of Checkout-specific error codes.
262
+ *
263
+ * - `Failed` - The operation could not be completed.
264
+ * - `InvalidClientSecret` - The provided Checkout Session client secret is
265
+ * invalid.
266
+ * - `SessionNotOpen` - The Checkout Session is no longer open for updates.
267
+ * - `SheetCurrentlyPresented` - The operation is unavailable while
268
+ * PaymentSheet is being presented.
269
+ * - `Canceled` - The operation was canceled before completion.
270
+ * @internal
271
+ */
272
+ export type ErrorCode =
273
+ | 'Failed'
274
+ | 'InvalidClientSecret'
275
+ | 'SessionNotOpen'
276
+ | 'SheetCurrentlyPresented'
277
+ | 'Canceled';
278
+ }
279
+
280
+ /**
281
+ * A handle to a live Checkout Session.
282
+ *
283
+ * Returned by `useCheckout`. Call mutation methods to update the session;
284
+ * the hook's `state` updates automatically after each mutation.
285
+ * @internal
286
+ */
287
+ export interface Checkout {
288
+ /** @internal Opaque key for the native Checkout instance. Used by `initPaymentSheet`. */
289
+ readonly sessionKey: string;
290
+
291
+ /**
292
+ * Sets the shipping address for this checkout.
293
+ *
294
+ * The address is stored locally and merged into PaymentSheet configuration
295
+ * when presenting payment UI. If automatic tax is enabled and the tax
296
+ * address source is "shipping", the address is also sent to the server to
297
+ * compute updated tax amounts.
298
+ *
299
+ * @param address - The shipping address to set.
300
+ * @param name - The recipient's name.
301
+ * @param phone - The recipient's phone number.
302
+ */
303
+ updateShippingAddress(
304
+ address: Checkout.Address,
305
+ name?: string,
306
+ phone?: string
307
+ ): Promise<void>;
308
+
309
+ /**
310
+ * Sets the billing address for this checkout.
311
+ *
312
+ * The address is stored locally and merged into PaymentSheet configuration
313
+ * when presenting payment UI. If automatic tax is enabled and the tax
314
+ * address source is "billing", the address is also sent to the server to
315
+ * compute updated tax amounts.
316
+ *
317
+ * @param address - The billing address to set.
318
+ * @param name - The customer's name.
319
+ * @param phone - The customer's phone number.
320
+ */
321
+ updateBillingAddress(
322
+ address: Checkout.Address,
323
+ name?: string,
324
+ phone?: string
325
+ ): Promise<void>;
326
+
327
+ /**
328
+ * Applies a promotion code to the session.
329
+ * - Parameter code: The promotion code to apply (e.g. `"SUMMER2026"`).
330
+ * - Throws: `CheckoutError` if applying the promotion code fails.
331
+ * @internal
332
+ */
333
+ applyPromotionCode(code: string): Promise<void>;
334
+
335
+ /**
336
+ * Removes the currently applied promotion code.
337
+ * - Throws: `CheckoutError` if removing the promotion code fails.
338
+ * @internal
339
+ */
340
+ removePromotionCode(): Promise<void>;
341
+
342
+ /**
343
+ * Updates the quantity of a line item.
344
+ * @param lineItemId - The ID of the line item to update.
345
+ * @param quantity - The new quantity to set.
346
+ * - Throws: `CheckoutError` if updating the line item quantity fails.
347
+ * @internal
348
+ */
349
+ updateLineItemQuantity(lineItemId: string, quantity: number): Promise<void>;
350
+
351
+ /**
352
+ * Selects a shipping option for the session.
353
+ * @param id - The ID of the shipping rate to select.
354
+ * - Throws: `CheckoutError` if selecting the shipping option fails.
355
+ * @internal
356
+ */
357
+ selectShippingOption(id: string): Promise<void>;
358
+
359
+ /**
360
+ * Sets the customer's tax ID on the session.
361
+ * @param type - The tax ID type (e.g. `"eu_vat"`).
362
+ * @param value - The tax ID value (e.g. `"DE123456789"`).
363
+ * - Throws: `CheckoutError` if updating the tax ID fails.
364
+ * @internal
365
+ */
366
+ updateTaxId(type: string, value: string): Promise<void>;
367
+
368
+ /**
369
+ * Refreshes the session by fetching the latest copy from Stripe.
370
+ *
371
+ * Call this after making server-side changes to the Checkout Session
372
+ * so the local state stays in sync.
373
+ * - Throws: `CheckoutError` if refreshing the session fails.
374
+ * @internal
375
+ */
376
+ refresh(): Promise<void>;
377
+ }
@@ -13,6 +13,7 @@ import type {
13
13
  CardBrand,
14
14
  } from './Common';
15
15
  import type { PaymentMethod } from '.';
16
+ import type { Checkout } from './Checkout';
16
17
  import type * as ConfirmationToken from './ConfirmationToken';
17
18
  import * as PaymentSheetTypes from './PaymentSheet';
18
19
  import NativeStripeSdkModule from '../specs/NativeStripeSdkModule';
@@ -222,21 +223,38 @@ export interface EmbeddedPaymentElementConfiguration {
222
223
  opensCardScannerAutomatically?: boolean;
223
224
  }
224
225
 
226
+ // Narrows a value to `Checkout` vs. `IntentConfiguration`.
227
+ const isCheckoutSession = (
228
+ value: PaymentSheetTypes.IntentConfiguration | Checkout
229
+ ): value is Checkout =>
230
+ typeof value === 'object' &&
231
+ value !== null &&
232
+ 'sessionKey' in value &&
233
+ !('mode' in value);
234
+
225
235
  // -----------------------------------------------------------------------------
226
236
  // Embedded API
227
237
  // -----------------------------------------------------------------------------
228
238
 
229
239
  class EmbeddedPaymentElement {
230
240
  /**
231
- * Call this when the intent configuration changes (e.g., amount or currency).
241
+ * Call this when the intent configuration or Checkout Session changes.
232
242
  * Cancels any in-progress update. Ensures the correct payment methods are shown and fields are collected.
233
243
  * If the selected payment option becomes invalid, it may be cleared.
234
244
  * Returns the final result of the update; earlier in-flight updates will return `{ status: 'canceled' }`.
235
245
  */
236
- async update(intentConfig: PaymentSheetTypes.IntentConfiguration) {
237
- const result =
238
- await NativeStripeSdkModule.updateEmbeddedPaymentElement(intentConfig);
239
- return result;
246
+ async updateIntent(
247
+ intentConfig: PaymentSheetTypes.IntentConfiguration
248
+ ): Promise<unknown> {
249
+ return await NativeStripeSdkModule.updateEmbeddedPaymentElement(
250
+ intentConfig
251
+ );
252
+ }
253
+
254
+ async updateCheckout(checkout: Checkout): Promise<unknown> {
255
+ return await NativeStripeSdkModule.updateEmbeddedPaymentElementWithCheckout(
256
+ checkout.sessionKey
257
+ );
240
258
  }
241
259
 
242
260
  /**
@@ -268,21 +286,28 @@ let customPaymentMethodConfirmCallback: EventSubscription | null = null;
268
286
  let rowSelectionCallback: EventSubscription | null = null;
269
287
 
270
288
  async function createEmbeddedPaymentElement(
271
- intentConfig: PaymentSheetTypes.IntentConfiguration,
289
+ intent: PaymentSheetTypes.IntentConfiguration | Checkout,
272
290
  configuration: EmbeddedPaymentElementConfiguration
273
291
  ): Promise<EmbeddedPaymentElement> {
274
- setupConfirmAndSelectionHandlers(intentConfig, configuration);
292
+ setupConfigurationHandlers(configuration);
275
293
 
276
- await NativeStripeSdkModule.createEmbeddedPaymentElement(
277
- intentConfig,
278
- configuration
279
- );
294
+ if (isCheckoutSession(intent)) {
295
+ await NativeStripeSdkModule.createEmbeddedPaymentElementWithCheckout(
296
+ intent.sessionKey,
297
+ configuration
298
+ );
299
+ } else {
300
+ setupIntentConfirmHandlers(intent);
301
+ await NativeStripeSdkModule.createEmbeddedPaymentElement(
302
+ intent,
303
+ configuration
304
+ );
305
+ }
280
306
  return new EmbeddedPaymentElement();
281
307
  }
282
308
 
283
- function setupConfirmAndSelectionHandlers(
284
- intentConfig: PaymentSheetTypes.IntentConfiguration,
285
- configuration: EmbeddedPaymentElementConfiguration
309
+ function setupIntentConfirmHandlers(
310
+ intentConfig: PaymentSheetTypes.IntentConfiguration
286
311
  ) {
287
312
  const confirmHandler = intentConfig.confirmHandler;
288
313
  if (confirmHandler) {
@@ -323,7 +348,11 @@ function setupConfirmAndSelectionHandlers(
323
348
  }
324
349
  );
325
350
  }
351
+ }
326
352
 
353
+ function setupConfigurationHandlers(
354
+ configuration: EmbeddedPaymentElementConfiguration
355
+ ) {
327
356
  if (configuration.formSheetAction?.type === 'confirm') {
328
357
  const confirmFormSheetHandler =
329
358
  configuration.formSheetAction.onFormSheetConfirmComplete;
@@ -409,7 +438,16 @@ export interface UseEmbeddedPaymentElementResult {
409
438
  * @note Upon completion, `paymentOption` may become null if it's no longer available.
410
439
  * @note If you call `update` while a previous call to `update` is still in progress, the previous call is canceled.
411
440
  */
412
- update: (intentConfig: PaymentSheetTypes.IntentConfiguration) => void;
441
+ update: {
442
+ (intentConfig: PaymentSheetTypes.IntentConfiguration): void;
443
+ /**
444
+ * Call this method when the Checkout Session values you used to initialize
445
+ * `EmbeddedPaymentElement` change.
446
+ * @checkoutSessionsPreview
447
+ * @internal
448
+ */
449
+ (checkout: Checkout): void;
450
+ };
413
451
  // Sets the currently selected payment option to null
414
452
  clearPaymentOption: () => void;
415
453
  // Any error encountered during creation/update, or null
@@ -429,6 +467,38 @@ export interface UseEmbeddedPaymentElementResult {
429
467
  export function useEmbeddedPaymentElement(
430
468
  intentConfig: PaymentSheetTypes.IntentConfiguration,
431
469
  configuration: EmbeddedPaymentElementConfiguration
470
+ ): UseEmbeddedPaymentElementResult;
471
+ /**
472
+ * Initializes an `EmbeddedPaymentElement` from a Stripe Checkout Session.
473
+ *
474
+ * Pass a loaded handle from `useCheckout`. Render the consumer in a child
475
+ * component so the hook only runs once `state.status === 'loaded'`.
476
+ *
477
+ * @example
478
+ * function Cart() {
479
+ * const { checkout, state } = useCheckout(clientSecret);
480
+ * if (state?.status !== 'loaded') return null;
481
+ * return <EmbeddedCheckout checkout={checkout} />;
482
+ * }
483
+ *
484
+ * function EmbeddedCheckout({ checkout }: { checkout: Checkout }) {
485
+ * const { embeddedPaymentElementView } =
486
+ * useEmbeddedPaymentElement(checkout, configuration);
487
+ * return embeddedPaymentElementView;
488
+ * }
489
+ *
490
+ * @param checkout - A loaded `Checkout` handle from `useCheckout`.
491
+ * @param configuration - Configuration for the embedded element.
492
+ * @checkoutSessionsPreview
493
+ * @internal
494
+ */
495
+ export function useEmbeddedPaymentElement(
496
+ checkout: Checkout,
497
+ configuration: EmbeddedPaymentElementConfiguration
498
+ ): UseEmbeddedPaymentElementResult;
499
+ export function useEmbeddedPaymentElement(
500
+ intent: PaymentSheetTypes.IntentConfiguration | Checkout,
501
+ configuration: EmbeddedPaymentElementConfiguration
432
502
  ): UseEmbeddedPaymentElementResult {
433
503
  const isAndroid = Platform.OS === 'android';
434
504
  const elementRef = useRef<EmbeddedPaymentElement | null>(null);
@@ -454,12 +524,18 @@ export function useEmbeddedPaymentElement(
454
524
  return ref.current;
455
525
  }
456
526
 
527
+ // Re-key on the session key (Checkout) or intent object so we only
528
+ // recreate the element when the source actually changes.
529
+ const intentKey = isCheckoutSession(intent) ? intent.sessionKey : intent;
530
+ const intentRef = useRef(intent);
531
+ intentRef.current = intent;
532
+
457
533
  // Create embedded payment element
458
534
  useEffect(() => {
459
535
  let active = true;
460
536
  (async () => {
461
537
  const el = await createEmbeddedPaymentElement(
462
- intentConfig,
538
+ intentRef.current,
463
539
  configuration
464
540
  );
465
541
  if (!active) return;
@@ -471,7 +547,7 @@ export function useEmbeddedPaymentElement(
471
547
  elementRef.current = null;
472
548
  setElement(null);
473
549
  };
474
- }, [intentConfig, configuration, viewRef, isAndroid]);
550
+ }, [intentKey, configuration, viewRef, isAndroid]);
475
551
 
476
552
  useEffect(() => {
477
553
  const sub = addListener(
@@ -509,13 +585,19 @@ export function useEmbeddedPaymentElement(
509
585
 
510
586
  // Render the embedded view
511
587
  const embeddedPaymentElementView = useMemo(() => {
512
- if (isAndroid && configuration && intentConfig) {
588
+ // `intentKey` is the session key string for Checkout, the IntentConfiguration object otherwise.
589
+ const intentProps =
590
+ typeof intentKey === 'string'
591
+ ? { checkout: { sessionKey: intentKey } }
592
+ : { intentConfiguration: intentKey };
593
+
594
+ if (isAndroid && configuration && intentKey) {
513
595
  return (
514
596
  <NativeEmbeddedPaymentElement
515
597
  ref={viewRef}
516
598
  style={[{ width: '100%', height: height }]}
517
599
  configuration={configuration}
518
- intentConfiguration={intentConfig}
600
+ {...intentProps}
519
601
  />
520
602
  );
521
603
  }
@@ -525,10 +607,10 @@ export function useEmbeddedPaymentElement(
525
607
  ref={viewRef}
526
608
  style={{ width: '100%', height }}
527
609
  configuration={configuration}
528
- intentConfiguration={intentConfig}
610
+ {...intentProps}
529
611
  />
530
612
  );
531
- }, [configuration, element, height, intentConfig, isAndroid]);
613
+ }, [configuration, element, height, intentKey, isAndroid]);
532
614
 
533
615
  // Other APIs
534
616
  const confirm = useCallback((): Promise<EmbeddedPaymentElementResult> => {
@@ -560,19 +642,25 @@ export function useEmbeddedPaymentElement(
560
642
  return getElementOrThrow(elementRef).confirm();
561
643
  }, [isAndroid]);
562
644
  const update = useCallback(
563
- (cfg: PaymentSheetTypes.IntentConfiguration) => {
645
+ (
646
+ updateSource: PaymentSheetTypes.IntentConfiguration | Checkout
647
+ ): Promise<unknown> => {
564
648
  if (isAndroid) {
565
649
  const currentRef = viewRef.current;
566
650
  if (currentRef) {
567
- return new Promise<{ status: string } | null>((resolve) => {
651
+ return new Promise((resolve) => {
568
652
  const sub = addListener(
569
653
  'embeddedPaymentElementUpdateComplete',
570
- (result: { status: string } | null) => {
654
+ (result) => {
571
655
  sub.remove();
572
656
  resolve(result);
573
657
  }
574
658
  );
575
- Commands.update(currentRef, JSON.stringify(cfg));
659
+ if (isCheckoutSession(updateSource)) {
660
+ Commands.updateWithCheckout(currentRef, updateSource.sessionKey);
661
+ } else {
662
+ Commands.update(currentRef, JSON.stringify(updateSource));
663
+ }
576
664
  });
577
665
  }
578
666
  return Promise.reject(
@@ -581,7 +669,10 @@ export function useEmbeddedPaymentElement(
581
669
  }
582
670
 
583
671
  // iOS: use native module directly
584
- return getElementOrThrow(elementRef).update(cfg);
672
+ const embeddedElement = getElementOrThrow(elementRef);
673
+ return isCheckoutSession(updateSource)
674
+ ? embeddedElement.updateCheckout(updateSource)
675
+ : embeddedElement.updateIntent(updateSource);
585
676
  },
586
677
  [isAndroid]
587
678
  );
@@ -4,6 +4,7 @@ export type NextAction =
4
4
  | WeChatRedirectAction
5
5
  | AlipayRedirectAction
6
6
  | BoletoVoucherAction
7
+ | MultibancoVoucherAction
7
8
  | OxxoVoucherAction;
8
9
 
9
10
  export type VerifyWithMicrodepositsAction = {
@@ -39,6 +40,14 @@ export type KonbiniVoucherAction = {
39
40
  voucherURL: string;
40
41
  };
41
42
 
43
+ export type MultibancoVoucherAction = {
44
+ type: 'multibanco';
45
+ voucherURL: string;
46
+ entity?: string;
47
+ reference?: string;
48
+ expiresAt?: number;
49
+ };
50
+
42
51
  export type OxxoVoucherAction = {
43
52
  type: 'oxxoVoucher';
44
53
  expiration: number;