@stripe/stripe-react-native 0.65.0 → 0.66.0

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 (239) hide show
  1. package/README.md +2 -2
  2. package/android/detekt/detekt-baseline.xml +1 -76
  3. package/android/gradle.properties +4 -4
  4. package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +3 -1
  5. package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormViewManager.kt +2 -1
  6. package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +56 -58
  7. package/android/src/main/java/com/reactnativestripesdk/CurrencySelectorElementEvent.kt +26 -0
  8. package/android/src/main/java/com/reactnativestripesdk/CurrencySelectorElementView.kt +139 -0
  9. package/android/src/main/java/com/reactnativestripesdk/CurrencySelectorElementViewManager.kt +59 -0
  10. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +105 -49
  11. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +72 -12
  12. package/android/src/main/java/com/reactnativestripesdk/EventEmitterCompat.kt +4 -0
  13. package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetManager.kt +8 -4
  14. package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt +2 -1
  15. package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +26 -11
  16. package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherManager.kt +2 -1
  17. package/android/src/main/java/com/reactnativestripesdk/NavigationBarView.kt +14 -5
  18. package/android/src/main/java/com/reactnativestripesdk/PaymentElementConfig.kt +6 -2
  19. package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherManager.kt +2 -1
  20. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +2 -1
  21. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodMessagingElementConfig.kt +6 -2
  22. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodMessagingElementViewManager.kt +2 -1
  23. package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +8 -4
  24. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +9 -3
  25. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetManager.kt +118 -48
  26. package/android/src/main/java/com/reactnativestripesdk/StripeAbstractComposeView.kt +1 -0
  27. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +281 -46
  28. package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +2 -0
  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 +8 -18
  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 +127 -0
  37. package/android/src/main/java/com/reactnativestripesdk/utils/DefaultActivityLifecycleCallbacks.kt +41 -0
  38. package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +4 -2
  39. package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +5 -1
  40. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +29 -13
  41. package/android/src/main/java/com/reactnativestripesdk/utils/PostalCodeUtilities.kt +2 -1
  42. package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerDelegate.java +6 -0
  43. package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerInterface.java +2 -0
  44. package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeCurrencySelectorElementManagerDelegate.java +35 -0
  45. package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeCurrencySelectorElementManagerInterface.java +18 -0
  46. package/android/src/oldarch/java/com/reactnativestripesdk/NativeOnrampSdkModuleSpec.java +17 -3
  47. package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +13 -1
  48. package/android/src/onramp/java/com/reactnativestripesdk/OnrampMappers.kt +116 -0
  49. package/android/src/onramp/java/com/reactnativestripesdk/OnrampSdkModule.kt +109 -1
  50. package/android/src/test/java/com/reactnativestripesdk/DrawableLoadingTest.kt +6 -2
  51. package/android/src/test/java/com/reactnativestripesdk/mappers/MappersTest.kt +60 -0
  52. package/android/src/test/java/com/reactnativestripesdk/mappers/OnrampMappersTest.kt +145 -0
  53. package/android/src/test/java/com/reactnativestripesdk/mappers/PaymentOptionDisplayDataMapperTest.kt +9 -4
  54. package/android/src/test/java/com/reactnativestripesdk/utils/CheckoutMappersTest.kt +98 -0
  55. package/android/src/test/java/com/reactnativestripesdk/utils/CheckoutTestFixtures.java +57 -0
  56. package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewController.swift +6 -8
  57. package/ios/CurrencySelectorElementManager.m +16 -0
  58. package/ios/CurrencySelectorElementView.swift +159 -0
  59. package/ios/EmbeddedPaymentElementView.swift +1 -1
  60. package/ios/Mappers+Checkout.swift +337 -0
  61. package/ios/Mappers.swift +90 -2
  62. package/ios/NewArch/EmbeddedPaymentElementViewComponentView.mm +16 -2
  63. package/ios/NewArch/StripeCurrencySelectorElementComponentView.h +10 -0
  64. package/ios/NewArch/StripeCurrencySelectorElementComponentView.mm +89 -0
  65. package/ios/OldArch/StripeSdkEventEmitterCompat.h +1 -0
  66. package/ios/OldArch/StripeSdkEventEmitterCompat.m +6 -0
  67. package/ios/PaymentOptionDisplayData+ReactNative.swift +1 -1
  68. package/ios/PaymentSheetAppearance.swift +1 -1
  69. package/ios/StripeOnrampSdk.mm +19 -0
  70. package/ios/StripeSdk.mm +136 -0
  71. package/ios/StripeSdkEmitter.swift +1 -0
  72. package/ios/StripeSdkImpl+Checkout.swift +360 -0
  73. package/ios/StripeSdkImpl+CustomerSheet.swift +1 -1
  74. package/ios/StripeSdkImpl+Embedded.swift +108 -27
  75. package/ios/StripeSdkImpl+PaymentSheet.swift +18 -2
  76. package/ios/StripeSdkImpl.swift +89 -7
  77. package/jest/mock.js +13 -1
  78. package/lib/commonjs/components/AddToWalletButton.js +1 -1
  79. package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
  80. package/lib/commonjs/components/AddressSheet.js +1 -1
  81. package/lib/commonjs/components/AddressSheet.js.map +1 -1
  82. package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
  83. package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
  84. package/lib/commonjs/components/CardField.js +1 -1
  85. package/lib/commonjs/components/CardField.js.map +1 -1
  86. package/lib/commonjs/components/CardForm.js +1 -1
  87. package/lib/commonjs/components/CardForm.js.map +1 -1
  88. package/lib/commonjs/components/CurrencySelectorElement.js +2 -0
  89. package/lib/commonjs/components/CurrencySelectorElement.js.map +1 -0
  90. package/lib/commonjs/components/PaymentMethodMessagingElement.js +1 -1
  91. package/lib/commonjs/components/PaymentMethodMessagingElement.js.map +1 -1
  92. package/lib/commonjs/components/PlatformPayButton.js +1 -1
  93. package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
  94. package/lib/commonjs/components/StripeContainer.js +1 -1
  95. package/lib/commonjs/components/StripeContainer.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/events.js.map +1 -1
  107. package/lib/commonjs/functions.js +1 -1
  108. package/lib/commonjs/functions.js.map +1 -1
  109. package/lib/commonjs/helpers.js +1 -1
  110. package/lib/commonjs/hooks/useCheckout.js +1 -1
  111. package/lib/commonjs/hooks/useCheckout.js.map +1 -1
  112. package/lib/commonjs/hooks/useOnramp.js +1 -1
  113. package/lib/commonjs/hooks/useOnramp.js.map +1 -1
  114. package/lib/commonjs/specs/NativeAddToWalletButton.js +1 -1
  115. package/lib/commonjs/specs/NativeAddressSheet.js +1 -1
  116. package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
  117. package/lib/commonjs/specs/NativeAuBECSDebitForm.js +1 -1
  118. package/lib/commonjs/specs/NativeCardField.js +1 -1
  119. package/lib/commonjs/specs/NativeCardField.js.map +1 -1
  120. package/lib/commonjs/specs/NativeCardForm.js +1 -1
  121. package/lib/commonjs/specs/NativeCardForm.js.map +1 -1
  122. package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js +1 -1
  123. package/lib/commonjs/specs/NativeCurrencySelectorElement.js +2 -0
  124. package/lib/commonjs/specs/NativeCurrencySelectorElement.js.map +1 -0
  125. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +1 -1
  126. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -1
  127. package/lib/commonjs/specs/NativeGooglePayButton.js +1 -1
  128. package/lib/commonjs/specs/NativeNavigationBar.js +1 -1
  129. package/lib/commonjs/specs/NativeOnrampSdkModule.js.map +1 -1
  130. package/lib/commonjs/specs/NativePaymentMethodMessagingElement.js +1 -1
  131. package/lib/commonjs/specs/NativeStripeContainer.js +1 -1
  132. package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
  133. package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
  134. package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
  135. package/lib/module/components/AddToWalletButton.js +1 -1
  136. package/lib/module/components/AddToWalletButton.js.map +1 -1
  137. package/lib/module/components/AddressSheet.js +1 -1
  138. package/lib/module/components/AddressSheet.js.map +1 -1
  139. package/lib/module/components/AuBECSDebitForm.js +1 -1
  140. package/lib/module/components/AuBECSDebitForm.js.map +1 -1
  141. package/lib/module/components/CardField.js +1 -1
  142. package/lib/module/components/CardField.js.map +1 -1
  143. package/lib/module/components/CardForm.js +1 -1
  144. package/lib/module/components/CardForm.js.map +1 -1
  145. package/lib/module/components/CurrencySelectorElement.js +2 -0
  146. package/lib/module/components/CurrencySelectorElement.js.map +1 -0
  147. package/lib/module/components/PaymentMethodMessagingElement.js +1 -1
  148. package/lib/module/components/PaymentMethodMessagingElement.js.map +1 -1
  149. package/lib/module/components/PlatformPayButton.js +1 -1
  150. package/lib/module/components/PlatformPayButton.js.map +1 -1
  151. package/lib/module/components/StripeContainer.js +1 -1
  152. package/lib/module/components/StripeContainer.js.map +1 -1
  153. package/lib/module/connect/Components.js +1 -1
  154. package/lib/module/connect/Components.js.map +1 -1
  155. package/lib/module/connect/ConnectComponentsProvider.js +1 -1
  156. package/lib/module/connect/ConnectComponentsProvider.js.map +1 -1
  157. package/lib/module/connect/EmbeddedComponent.js +1 -1
  158. package/lib/module/connect/EmbeddedComponent.js.map +1 -1
  159. package/lib/module/connect/ModalCloseButton.js +1 -1
  160. package/lib/module/connect/ModalCloseButton.js.map +1 -1
  161. package/lib/module/connect/NavigationBar.js +1 -1
  162. package/lib/module/connect/NavigationBar.js.map +1 -1
  163. package/lib/module/events.js.map +1 -1
  164. package/lib/module/functions.js +1 -1
  165. package/lib/module/functions.js.map +1 -1
  166. package/lib/module/helpers.js +1 -1
  167. package/lib/module/hooks/useCheckout.js +1 -1
  168. package/lib/module/hooks/useCheckout.js.map +1 -1
  169. package/lib/module/hooks/useOnramp.js +1 -1
  170. package/lib/module/hooks/useOnramp.js.map +1 -1
  171. package/lib/module/specs/NativeAddToWalletButton.js +1 -1
  172. package/lib/module/specs/NativeAddressSheet.js +1 -1
  173. package/lib/module/specs/NativeApplePayButton.js +1 -1
  174. package/lib/module/specs/NativeAuBECSDebitForm.js +1 -1
  175. package/lib/module/specs/NativeCardField.js +1 -1
  176. package/lib/module/specs/NativeCardField.js.map +1 -1
  177. package/lib/module/specs/NativeCardForm.js +1 -1
  178. package/lib/module/specs/NativeCardForm.js.map +1 -1
  179. package/lib/module/specs/NativeConnectAccountOnboardingView.js +1 -1
  180. package/lib/module/specs/NativeCurrencySelectorElement.js +2 -0
  181. package/lib/module/specs/NativeCurrencySelectorElement.js.map +1 -0
  182. package/lib/module/specs/NativeEmbeddedPaymentElement.js +1 -1
  183. package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -1
  184. package/lib/module/specs/NativeGooglePayButton.js +1 -1
  185. package/lib/module/specs/NativeNavigationBar.js +1 -1
  186. package/lib/module/specs/NativeOnrampSdkModule.js.map +1 -1
  187. package/lib/module/specs/NativePaymentMethodMessagingElement.js +1 -1
  188. package/lib/module/specs/NativeStripeContainer.js +1 -1
  189. package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
  190. package/lib/module/types/EmbeddedPaymentElement.js +1 -1
  191. package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
  192. package/lib/typescript/src/components/CurrencySelectorElement.d.ts +62 -0
  193. package/lib/typescript/src/components/CurrencySelectorElement.d.ts.map +1 -0
  194. package/lib/typescript/src/components/PaymentMethodMessagingElement.d.ts +1 -1
  195. package/lib/typescript/src/components/PaymentMethodMessagingElement.d.ts.map +1 -1
  196. package/lib/typescript/src/events.d.ts +11 -0
  197. package/lib/typescript/src/events.d.ts.map +1 -1
  198. package/lib/typescript/src/functions.d.ts.map +1 -1
  199. package/lib/typescript/src/hooks/useCheckout.d.ts.map +1 -1
  200. package/lib/typescript/src/hooks/useOnramp.d.ts +22 -0
  201. package/lib/typescript/src/hooks/useOnramp.d.ts.map +1 -1
  202. package/lib/typescript/src/specs/NativeCurrencySelectorElement.d.ts +25 -0
  203. package/lib/typescript/src/specs/NativeCurrencySelectorElement.d.ts.map +1 -0
  204. package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts +5 -1
  205. package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts.map +1 -1
  206. package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts +3 -0
  207. package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts.map +1 -1
  208. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +5 -2
  209. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
  210. package/lib/typescript/src/types/Checkout.d.ts +268 -86
  211. package/lib/typescript/src/types/Checkout.d.ts.map +1 -1
  212. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +36 -1
  213. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
  214. package/lib/typescript/src/types/Onramp.d.ts +94 -0
  215. package/lib/typescript/src/types/Onramp.d.ts.map +1 -1
  216. package/package.json +16 -4
  217. package/src/components/CurrencySelectorElement.tsx +95 -0
  218. package/src/components/PaymentMethodMessagingElement.tsx +54 -52
  219. package/src/events.ts +11 -0
  220. package/src/functions.ts +30 -1
  221. package/src/hooks/useCheckout.tsx +129 -74
  222. package/src/hooks/useOnramp.tsx +44 -0
  223. package/src/specs/NativeCurrencySelectorElement.ts +35 -0
  224. package/src/specs/NativeEmbeddedPaymentElement.ts +12 -2
  225. package/src/specs/NativeOnrampSdkModule.ts +5 -0
  226. package/src/specs/NativeStripeSdkModule.ts +16 -2
  227. package/src/types/Checkout.ts +291 -86
  228. package/src/types/EmbeddedPaymentElement.tsx +117 -26
  229. package/src/types/Onramp.ts +109 -0
  230. package/stripe-react-native.podspec +1 -1
  231. package/android/.idea/AndroidProjectSystem.xml +0 -6
  232. package/android/.idea/caches/deviceStreaming.xml +0 -835
  233. package/android/.idea/compiler.xml +0 -6
  234. package/android/.idea/gradle.xml +0 -17
  235. package/android/.idea/migrations.xml +0 -10
  236. package/android/.idea/misc.xml +0 -10
  237. package/android/.idea/runConfigurations.xml +0 -17
  238. package/android/.idea/vcs.xml +0 -6
  239. package/android/local.properties +0 -8
@@ -0,0 +1,35 @@
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
3
+ import type {
4
+ DirectEventHandler,
5
+ Double,
6
+ WithDefault,
7
+ } from 'react-native/Libraries/Types/CodegenTypes';
8
+
9
+ export interface HeightChangeEvent {
10
+ height: Double;
11
+ }
12
+
13
+ export interface NativeProps extends ViewProps {
14
+ /**
15
+ * Opaque key returned by `useCheckout`. The native side uses this to look
16
+ * up the matching `Checkout` instance and observe its state — there's no
17
+ * separate session-update event from this view, since `useCheckout`
18
+ * already subscribes to a single `checkoutSessionDidChangeState` channel
19
+ * that mirrors every native-driven mutation back into JS.
20
+ */
21
+ sessionKey: string;
22
+
23
+ /** When true, the toggle is visible but ignores user interaction. */
24
+ disabled?: WithDefault<boolean, false>;
25
+
26
+ /**
27
+ * Fired whenever the element's intrinsic height changes so the RN
28
+ * layout system can update the containing view.
29
+ */
30
+ onHeightChange?: DirectEventHandler<HeightChangeEvent>;
31
+ }
32
+
33
+ export default codegenNativeComponent<NativeProps>(
34
+ 'StripeCurrencySelectorElement'
35
+ ) as HostComponent<NativeProps>;
@@ -7,7 +7,8 @@ import type { UnsafeMixed } from './utils';
7
7
 
8
8
  export interface NativeProps extends ViewProps {
9
9
  configuration: UnsafeMixed<EmbeddedPaymentElementConfiguration>;
10
- intentConfiguration: UnsafeMixed<IntentConfiguration>;
10
+ intentConfiguration?: UnsafeMixed<IntentConfiguration>;
11
+ checkout?: UnsafeMixed<{ sessionKey: string }>;
11
12
  }
12
13
 
13
14
  export interface NativeCommands {
@@ -19,10 +20,19 @@ export interface NativeCommands {
19
20
  viewRef: React.ElementRef<HostComponent<NativeProps>>,
20
21
  intentConfigurationJson: string
21
22
  ) => void;
23
+ updateWithCheckout: (
24
+ viewRef: React.ElementRef<HostComponent<NativeProps>>,
25
+ sessionKey: string
26
+ ) => void;
22
27
  }
23
28
 
24
29
  export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
25
- supportedCommands: ['confirm', 'clearPaymentOption', 'update'],
30
+ supportedCommands: [
31
+ 'confirm',
32
+ 'clearPaymentOption',
33
+ 'update',
34
+ 'updateWithCheckout',
35
+ ],
26
36
  });
27
37
 
28
38
  type ComponentType = HostComponent<NativeProps>;
@@ -19,6 +19,11 @@ export interface Spec extends TurboModule {
19
19
  attachKycInfo(
20
20
  kycInfo: UnsafeObject<Onramp.KycInfo>
21
21
  ): Promise<Onramp.VoidResult>;
22
+ retrieveMissingIdentifiers(): Promise<Onramp.RetrieveMissingIdentifiersResult>;
23
+ submitIdentifiers(
24
+ identifiers: ReadonlyArray<UnsafeObject<Onramp.ComplianceIdentifier>>
25
+ ): Promise<Onramp.SubmitIdentifiersResult>;
26
+ presentCRSCARFDeclaration(): Promise<Onramp.CRSCARFDeclarationResult>;
22
27
  presentKycInfoVerification: (
23
28
  updatedAddress: UnsafeObject<Address> | null
24
29
  ) => Promise<Onramp.VerifyKycResult>;
@@ -199,12 +199,19 @@ export interface Spec extends TurboModule {
199
199
  intentConfig: UnsafeObject<IntentConfiguration>,
200
200
  configuration: UnsafeObject<EmbeddedPaymentElementConfiguration>
201
201
  ): Promise<void>;
202
+ createEmbeddedPaymentElementWithCheckout(
203
+ sessionKey: string,
204
+ configuration: UnsafeObject<EmbeddedPaymentElementConfiguration>
205
+ ): Promise<void>;
202
206
  confirmEmbeddedPaymentElement(
203
207
  viewTag: Int32
204
208
  ): Promise<EmbeddedPaymentElementResult>;
205
209
  updateEmbeddedPaymentElement(
206
210
  intentConfig: UnsafeObject<IntentConfiguration>
207
- ): Promise<void>;
211
+ ): Promise<UnsafeObject<any> | null>;
212
+ updateEmbeddedPaymentElementWithCheckout(
213
+ sessionKey: string
214
+ ): Promise<UnsafeObject<any> | null>;
208
215
  clearEmbeddedPaymentOption(viewTag: Int32): Promise<void>;
209
216
  createRadarSession(): Promise<CreateRadarSessionResult>;
210
217
 
@@ -255,7 +262,14 @@ export interface Spec extends TurboModule {
255
262
  value: string
256
263
  ): Promise<UnsafeObject<Checkout.State>>;
257
264
 
258
- checkoutRefresh(sessionKey: string): Promise<UnsafeObject<Checkout.State>>;
265
+ checkoutRunServerUpdateStart(
266
+ sessionKey: string
267
+ ): Promise<UnsafeObject<Checkout.State>>;
268
+
269
+ checkoutRunServerUpdateComplete(
270
+ sessionKey: string,
271
+ error: string | null
272
+ ): Promise<void>;
259
273
 
260
274
  setFinancialConnectionsForceNativeFlow(enabled: boolean): Promise<void>;
261
275
 
@@ -14,7 +14,7 @@ export namespace Checkout {
14
14
  * When allowed, Stripe may present prices in the customer's local
15
15
  * currency alongside the merchant's settlement currency.
16
16
  *
17
- * Default: `{ allowed: true }`.
17
+ * Default: `{ allowed: false }`.
18
18
  */
19
19
  adaptivePricing?: AdaptivePricing;
20
20
  }
@@ -30,7 +30,7 @@ export namespace Checkout {
30
30
  * Set to `false` to prevent Stripe from activating adaptive pricing even
31
31
  * if the Checkout Session is configured for it on the server.
32
32
  *
33
- * Default: `true`.
33
+ * Default: `false`.
34
34
  */
35
35
  allowed: boolean;
36
36
  }
@@ -67,16 +67,81 @@ export namespace Checkout {
67
67
  session: Session;
68
68
  };
69
69
 
70
+ /**
71
+ * A Stripe Checkout Session.
72
+ * @checkoutSessionsPreview
73
+ * @internal
74
+ */
75
+ export interface Session {
76
+ /** Unique identifier for this checkout session. */
77
+ id: string;
78
+ /** The business name as configured in your Stripe account. */
79
+ businessName?: string;
80
+ /** Three-letter ISO 4217 currency code in lowercase (e.g. `"usd"`). */
81
+ currency?: string;
82
+ /** Currency options available when adaptive pricing is active. */
83
+ currencyOptions: CurrencyOption[];
84
+ /** The aggregate amounts calculated per discount for all line items. */
85
+ discountAmounts: DiscountAmount[];
86
+ /** The customer's email address, if available. */
87
+ email?: string;
88
+ /** The line items the customer is purchasing. */
89
+ lineItems: LineItem[];
90
+ /** Indicates whether this session was created in live mode. */
91
+ livemode: boolean;
92
+ /** The factor used to convert between minor and major currency units. */
93
+ minorUnitsAmountDivisor?: number;
94
+ /** The selected shipping option, if any. */
95
+ shipping?: SelectedShipping;
96
+ /** The shipping address set via `updateShippingAddress`, if any. */
97
+ shippingAddress?: ContactAddress;
98
+ /** The shipping rate options available for this session. */
99
+ shippingOptions: ShippingOption[];
100
+ /** The current session status, if available. */
101
+ status?: Status;
102
+ /** Tax computation status and aggregated tax amounts. */
103
+ tax: Tax;
104
+ /** Tax and discount details for the computed total amount. */
105
+ total?: Total;
106
+ /** The billing address set via `updateBillingAddress`, if any. */
107
+ billingAddress?: ContactAddress;
108
+ }
109
+
110
+ /**
111
+ * The mode of a checkout session.
112
+ *
113
+ * - `unknown` - A mode not recognized by this version of the SDK.
114
+ * - `payment` - Accept one-time payments.
115
+ * - `setup` - Save payment details to charge later.
116
+ * - `subscription` - Set up fixed-price subscriptions.
117
+ * @checkoutSessionsPreview
118
+ * @internal
119
+ */
120
+ export type Mode = 'unknown' | 'payment' | 'setup' | 'subscription';
121
+
70
122
  /**
71
123
  * The status of a checkout session.
124
+ * @checkoutSessionsPreview
125
+ * @internal
126
+ */
127
+ export interface Status {
128
+ /** The lifecycle status of the session. */
129
+ type: StatusType;
130
+ /** The payment status. Only meaningful when type is `complete`. */
131
+ paymentStatus?: PaymentStatus;
132
+ }
133
+
134
+ /**
135
+ * The lifecycle status of a checkout session.
72
136
  *
73
137
  * - `unknown` - A status not recognized by this version of the SDK.
74
138
  * - `open` - The checkout session is still in progress.
75
139
  * - `complete` - The checkout session is complete.
76
140
  * - `expired` - The checkout session has expired.
141
+ * @checkoutSessionsPreview
77
142
  * @internal
78
143
  */
79
- export type Status = 'unknown' | 'open' | 'complete' | 'expired';
144
+ export type StatusType = 'unknown' | 'open' | 'complete' | 'expired';
80
145
 
81
146
  /**
82
147
  * The payment status of a checkout session.
@@ -85,6 +150,7 @@ export namespace Checkout {
85
150
  * - `paid` - The payment funds are available in your account.
86
151
  * - `unpaid` - The payment funds are not yet available in your account.
87
152
  * - `noPaymentRequired` - No payment is currently required for the session.
153
+ * @checkoutSessionsPreview
88
154
  * @internal
89
155
  */
90
156
  export type PaymentStatus =
@@ -94,61 +160,102 @@ export namespace Checkout {
94
160
  | 'noPaymentRequired';
95
161
 
96
162
  /**
97
- * A read-only snapshot of a Stripe Checkout Session.
163
+ * A monetary amount with both a localized display string and a value in
164
+ * the smallest currency unit (e.g. cents).
165
+ * @checkoutSessionsPreview
98
166
  * @internal
99
167
  */
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;
168
+ export interface Amount {
169
+ /** Localized, formatted string including currency symbol (e.g. `"$10.00"`). */
170
+ amount: string;
171
+ /** Value in the smallest currency unit (e.g. cents for USD). */
172
+ minorUnitsAmount: number;
173
+ }
174
+
175
+ /**
176
+ * A monetary amount supporting sub-minor-unit precision.
177
+ *
178
+ * Use this for sub-cent pricing (e.g. usage-based billing) where rounding
179
+ * to the nearest minor unit would lose precision.
180
+ * @checkoutSessionsPreview
181
+ * @internal
182
+ */
183
+ export interface DecimalAmount {
184
+ /** Localized, formatted string including currency symbol. */
185
+ amount: string;
186
+ /** Value in the smallest currency unit, with decimal precision. */
187
+ minorUnitsAmount: number;
188
+ }
189
+
190
+ /**
191
+ * Tax and discount details for the computed total amount of a checkout session.
192
+ * @checkoutSessionsPreview
193
+ * @internal
194
+ */
195
+ export interface Total {
196
+ /** Total of all line items, excluding tax, discounts, and shipping. */
197
+ subtotal: Amount;
198
+ /** Sum of all exclusive tax amounts. */
199
+ taxExclusive: Amount;
200
+ /** Sum of all inclusive tax amounts. */
201
+ taxInclusive: Amount;
202
+ /** Sum of all shipping amounts. */
203
+ shippingRate: Amount;
204
+ /** Sum of all discounts. A positive number reduces the amount to be paid. */
205
+ discount: Amount;
206
+ /** Grand total, including discounts and tax. */
207
+ total: Amount;
208
+ /** Amount of customer credit balance applied to the payment. */
209
+ appliedBalance: Amount;
210
+ /** When `true`, no payment is collected and the amount is added to the next invoice. */
211
+ balanceAppliedToNextInvoice: boolean;
127
212
  }
128
213
 
129
214
  /**
130
- * Monetary totals for a checkout session.
215
+ * Tax computation status and aggregated tax amounts for a checkout session.
216
+ * @checkoutSessionsPreview
217
+ * @internal
218
+ */
219
+ export interface Tax {
220
+ /** The current tax computation status. */
221
+ status: TaxStatus;
222
+ /** Per-tax-rate amounts, or undefined if tax has not been computed. */
223
+ taxAmounts?: TaxAmount[];
224
+ }
225
+
226
+ /**
227
+ * The tax computation status of a checkout session.
131
228
  *
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;
229
+ * - `unknown` - A status not recognized by this version of the SDK.
230
+ * - `ready` - Tax is computed and the session is ready for confirmation.
231
+ * - `requiresShippingAddress` - A shipping address is needed to calculate tax.
232
+ * - `requiresBillingAddress` - A billing address is needed to calculate tax.
233
+ * @checkoutSessionsPreview
234
+ * @internal
235
+ */
236
+ export type TaxStatus =
237
+ | 'unknown'
238
+ | 'ready'
239
+ | 'requiresShippingAddress'
240
+ | 'requiresBillingAddress';
241
+
242
+ /**
243
+ * A tax amount calculated for a line item, shipping option, or aggregate session total.
244
+ * @checkoutSessionsPreview
245
+ * @internal
246
+ */
247
+ export interface TaxAmount {
248
+ /** The tax amount. */
249
+ amount: Amount;
250
+ /** Whether this tax is inclusive (already in subtotal) or exclusive (added on top). */
251
+ inclusive: boolean;
252
+ /** A user-facing description (e.g. `"Sales Tax"` or `"VAT 20%"`). */
253
+ displayName: string;
148
254
  }
149
255
 
150
256
  /**
151
257
  * A line item in a checkout session.
258
+ * @checkoutSessionsPreview
152
259
  * @internal
153
260
  */
154
261
  export interface LineItem {
@@ -156,78 +263,172 @@ export namespace Checkout {
156
263
  id: string;
157
264
  /** The display name shown for this line item. */
158
265
  name: string;
159
- /** The quantity for this line item. */
266
+ /** An optional, merchant-supplied description. */
267
+ description?: string;
268
+ /** Image URLs configured on the underlying product. */
269
+ images: string[];
270
+ /** The quantity of items being purchased. */
160
271
  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;
272
+ /** The cost of a single unit. */
273
+ unitAmount?: Amount;
274
+ /** The unit amount with sub-cent precision. */
275
+ unitAmountDecimal?: DecimalAmount;
276
+ /** Total before any discounts or exclusive taxes. */
277
+ subtotal?: Amount;
278
+ /** Total discount amount for this line item. */
279
+ discount?: Amount;
280
+ /** Total exclusive tax for this line item. */
281
+ taxExclusive?: Amount;
282
+ /** Total inclusive tax for this line item. */
283
+ taxInclusive?: Amount;
284
+ /** Final total for this line item, including discounts and tax. */
285
+ total?: Amount;
286
+ /** Per-discount breakdown for this line item. */
287
+ discountAmounts: DiscountAmount[];
288
+ /** Per-tax-rate breakdown for this line item. */
289
+ taxAmounts: TaxAmount[];
290
+ /** Configuration for adjustable quantity, if enabled. */
291
+ adjustableQuantity?: AdjustableQuantity;
292
+ }
293
+
294
+ /**
295
+ * Configuration for a customer-adjustable line item quantity.
296
+ * @checkoutSessionsPreview
297
+ * @internal
298
+ */
299
+ export interface AdjustableQuantity {
300
+ /** The minimum quantity the customer can purchase. */
301
+ minimum: number;
302
+ /** The maximum quantity the customer can purchase. */
303
+ maximum: number;
165
304
  }
166
305
 
167
306
  /**
168
307
  * A shipping option available in a checkout session.
308
+ * @checkoutSessionsPreview
169
309
  * @internal
170
310
  */
171
311
  export interface ShippingOption {
172
312
  /** The shipping rate identifier. */
173
313
  id: string;
174
314
  /** The display name shown to the customer. */
175
- displayName: string;
176
- /** The shipping amount in the smallest currency unit. */
177
- amount: number;
315
+ displayName?: string;
316
+ /** The shipping cost. */
317
+ amount: Amount;
178
318
  /** Three-letter ISO 4217 currency code in lowercase. */
179
319
  currency: string;
180
- /** The estimated delivery window shown to the customer, if available. */
181
- deliveryEstimate?: string;
320
+ /** The estimated delivery window, if available. */
321
+ deliveryEstimate?: DeliveryEstimate;
322
+ }
323
+
324
+ /**
325
+ * The estimated delivery range for a shipping option.
326
+ * @checkoutSessionsPreview
327
+ * @internal
328
+ */
329
+ export interface DeliveryEstimate {
330
+ /** The lower bound of the delivery estimate. */
331
+ minimum?: DeliveryEstimateBound;
332
+ /** The upper bound of the delivery estimate. */
333
+ maximum?: DeliveryEstimateBound;
182
334
  }
183
335
 
184
336
  /**
185
- * A discount applied to a checkout session.
337
+ * A bound (minimum or maximum) of a delivery estimate.
338
+ * @checkoutSessionsPreview
186
339
  * @internal
187
340
  */
188
- export interface Discount {
189
- /** The coupon associated with this discount. */
190
- coupon: Coupon;
341
+ export interface DeliveryEstimateBound {
342
+ /** The unit of time. */
343
+ unit: DeliveryEstimateUnit;
344
+ /** The number of units. */
345
+ value: number;
346
+ }
347
+
348
+ /**
349
+ * The unit of time for a delivery estimate.
350
+ * @checkoutSessionsPreview
351
+ * @internal
352
+ */
353
+ export type DeliveryEstimateUnit =
354
+ | 'unknown'
355
+ | 'hour'
356
+ | 'day'
357
+ | 'businessDay'
358
+ | 'week'
359
+ | 'month';
360
+
361
+ /**
362
+ * The shipping option selected for a checkout session, plus any computed
363
+ * shipping tax.
364
+ * @checkoutSessionsPreview
365
+ * @internal
366
+ */
367
+ export interface SelectedShipping {
368
+ /** The selected shipping option. */
369
+ shippingOption: ShippingOption;
370
+ /** Tax amounts calculated for the shipping cost. */
371
+ taxAmounts: TaxAmount[];
372
+ }
373
+
374
+ /**
375
+ * A discount applied to a checkout session or line item.
376
+ * @checkoutSessionsPreview
377
+ * @internal
378
+ */
379
+ export interface DiscountAmount {
380
+ /** The discount amount. A positive number reduces the amount to be paid. */
381
+ amount: Amount;
382
+ /** A user-facing description of the discount. */
383
+ displayName: string;
191
384
  /** The promotion code used to apply this discount, if any. */
192
385
  promotionCode?: string;
193
- /** The discount amount in the smallest currency unit. */
194
- amount: number;
195
386
  }
196
387
 
197
388
  /**
198
- * A coupon associated with a checkout discount.
389
+ * A currency option available on a checkout session when adaptive pricing
390
+ * is active.
391
+ * @checkoutSessionsPreview
199
392
  * @internal
200
393
  */
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;
394
+ export interface CurrencyOption {
395
+ /** The total amount in this currency. */
396
+ amount: Amount;
397
+ /** Three-letter ISO 4217 currency code in lowercase. */
398
+ currency: string;
399
+ /** Conversion details, present only for the customer's local currency. */
400
+ currencyConversion?: CurrencyConversion;
210
401
  }
211
402
 
212
403
  /**
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.
404
+ * Currency conversion details for an adaptive-pricing currency option.
405
+ * @checkoutSessionsPreview
218
406
  * @internal
219
407
  */
220
- export interface AddressUpdate {
408
+ export interface CurrencyConversion {
409
+ /** The exchange rate used to convert source to customer currency. */
410
+ fxRate: string;
411
+ /** The merchant's original currency (three-letter ISO 4217 code). */
412
+ sourceCurrency: string;
413
+ }
414
+
415
+ /**
416
+ * A contact address containing a name, phone, and postal address.
417
+ * @checkoutSessionsPreview
418
+ * @internal
419
+ */
420
+ export interface ContactAddress {
221
421
  /** The customer's or recipient's name, if provided. */
222
422
  name?: string;
223
423
  /** The customer's or recipient's phone number, if provided. */
224
424
  phone?: string;
225
- /** The postal address to use for the update. */
425
+ /** The postal address. */
226
426
  address: Address;
227
427
  }
228
428
 
229
429
  /**
230
430
  * A postal address used for billing, shipping, or tax updates.
431
+ * @checkoutSessionsPreview
231
432
  * @internal
232
433
  */
233
434
  export interface Address {
@@ -366,12 +567,16 @@ export interface Checkout {
366
567
  updateTaxId(type: string, value: string): Promise<void>;
367
568
 
368
569
  /**
369
- * Refreshes the session by fetching the latest copy from Stripe.
570
+ * Runs an async operation that updates the Checkout Session on your server,
571
+ * then automatically refreshes the local session state.
572
+ *
573
+ * Call your server inside `serverUpdate` to modify the Checkout Session.
574
+ * A 20-second timeout is enforced by the native SDK.
370
575
  *
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.
576
+ * @param serverUpdate - An async function that calls your server to update the session.
577
+ * - Throws: `CheckoutError` if the operation times out or fails.
578
+ * @checkoutSessionsPreview
374
579
  * @internal
375
580
  */
376
- refresh(): Promise<void>;
581
+ runServerUpdate(serverUpdate: () => Promise<void>): Promise<void>;
377
582
  }