@stripe/stripe-react-native 0.52.0-crypto-onramp-2-private-beta.2 → 0.53.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 (175) hide show
  1. package/android/.idea/caches/deviceStreaming.xml +0 -13
  2. package/android/.idea/gradle.xml +1 -0
  3. package/android/.idea/misc.xml +1 -1
  4. package/android/build.gradle +0 -14
  5. package/android/gradle.properties +1 -1
  6. package/android/local.properties +2 -2
  7. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +48 -25
  8. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +2 -0
  9. package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +1 -1
  10. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +14 -13
  11. package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +1 -19
  12. package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +0 -10
  13. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +3 -12
  14. package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerDelegate.java +0 -12
  15. package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerInterface.java +0 -4
  16. package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +4 -4
  17. package/ios/Mappers.swift +1 -134
  18. package/ios/OldArch/StripeSdkEventEmitterCompat.h +0 -1
  19. package/ios/OldArch/StripeSdkEventEmitterCompat.m +1 -7
  20. package/ios/StripeSdk.mm +7 -0
  21. package/ios/StripeSdkEmitter.swift +0 -4
  22. package/ios/StripeSdkImpl.swift +13 -584
  23. package/lib/commonjs/components/AddToWalletButton.js +1 -1
  24. package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
  25. package/lib/commonjs/components/AddressSheet.js +1 -1
  26. package/lib/commonjs/components/AddressSheet.js.map +1 -1
  27. package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
  28. package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
  29. package/lib/commonjs/components/CardField.js +1 -1
  30. package/lib/commonjs/components/CardField.js.map +1 -1
  31. package/lib/commonjs/components/CardForm.js +1 -1
  32. package/lib/commonjs/components/CardForm.js.map +1 -1
  33. package/lib/commonjs/components/PlatformPayButton.js +1 -1
  34. package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
  35. package/lib/commonjs/components/StripeContainer.js +1 -1
  36. package/lib/commonjs/components/StripeContainer.js.map +1 -1
  37. package/lib/commonjs/components/StripeProvider.js +1 -1
  38. package/lib/commonjs/components/StripeProvider.js.map +1 -1
  39. package/lib/commonjs/events.js +1 -1
  40. package/lib/commonjs/events.js.map +1 -1
  41. package/lib/commonjs/functions.js +1 -1
  42. package/lib/commonjs/functions.js.map +1 -1
  43. package/lib/commonjs/index.js +1 -1
  44. package/lib/commonjs/index.js.map +1 -1
  45. package/lib/commonjs/plugin/withStripe.js +1 -1
  46. package/lib/commonjs/plugin/withStripe.js.map +1 -1
  47. package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
  48. package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
  49. package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
  50. package/lib/commonjs/types/Errors.js +1 -1
  51. package/lib/commonjs/types/Errors.js.map +1 -1
  52. package/lib/commonjs/types/PlatformPay.js.map +1 -1
  53. package/lib/commonjs/types/index.js +1 -1
  54. package/lib/commonjs/types/index.js.map +1 -1
  55. package/lib/module/components/AddToWalletButton.js +1 -1
  56. package/lib/module/components/AddToWalletButton.js.map +1 -1
  57. package/lib/module/components/AddressSheet.js +1 -1
  58. package/lib/module/components/AddressSheet.js.map +1 -1
  59. package/lib/module/components/AuBECSDebitForm.js +1 -1
  60. package/lib/module/components/AuBECSDebitForm.js.map +1 -1
  61. package/lib/module/components/CardField.js +1 -1
  62. package/lib/module/components/CardField.js.map +1 -1
  63. package/lib/module/components/CardForm.js +1 -1
  64. package/lib/module/components/CardForm.js.map +1 -1
  65. package/lib/module/components/PlatformPayButton.js +1 -1
  66. package/lib/module/components/PlatformPayButton.js.map +1 -1
  67. package/lib/module/components/StripeContainer.js +1 -1
  68. package/lib/module/components/StripeContainer.js.map +1 -1
  69. package/lib/module/components/StripeProvider.js +1 -1
  70. package/lib/module/components/StripeProvider.js.map +1 -1
  71. package/lib/module/events.js +1 -1
  72. package/lib/module/events.js.map +1 -1
  73. package/lib/module/functions.js +1 -1
  74. package/lib/module/functions.js.map +1 -1
  75. package/lib/module/index.js +1 -1
  76. package/lib/module/index.js.map +1 -1
  77. package/lib/module/plugin/withStripe.js +1 -1
  78. package/lib/module/plugin/withStripe.js.map +1 -1
  79. package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
  80. package/lib/module/types/EmbeddedPaymentElement.js +1 -1
  81. package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
  82. package/lib/module/types/Errors.js +1 -1
  83. package/lib/module/types/Errors.js.map +1 -1
  84. package/lib/module/types/PlatformPay.js.map +1 -1
  85. package/lib/module/types/index.js +1 -1
  86. package/lib/module/types/index.js.map +1 -1
  87. package/lib/typescript/src/components/StripeProvider.d.ts.map +1 -1
  88. package/lib/typescript/src/events.d.ts +0 -3
  89. package/lib/typescript/src/events.d.ts.map +1 -1
  90. package/lib/typescript/src/functions.d.ts +1 -0
  91. package/lib/typescript/src/functions.d.ts.map +1 -1
  92. package/lib/typescript/src/index.d.ts +0 -1
  93. package/lib/typescript/src/index.d.ts.map +1 -1
  94. package/lib/typescript/src/plugin/withStripe.d.ts +0 -15
  95. package/lib/typescript/src/plugin/withStripe.d.ts.map +1 -1
  96. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +1 -0
  97. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
  98. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +1 -0
  99. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
  100. package/lib/typescript/src/types/Errors.d.ts +0 -5
  101. package/lib/typescript/src/types/Errors.d.ts.map +1 -1
  102. package/lib/typescript/src/types/PlatformPay.d.ts +7 -1
  103. package/lib/typescript/src/types/PlatformPay.d.ts.map +1 -1
  104. package/lib/typescript/src/types/index.d.ts +1 -7
  105. package/lib/typescript/src/types/index.d.ts.map +1 -1
  106. package/package.json +21 -2
  107. package/src/components/StripeProvider.tsx +0 -9
  108. package/src/events.ts +0 -22
  109. package/src/functions.ts +11 -0
  110. package/src/index.tsx +0 -1
  111. package/src/plugin/withStripe.ts +7 -104
  112. package/src/specs/NativeStripeSdkModule.ts +2 -0
  113. package/src/types/EmbeddedPaymentElement.tsx +7 -0
  114. package/src/types/Errors.ts +0 -6
  115. package/src/types/PlatformPay.ts +7 -1
  116. package/src/types/index.ts +0 -8
  117. package/stripe-react-native.podspec +8 -21
  118. package/.clang-format +0 -90
  119. package/.claude/settings.local.json +0 -11
  120. package/.editorconfig +0 -18
  121. package/.husky/pre-commit +0 -1
  122. package/.idea/GitLink.xml +0 -6
  123. package/.idea/codeStyles/Project.xml +0 -162
  124. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  125. package/.idea/misc.xml +0 -851
  126. package/.idea/modules.xml +0 -8
  127. package/.idea/stripe-react-native.iml +0 -9
  128. package/.idea/vcs.xml +0 -6
  129. package/.vscode/settings.json +0 -3
  130. package/CHANGELOG.md +0 -931
  131. package/CLAUDE.md +0 -148
  132. package/android/.gradle/8.11.1/checksums/checksums.lock +0 -0
  133. package/android/.gradle/8.11.1/executionHistory/executionHistory.bin +0 -0
  134. package/android/.gradle/8.11.1/executionHistory/executionHistory.lock +0 -0
  135. package/android/.gradle/8.11.1/fileChanges/last-build.bin +0 -0
  136. package/android/.gradle/8.11.1/fileHashes/fileHashes.bin +0 -0
  137. package/android/.gradle/8.11.1/fileHashes/fileHashes.lock +0 -0
  138. package/android/.gradle/8.11.1/gc.properties +0 -0
  139. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  140. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  141. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  142. package/android/.gradle/file-system.probe +0 -0
  143. package/android/.gradle/vcs-1/gc.properties +0 -0
  144. package/android/.idea/AndroidProjectSystem.xml +0 -6
  145. package/android/.idea/GitLink.xml +0 -6
  146. package/android/.idea/appInsightsSettings.xml +0 -23
  147. package/android/src/main/java/com/reactnativestripesdk/FakeOnrampSdkModule.kt +0 -138
  148. package/android/src/oldarch/java/com/reactnativestripesdk/NativeOnrampSdkModuleSpec.java +0 -110
  149. package/android/src/onramp/java/com/reactnativestripesdk/OnrampSdkModule.kt +0 -844
  150. package/ios/StripeOnrampSdk.h +0 -17
  151. package/ios/StripeOnrampSdk.mm +0 -144
  152. package/lib/commonjs/hooks/useOnramp.js +0 -2
  153. package/lib/commonjs/hooks/useOnramp.js.map +0 -1
  154. package/lib/commonjs/specs/NativeOnrampSdkModule.js +0 -2
  155. package/lib/commonjs/specs/NativeOnrampSdkModule.js.map +0 -1
  156. package/lib/commonjs/types/Onramp.js +0 -2
  157. package/lib/commonjs/types/Onramp.js.map +0 -1
  158. package/lib/module/hooks/useOnramp.js +0 -2
  159. package/lib/module/hooks/useOnramp.js.map +0 -1
  160. package/lib/module/specs/NativeOnrampSdkModule.js +0 -2
  161. package/lib/module/specs/NativeOnrampSdkModule.js.map +0 -1
  162. package/lib/module/types/Onramp.js +0 -2
  163. package/lib/module/types/Onramp.js.map +0 -1
  164. package/lib/typescript/src/hooks/useOnramp.d.ts +0 -139
  165. package/lib/typescript/src/hooks/useOnramp.d.ts.map +0 -1
  166. package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts +0 -26
  167. package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts.map +0 -1
  168. package/lib/typescript/src/types/Onramp.d.ts +0 -259
  169. package/lib/typescript/src/types/Onramp.d.ts.map +0 -1
  170. package/package-lock.json +0 -14114
  171. package/patches/README.md +0 -55
  172. package/patches/old-arch-codegen-fix.patch +0 -91
  173. package/src/hooks/useOnramp.tsx +0 -297
  174. package/src/specs/NativeOnrampSdkModule.ts +0 -41
  175. package/src/types/Onramp.ts +0 -297
@@ -817,19 +817,6 @@
817
817
  <option name="screenX" value="1080" />
818
818
  <option name="screenY" value="2424" />
819
819
  </PersistentDeviceSelectionData>
820
- <PersistentDeviceSelectionData>
821
- <option name="api" value="36" />
822
- <option name="brand" value="google" />
823
- <option name="codename" value="tokay" />
824
- <option name="default" value="true" />
825
- <option name="id" value="tokay" />
826
- <option name="labId" value="google" />
827
- <option name="manufacturer" value="Google" />
828
- <option name="name" value="Pixel 9" />
829
- <option name="screenDensity" value="420" />
830
- <option name="screenX" value="1080" />
831
- <option name="screenY" value="2424" />
832
- </PersistentDeviceSelectionData>
833
820
  <PersistentDeviceSelectionData>
834
821
  <option name="api" value="34" />
835
822
  <option name="brand" value="samsung" />
@@ -12,6 +12,7 @@
12
12
  <option value="$PROJECT_DIR$" />
13
13
  </set>
14
14
  </option>
15
+ <option name="resolveExternalAnnotations" value="false" />
15
16
  </GradleProjectSettings>
16
17
  </option>
17
18
  </component>
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project version="4">
3
3
  <component name="ExternalStorageConfigurationManager" enabled="true" />
4
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
4
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
5
5
  <output url="file://$PROJECT_DIR$/build/classes" />
6
6
  </component>
7
7
  <component name="ProjectType">
@@ -44,11 +44,6 @@ def isNewArchitectureEnabled() {
44
44
  return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
45
45
  }
46
46
 
47
- def isOnrampIncluded() {
48
- return rootProject.ext.has("StripeSdk_includeOnramp") &&
49
- rootProject.ext.StripeSdk_includeOnramp.toString().toLowerCase() == "true"
50
- }
51
-
52
47
  def reactNativeArchitectures() {
53
48
  def value = project.getProperties().get("reactNativeArchitectures")
54
49
  return value ? value.split(",") : [
@@ -103,7 +98,6 @@ android {
103
98
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
104
99
  consumerProguardFiles 'proguard-rules.txt'
105
100
  buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
106
- buildConfigField "boolean", "IS_ONRAMP_INCLUDED", isOnrampIncluded().toString()
107
101
 
108
102
  ndk {
109
103
  abiFilters(*reactNativeArchitectures())
@@ -135,9 +129,6 @@ android {
135
129
  if (!isNewArchitectureEnabled()) {
136
130
  srcDirs += ["src/oldarch/java"]
137
131
  }
138
- if (isOnrampIncluded()) {
139
- srcDirs += ["src/onramp/java"]
140
- }
141
132
  }
142
133
  }
143
134
  }
@@ -223,11 +214,6 @@ dependencies {
223
214
  implementation("com.stripe:stripe-android:$stripe_version") {
224
215
  exclude group: 'androidx.emoji2', module: 'emoji2'
225
216
  }
226
- if (isOnrampIncluded()) {
227
- implementation("com.stripe:crypto-onramp:$stripe_version") {
228
- exclude group: 'androidx.emoji2', module: 'emoji2'
229
- }
230
- }
231
217
  implementation("com.stripe:financial-connections:$stripe_version") {
232
218
  exclude group: 'androidx.emoji2', module: 'emoji2'
233
219
  }
@@ -3,4 +3,4 @@ StripeSdk_compileSdkVersion=30
3
3
  StripeSdk_targetSdkVersion=28
4
4
  StripeSdk_minSdkVersion=21
5
5
  # Keep StripeSdk_stripeVersion in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/android/gradle.properties
6
- StripeSdk_stripeVersion=21.27.0
6
+ StripeSdk_stripeVersion=21.26.+
@@ -4,5 +4,5 @@
4
4
  # Location of the SDK. This is only used by Gradle.
5
5
  # For customization when using a Version Control System, please read the
6
6
  # header note.
7
- #Thu Aug 28 10:12:28 EDT 2025
8
- sdk.dir=/Users/lng/Library/Android/sdk
7
+ #Thu Jun 26 11:00:51 PDT 2025
8
+ sdk.dir=/Users/tianzhao/Library/Android/sdk
@@ -15,7 +15,7 @@ import androidx.compose.runtime.rememberCoroutineScope
15
15
  import androidx.compose.runtime.setValue
16
16
  import androidx.compose.ui.Modifier
17
17
  import androidx.compose.ui.layout.layout
18
- import androidx.compose.ui.layout.onPlaced
18
+ import androidx.compose.ui.layout.onSizeChanged
19
19
  import androidx.compose.ui.platform.LocalDensity
20
20
  import androidx.compose.ui.unit.IntOffset
21
21
  import androidx.compose.ui.unit.dp
@@ -287,33 +287,56 @@ class EmbeddedPaymentElementView(
287
287
 
288
288
  val density = LocalDensity.current
289
289
 
290
+ Box {
291
+ measuredEmbeddedElement(
292
+ reportHeightChange = { h -> reportHeightChange(h) },
293
+ ) {
294
+ embedded.Content()
295
+ }
296
+ }
297
+ }
298
+
299
+ @Composable
300
+ private fun measuredEmbeddedElement(
301
+ reportHeightChange: (Float) -> Unit,
302
+ content: @Composable () -> Unit,
303
+ ) {
304
+ val density = LocalDensity.current
305
+ var heightDp by remember { mutableStateOf(1.dp) } // non-zero sentinel
306
+
290
307
  Box(
291
- modifier =
292
- Modifier
293
- .requiredHeight(height.dp)
294
- .layout { measurable, constraints ->
295
- val minIntrinsicHeight = measurable.minIntrinsicHeight(constraints.maxWidth)
296
-
297
- height = minIntrinsicHeight
298
-
299
- layout(constraints.maxWidth, minIntrinsicHeight) {
300
- measurable
301
- .measure(
302
- constraints.copy(
303
- minHeight = minIntrinsicHeight,
304
- maxHeight = minIntrinsicHeight,
305
- ),
306
- ).placeRelative(IntOffset.Zero)
307
- }
308
- }.onPlaced {
309
- reportHeightChange(
310
- with(density) {
311
- height.toDp().value
312
- },
308
+ Modifier
309
+ // Clamp the host Android view height; drive it in Dp
310
+ .requiredHeight(heightDp)
311
+ // Post-layout: convert px -> dp, update RN & our dp state
312
+ .onSizeChanged { size ->
313
+ val h = with(density) { size.height.toDp() }
314
+ if (h != heightDp) {
315
+ heightDp = h
316
+ reportHeightChange(h.value) // send dp as Float to RN
317
+ }
318
+ }
319
+ // Custom measure path: force child to its min intrinsic height (in *px*)
320
+ .layout { measurable, constraints ->
321
+ val widthPx = constraints.maxWidth
322
+ val minHpx = measurable.minIntrinsicHeight(widthPx).coerceAtLeast(1)
323
+
324
+ // Measure the child with a tight height equal to min intrinsic
325
+ val placeable =
326
+ measurable.measure(
327
+ constraints.copy(
328
+ minHeight = minHpx,
329
+ maxHeight = minHpx,
330
+ ),
313
331
  )
314
- },
332
+
333
+ // Our own size: use the child’s measured size
334
+ layout(constraints.maxWidth, placeable.height) {
335
+ placeable.placeRelative(IntOffset.Zero)
336
+ }
337
+ },
315
338
  ) {
316
- embedded.Content()
339
+ content()
317
340
  }
318
341
  }
319
342
 
@@ -135,6 +135,7 @@ class EmbeddedPaymentElementViewManager :
135
135
  }
136
136
 
137
137
  val googlePayConfig = buildGooglePayConfig(toBundleObject(map.getMap("googlePay")))
138
+ val linkConfig = PaymentSheetFragment.buildLinkConfig(toBundleObject(map.getMap("link")))
138
139
  val shippingDetails =
139
140
  map.getMap("defaultShippingDetails")?.let {
140
141
  AddressSheetView.buildAddressDetails(it)
@@ -184,6 +185,7 @@ class EmbeddedPaymentElementViewManager :
184
185
  .defaultBillingDetails(defaultBillingDetails)
185
186
  .customer(customerConfiguration)
186
187
  .googlePay(googlePayConfig)
188
+ .link(linkConfig)
187
189
  .appearance(appearance)
188
190
  .shippingDetails(shippingDetails)
189
191
  .billingDetailsCollectionConfiguration(billingDetailsConfig)
@@ -381,9 +381,9 @@ class PaymentLauncherFragment : StripeFragment() {
381
381
  StripeIntent.NextActionType.DisplayOxxoDetails,
382
382
  StripeIntent.NextActionType.DisplayBoletoDetails,
383
383
  StripeIntent.NextActionType.DisplayKonbiniDetails,
384
- StripeIntent.NextActionType.DisplayPayNowDetails,
385
384
  StripeIntent.NextActionType.VerifyWithMicrodeposits,
386
385
  StripeIntent.NextActionType.DisplayMultibancoDetails,
386
+ StripeIntent.NextActionType.DisplayPayNowDetails,
387
387
  -> true
388
388
  StripeIntent.NextActionType.RedirectToUrl,
389
389
  StripeIntent.NextActionType.UseStripeSdk,
@@ -71,7 +71,6 @@ import kotlinx.coroutines.Dispatchers
71
71
  import kotlinx.coroutines.launch
72
72
  import org.json.JSONObject
73
73
 
74
- @SuppressLint("RestrictedApi")
75
74
  @ReactModule(name = StripeSdkModule.NAME)
76
75
  class StripeSdkModule(
77
76
  reactContext: ReactApplicationContext,
@@ -243,10 +242,7 @@ class StripeSdkModule(
243
242
  val customPaymentMethodConfig = params.getMap("customPaymentMethodConfiguration")
244
243
  if (customPaymentMethodConfig != null) {
245
244
  // Store the original ReadableMap for custom payment methods
246
- bundle.putSerializable(
247
- "customPaymentMethodConfigurationReadableMap",
248
- customPaymentMethodConfig.toHashMap(),
249
- )
245
+ bundle.putSerializable("customPaymentMethodConfigurationReadableMap", customPaymentMethodConfig.toHashMap())
250
246
  }
251
247
 
252
248
  paymentSheetFragment =
@@ -1303,6 +1299,14 @@ class StripeSdkModule(
1303
1299
  // noop, iOS only
1304
1300
  }
1305
1301
 
1302
+ @ReactMethod
1303
+ override fun setFinancialConnectionsForceNativeFlow(
1304
+ enabled: Boolean,
1305
+ promise: Promise,
1306
+ ) {
1307
+ // noop, iOS only
1308
+ }
1309
+
1306
1310
  override fun addListener(eventType: String?) {
1307
1311
  // noop, iOS only
1308
1312
  }
@@ -1409,14 +1413,11 @@ class StripeSdkModule(
1409
1413
 
1410
1414
  private fun setupComposeCompatView() {
1411
1415
  UiThreadUtil.runOnUiThread {
1412
- composeCompatView =
1413
- composeCompatView ?: StripeAbstractComposeView
1414
- .CompatView(context = reactApplicationContext)
1415
- .also {
1416
- currentActivity?.findViewById<ViewGroup>(android.R.id.content)?.addView(
1417
- it,
1418
- )
1419
- }
1416
+ composeCompatView = composeCompatView ?: StripeAbstractComposeView.CompatView(context = reactApplicationContext).also {
1417
+ currentActivity?.findViewById<ViewGroup>(android.R.id.content)?.addView(
1418
+ it,
1419
+ )
1420
+ }
1420
1421
  }
1421
1422
  }
1422
1423
 
@@ -19,20 +19,11 @@ class StripeSdkPackage : BaseReactPackage() {
19
19
  ): NativeModule? =
20
20
  when (name) {
21
21
  StripeSdkModule.NAME -> StripeSdkModule(reactContext)
22
- NativeOnrampSdkModuleSpec.NAME -> {
23
- val onrampModuleClass = getOnrampModuleClass()
24
- val constructor = onrampModuleClass.getConstructor(ReactApplicationContext::class.java)
25
- constructor.newInstance(reactContext) as NativeModule
26
- }
27
22
  else -> null
28
23
  }
29
24
 
30
25
  override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
31
- val moduleList: Array<Class<out NativeModule?>> =
32
- arrayOf(
33
- StripeSdkModule::class.java,
34
- getOnrampModuleClass(),
35
- )
26
+ val moduleList: Array<Class<out NativeModule?>> = arrayOf(StripeSdkModule::class.java)
36
27
  val reactModuleInfoMap: MutableMap<String, ReactModuleInfo> = HashMap()
37
28
  for (moduleClass in moduleList) {
38
29
  val reactModule = moduleClass.getAnnotation(ReactModule::class.java) ?: continue
@@ -60,13 +51,4 @@ class StripeSdkPackage : BaseReactPackage() {
60
51
  AddressSheetViewManager(),
61
52
  EmbeddedPaymentElementViewManager(),
62
53
  )
63
-
64
- private fun getOnrampModuleClass(): Class<out NativeModule?> {
65
- if (BuildConfig.IS_ONRAMP_INCLUDED) {
66
- @Suppress("UNCHECKED_CAST")
67
- return Class.forName("com.reactnativestripesdk.OnrampSdkModule") as Class<out NativeModule?>
68
- } else {
69
- return FakeOnrampSdkModule::class.java
70
- }
71
- }
72
54
  }
@@ -178,18 +178,8 @@ internal fun createError(
178
178
  return mapError(code, error.message, error.localizedMessage, null, null, null)
179
179
  }
180
180
 
181
- internal fun createCanceledError(message: String? = null): WritableMap = createError(ErrorType.Canceled.toString(), message)
182
-
183
- internal fun createFailedError(error: Throwable): WritableMap = createError(ErrorType.Failed.toString(), error)
184
-
185
181
  internal fun createMissingInitError(): WritableMap =
186
182
  createError(
187
183
  ErrorType.Failed.toString(),
188
184
  "Stripe has not been initialized. Initialize Stripe in your app with the StripeProvider component or the initStripe method.",
189
185
  )
190
-
191
- internal fun createOnrampNotConfiguredError(): WritableMap =
192
- createError(
193
- ErrorType.Failed.toString(),
194
- "Onramp is not configured.",
195
- )
@@ -30,8 +30,6 @@ import com.stripe.android.model.Token
30
30
  import com.stripe.android.paymentelement.ExperimentalCustomPaymentMethodsApi
31
31
  import com.stripe.android.paymentsheet.PaymentSheet
32
32
 
33
- internal fun createEmptyResult(): WritableMap = WritableNativeMap()
34
-
35
33
  internal fun createResult(
36
34
  key: String,
37
35
  value: WritableMap,
@@ -560,6 +558,7 @@ internal fun mapNextAction(
560
558
  NextActionType.BlikAuthorize,
561
559
  NextActionType.UseStripeSdk,
562
560
  NextActionType.UpiAwaitNotification,
561
+ NextActionType.DisplayPayNowDetails,
563
562
  null,
564
563
  -> {
565
564
  return null
@@ -588,12 +587,6 @@ internal fun mapNextAction(
588
587
  nextActionMap.putString("voucherURL", it.hostedVoucherUrl)
589
588
  }
590
589
  }
591
- NextActionType.DisplayPayNowDetails -> {
592
- (data as? NextActionData.DisplayPayNowDetails)?.let {
593
- nextActionMap.putString("type", "paynow")
594
- nextActionMap.putString("qrCodeUrl", it.qrCodeUrl)
595
- }
596
- }
597
590
  }
598
591
  return nextActionMap
599
592
  }
@@ -1081,8 +1074,7 @@ internal fun parseCustomPaymentMethods(customPaymentMethodConfig: Bundle?): List
1081
1074
  return emptyList()
1082
1075
  }
1083
1076
 
1084
- val configHashMap =
1085
- customPaymentMethodConfig.getSerializable("customPaymentMethodConfigurationReadableMap") as? HashMap<String, Any>
1077
+ val configHashMap = customPaymentMethodConfig.getSerializable("customPaymentMethodConfigurationReadableMap") as? HashMap<String, Any>
1086
1078
  if (configHashMap != null) {
1087
1079
  val customPaymentMethods = configHashMap["customPaymentMethods"] as? List<HashMap<String, Any>>
1088
1080
  if (customPaymentMethods != null) {
@@ -1092,8 +1084,7 @@ internal fun parseCustomPaymentMethods(customPaymentMethodConfig: Bundle?): List
1092
1084
  val id = customPaymentMethodMap["id"] as? String
1093
1085
  if (id != null) {
1094
1086
  val subtitle = customPaymentMethodMap["subtitle"] as? String
1095
- val disableBillingDetailCollection =
1096
- customPaymentMethodMap["disableBillingDetailCollection"] as? Boolean ?: false
1087
+ val disableBillingDetailCollection = customPaymentMethodMap["disableBillingDetailCollection"] as? Boolean ?: false
1097
1088
  result.add(
1098
1089
  PaymentSheet.CustomPaymentMethod(
1099
1090
  id = id,
@@ -34,18 +34,6 @@ public class ApplePayButtonManagerDelegate<T extends View, U extends BaseViewMan
34
34
  case "borderRadius":
35
35
  mViewManager.setBorderRadius(view, value == null ? 4 : ((Double) value).intValue());
36
36
  break;
37
- case "hasShippingMethodCallback":
38
- mViewManager.setHasShippingMethodCallback(view, value == null ? false : (boolean) value);
39
- break;
40
- case "hasShippingContactCallback":
41
- mViewManager.setHasShippingContactCallback(view, value == null ? false : (boolean) value);
42
- break;
43
- case "hasCouponCodeCallback":
44
- mViewManager.setHasCouponCodeCallback(view, value == null ? false : (boolean) value);
45
- break;
46
- case "hasOrderTrackingCallback":
47
- mViewManager.setHasOrderTrackingCallback(view, value == null ? false : (boolean) value);
48
- break;
49
37
  default:
50
38
  super.setProperty(view, propName, value);
51
39
  }
@@ -16,8 +16,4 @@ public interface ApplePayButtonManagerInterface<T extends View> {
16
16
  void setType(T view, int value);
17
17
  void setButtonStyle(T view, int value);
18
18
  void setBorderRadius(T view, int value);
19
- void setHasShippingMethodCallback(T view, boolean value);
20
- void setHasShippingContactCallback(T view, boolean value);
21
- void setHasCouponCodeCallback(T view, boolean value);
22
- void setHasOrderTrackingCallback(T view, boolean value);
23
19
  }
@@ -118,10 +118,6 @@ public abstract class NativeStripeSdkModuleSpec extends ReactContextBaseJavaModu
118
118
  invoke("onCustomPaymentMethodConfirmHandlerCallback", value);
119
119
  }
120
120
 
121
- protected final void emitOnCheckoutClientSecretRequested(ReadableMap value) {
122
- invoke("onCheckoutClientSecretRequested", value);
123
- }
124
-
125
121
  @ReactMethod
126
122
  @DoNotStrip
127
123
  public abstract void initialise(ReadableMap params, Promise promise);
@@ -320,6 +316,10 @@ public abstract class NativeStripeSdkModuleSpec extends ReactContextBaseJavaModu
320
316
  @DoNotStrip
321
317
  public abstract void clearEmbeddedPaymentOption(double viewTag, Promise promise);
322
318
 
319
+ @ReactMethod
320
+ @DoNotStrip
321
+ public abstract void setFinancialConnectionsForceNativeFlow(boolean enabled, Promise promise);
322
+
323
323
  @ReactMethod
324
324
  @DoNotStrip
325
325
  public abstract void addListener(String eventType);
package/ios/Mappers.swift CHANGED
@@ -1,8 +1,5 @@
1
1
  import Stripe
2
- #if canImport(StripeCryptoOnramp)
3
- @_spi(STP) import StripeCryptoOnramp
4
- #endif
5
- @_spi(STP) import StripePaymentSheet
2
+ import StripePaymentSheet
6
3
 
7
4
  class Mappers {
8
5
  class func createResult(_ key: String, _ value: NSDictionary?, additionalFields: [String: Any]? = nil) -> NSDictionary {
@@ -1076,134 +1073,4 @@ class Mappers {
1076
1073
 
1077
1074
  return mappedEvent
1078
1075
  }
1079
-
1080
- #if canImport(StripeCryptoOnramp)
1081
- class func mapToLinkAppearance(_ params: [String: Any?]) -> LinkAppearance {
1082
- let darkColors = params["darkColors"] as? [String: Any?]
1083
- let lightColors = params["lightColors"] as? [String: Any?]
1084
-
1085
- let darkPrimaryHex = darkColors?["primary"] as? String
1086
- let lightPrimaryHex = lightColors?["primary"] as? String
1087
- let darkSelectedBorderHex = darkColors?["borderSelected"] as? String
1088
- let lightSelectedBorderHex = lightColors?["borderSelected"] as? String
1089
-
1090
- let darkPrimary = darkPrimaryHex.flatMap { UIColor(hexString: $0) }
1091
- let lightPrimary = lightPrimaryHex.flatMap { UIColor(hexString: $0) }
1092
-
1093
- let darkSelectedBorder = darkSelectedBorderHex.flatMap { UIColor(hexString: $0) }
1094
- let lightSelectedBorder = lightSelectedBorderHex.flatMap { UIColor(hexString: $0) }
1095
-
1096
- let primary: UIColor? = if let darkPrimary, let lightPrimary {
1097
- UIColor { trait in
1098
- trait.userInterfaceStyle == .dark ? darkPrimary : lightPrimary
1099
- }
1100
- } else {
1101
- darkPrimary ?? lightPrimary
1102
- }
1103
-
1104
- let selectedBorder: UIColor? = if let darkSelectedBorder, let lightSelectedBorder {
1105
- UIColor { trait in
1106
- trait.userInterfaceStyle == .dark ? darkSelectedBorder : lightSelectedBorder
1107
- }
1108
- } else {
1109
- darkSelectedBorder ?? lightSelectedBorder
1110
- }
1111
-
1112
- let colors: LinkAppearance.Colors? = if primary != nil || selectedBorder != nil {
1113
- .init(primary: primary, selectedBorder: selectedBorder)
1114
- } else {
1115
- nil
1116
- }
1117
-
1118
- let primaryButtonConfiguration: LinkAppearance.PrimaryButtonConfiguration? =
1119
- if let primaryButton = params["primaryButton"] as? [String: CGFloat],
1120
- let cornerRadius = primaryButton["cornerRadius"],
1121
- let height = primaryButton["height"] {
1122
- .init(cornerRadius: cornerRadius, height: height)
1123
- } else {
1124
- nil
1125
- }
1126
-
1127
- let style: PaymentSheet.UserInterfaceStyle = switch params["style"] as? String ?? "" {
1128
- case "ALWAYS_LIGHT": .alwaysLight
1129
- case "ALWAYS_DARK": .alwaysDark
1130
- default: .automatic
1131
- }
1132
-
1133
- return LinkAppearance(
1134
- colors: colors,
1135
- primaryButton: primaryButtonConfiguration,
1136
- style: style,
1137
- reduceLinkBranding: true
1138
- )
1139
- }
1140
-
1141
- class func mapToKycInfo(_ params: [String: Any?]) throws -> KycInfo {
1142
- guard let firstName = params["firstName"] as? String, !firstName.isEmpty else {
1143
- throw KycInfoError.missingRequiredField("firstName")
1144
- }
1145
-
1146
- guard let lastName = params["lastName"] as? String, !lastName.isEmpty else {
1147
- throw KycInfoError.missingRequiredField("lastName")
1148
- }
1149
-
1150
- guard let idNumber = params["idNumber"] as? String, !idNumber.isEmpty else {
1151
- throw KycInfoError.missingRequiredField("idNumber")
1152
- }
1153
-
1154
- guard let dateOfBirthParams = params["dateOfBirth"] as? [String: Int] else {
1155
- throw KycInfoError.missingRequiredField("dateOfBirth")
1156
- }
1157
-
1158
- guard let day = dateOfBirthParams["day"] else {
1159
- throw KycInfoError.missingRequiredField("dateOfBirth.day")
1160
- }
1161
-
1162
- guard let month = dateOfBirthParams["month"] else {
1163
- throw KycInfoError.missingRequiredField("dateOfBirth.month")
1164
- }
1165
-
1166
- guard let year = dateOfBirthParams["year"] else {
1167
- throw KycInfoError.missingRequiredField("dateOfBirth.year")
1168
- }
1169
-
1170
- let dateOfBirth = KycInfo.DateOfBirth(day: day, month: month, year: year)
1171
-
1172
- /// All address parameters are optional, so we don’t guard.
1173
- let addressParams = params["address"] as? [String: String]
1174
- let address = Address(
1175
- city: addressParams?["city"],
1176
- country: addressParams?["country"],
1177
- line1: addressParams?["line1"],
1178
- line2: addressParams?["line2"],
1179
- postalCode: addressParams?["postalCode"],
1180
- state: addressParams?["state"]
1181
- )
1182
-
1183
- return KycInfo(
1184
- firstName: firstName,
1185
- lastName: lastName,
1186
- idNumber: idNumber,
1187
- address: address,
1188
- dateOfBirth: dateOfBirth
1189
- )
1190
- }
1191
-
1192
- class func paymentMethodDisplayDataToMap(_ paymentMethodDisplayData: PaymentMethodDisplayData) -> [String: String] {
1193
- var result = [
1194
- "icon": "data:image/png;base64," + (paymentMethodDisplayData.icon.pngData()?.base64EncodedString(options: []) ?? ""),
1195
- "label": paymentMethodDisplayData.label,
1196
- ]
1197
-
1198
- if let sublabel = paymentMethodDisplayData.sublabel {
1199
- result["sublabel"] = sublabel
1200
- }
1201
-
1202
- return result
1203
- }
1204
-
1205
- enum KycInfoError: Swift.Error {
1206
- case missingRequiredField(String)
1207
- }
1208
- #endif
1209
1076
  }
@@ -20,6 +20,5 @@
20
20
  - (void)emitEmbeddedPaymentElementRowSelectionImmediateAction;
21
21
  - (void)emitEmbeddedPaymentElementLoadingFailed:(NSDictionary *)value;
22
22
  - (void)emitOnCustomPaymentMethodConfirmHandlerCallback:(NSDictionary *)value;
23
- - (void)emitOnCheckoutClientSecretRequested:(NSDictionary *)value;
24
23
  @end
25
24
 
@@ -20,8 +20,7 @@
20
20
  @"embeddedPaymentElementFormSheetConfirmComplete",
21
21
  @"embeddedPaymentElementRowSelectionImmediateAction",
22
22
  @"embeddedPaymentElementLoadingFailed",
23
- @"onCustomPaymentMethodConfirmHandlerCallback",
24
- @"onCheckoutClientSecretRequested"
23
+ @"onCustomPaymentMethodConfirmHandlerCallback"
25
24
  ];
26
25
  }
27
26
 
@@ -105,9 +104,4 @@
105
104
  [self sendEventWithName:@"onCustomPaymentMethodConfirmHandlerCallback" body:value];
106
105
  }
107
106
 
108
- - (void)emitOnCheckoutClientSecretRequested:(NSDictionary *)value
109
- {
110
- [self sendEventWithName:@"onCheckoutClientSecretRequested" body:value];
111
- }
112
-
113
107
  @end
package/ios/StripeSdk.mm CHANGED
@@ -354,6 +354,13 @@ RCT_EXPORT_METHOD(updatePlatformPaySheet:(nonnull NSArray *)summaryItems
354
354
  rejecter:reject];
355
355
  }
356
356
 
357
+ RCT_EXPORT_METHOD(setFinancialConnectionsForceNativeFlow:(BOOL)enabled
358
+ resolve:(nonnull RCTPromiseResolveBlock)resolve
359
+ reject:(nonnull RCTPromiseRejectBlock)reject)
360
+ {
361
+ [StripeSdkImpl.shared setFinancialConnectionsForceNativeFlow:enabled resolver:resolve rejecter:reject];
362
+ }
363
+
357
364
  RCT_EXPORT_METHOD(verifyMicrodeposits:(BOOL)isPaymentIntent
358
365
  clientSecret:(nonnull NSString *)clientSecret
359
366
  params:(nonnull NSDictionary *)params
@@ -18,7 +18,3 @@ import Foundation
18
18
  func emitEmbeddedPaymentElementLoadingFailed(_ value: [String: Any])
19
19
  func emitOnCustomPaymentMethodConfirmHandlerCallback(_ value: [String: Any])
20
20
  }
21
-
22
- @objc public protocol StripeOnrampSdkEmitter {
23
- func emitOnCheckoutClientSecretRequested(_ value: [String: Any])
24
- }