@stripe/stripe-react-native 0.63.0 → 0.65.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 (226) hide show
  1. package/android/.idea/AndroidProjectSystem.xml +6 -0
  2. package/android/.idea/caches/deviceStreaming.xml +835 -0
  3. package/android/.idea/compiler.xml +6 -0
  4. package/android/.idea/gradle.xml +17 -0
  5. package/android/.idea/migrations.xml +10 -0
  6. package/android/.idea/misc.xml +10 -0
  7. package/android/.idea/runConfigurations.xml +17 -0
  8. package/android/.idea/vcs.xml +6 -0
  9. package/android/build.gradle +2 -2
  10. package/android/detekt/detekt-baseline.xml +146 -0
  11. package/android/detekt/detekt.gradle +45 -0
  12. package/android/detekt/detekt.yml +722 -0
  13. package/android/gradle.properties +1 -1
  14. package/android/local.properties +8 -0
  15. package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherManager.kt +0 -1
  16. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +22 -0
  17. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodMessagingElementConfig.kt +2 -3
  18. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +82 -4
  19. package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +5 -5
  20. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +2 -4
  21. package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +36 -0
  22. package/android/src/onramp/java/com/reactnativestripesdk/OnrampMappers.kt +43 -0
  23. package/android/src/onramp/java/com/reactnativestripesdk/OnrampSdkModule.kt +5 -1
  24. package/android/src/test/java/com/reactnativestripesdk/PaymentMethodMessagingElementConfigTest.kt +3 -3
  25. package/android/src/test/java/com/reactnativestripesdk/mappers/MappersTest.kt +33 -0
  26. package/android/src/test/java/com/reactnativestripesdk/mappers/OnrampMappersTest.kt +298 -0
  27. package/ios/AddressSheet/AddressSheetUtils.swift +23 -0
  28. package/ios/AddressSheet/AddressSheetView.swift +9 -14
  29. package/ios/Mappers.swift +74 -5
  30. package/ios/PaymentMethodFactory.swift +19 -0
  31. package/ios/PaymentMethodMessagingElementConfig.swift +6 -3
  32. package/ios/PaymentMethodMessagingElementView.swift +19 -0
  33. package/ios/StripeSdk-Bridging-Header.h +1 -0
  34. package/ios/StripeSdk.mm +1 -1
  35. package/ios/StripeSdkImpl.swift +38 -102
  36. package/ios/StripeSwiftInterop.h +1 -0
  37. package/jest/mock.js +3 -0
  38. package/lib/commonjs/components/AddToWalletButton.js +1 -1
  39. package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
  40. package/lib/commonjs/components/AddressSheet.js +1 -1
  41. package/lib/commonjs/components/AddressSheet.js.map +1 -1
  42. package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
  43. package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
  44. package/lib/commonjs/components/CardField.js +1 -1
  45. package/lib/commonjs/components/CardField.js.map +1 -1
  46. package/lib/commonjs/components/CardForm.js +1 -1
  47. package/lib/commonjs/components/CardForm.js.map +1 -1
  48. package/lib/commonjs/components/PaymentMethodMessagingElement.js +2 -0
  49. package/lib/commonjs/components/PaymentMethodMessagingElement.js.map +1 -0
  50. package/lib/commonjs/components/PlatformPayButton.js +1 -1
  51. package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
  52. package/lib/commonjs/components/StripeContainer.js +1 -1
  53. package/lib/commonjs/components/StripeContainer.js.map +1 -1
  54. package/lib/commonjs/components/StripeProvider.js +1 -1
  55. package/lib/commonjs/components/StripeProvider.js.map +1 -1
  56. package/lib/commonjs/connect/Components.js +1 -1
  57. package/lib/commonjs/connect/Components.js.map +1 -1
  58. package/lib/commonjs/connect/ConnectComponentsProvider.js +1 -1
  59. package/lib/commonjs/connect/ConnectComponentsProvider.js.map +1 -1
  60. package/lib/commonjs/connect/EmbeddedComponent.js +1 -1
  61. package/lib/commonjs/connect/EmbeddedComponent.js.map +1 -1
  62. package/lib/commonjs/connect/ModalCloseButton.js +1 -1
  63. package/lib/commonjs/connect/ModalCloseButton.js.map +1 -1
  64. package/lib/commonjs/connect/NavigationBar.js +1 -1
  65. package/lib/commonjs/connect/NavigationBar.js.map +1 -1
  66. package/lib/commonjs/connect/testUtils.js +1 -1
  67. package/lib/commonjs/connect/testUtils.js.map +1 -1
  68. package/lib/commonjs/events.js +1 -1
  69. package/lib/commonjs/events.js.map +1 -1
  70. package/lib/commonjs/functions.js +1 -1
  71. package/lib/commonjs/functions.js.map +1 -1
  72. package/lib/commonjs/helpers.js +1 -1
  73. package/lib/commonjs/hooks/useCheckout.js +2 -0
  74. package/lib/commonjs/hooks/useCheckout.js.map +1 -0
  75. package/lib/commonjs/hooks/useOnramp.js +1 -1
  76. package/lib/commonjs/hooks/useOnramp.js.map +1 -1
  77. package/lib/commonjs/index.js +1 -1
  78. package/lib/commonjs/index.js.map +1 -1
  79. package/lib/commonjs/specs/NativeAddToWalletButton.js +1 -1
  80. package/lib/commonjs/specs/NativeAddressSheet.js +1 -1
  81. package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
  82. package/lib/commonjs/specs/NativeAuBECSDebitForm.js +1 -1
  83. package/lib/commonjs/specs/NativeCardField.js +1 -1
  84. package/lib/commonjs/specs/NativeCardField.js.map +1 -1
  85. package/lib/commonjs/specs/NativeCardForm.js +1 -1
  86. package/lib/commonjs/specs/NativeCardForm.js.map +1 -1
  87. package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js +1 -1
  88. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +1 -1
  89. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -1
  90. package/lib/commonjs/specs/NativeGooglePayButton.js +1 -1
  91. package/lib/commonjs/specs/NativeNavigationBar.js +1 -1
  92. package/lib/commonjs/specs/NativeOnrampSdkModule.js +1 -1
  93. package/lib/commonjs/specs/NativeOnrampSdkModule.js.map +1 -1
  94. package/lib/commonjs/specs/NativePaymentMethodMessagingElement.js +1 -1
  95. package/lib/commonjs/specs/NativePaymentMethodMessagingElement.js.map +1 -1
  96. package/lib/commonjs/specs/NativeStripeContainer.js +1 -1
  97. package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
  98. package/lib/commonjs/types/Checkout.js +2 -0
  99. package/lib/commonjs/types/Checkout.js.map +1 -0
  100. package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
  101. package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
  102. package/lib/commonjs/types/Onramp.js.map +1 -1
  103. package/lib/commonjs/types/PaymentIntent.js.map +1 -1
  104. package/lib/commonjs/types/PaymentSheet.js.map +1 -1
  105. package/lib/module/components/AddToWalletButton.js +1 -1
  106. package/lib/module/components/AddToWalletButton.js.map +1 -1
  107. package/lib/module/components/AddressSheet.js +1 -1
  108. package/lib/module/components/AddressSheet.js.map +1 -1
  109. package/lib/module/components/AuBECSDebitForm.js +1 -1
  110. package/lib/module/components/AuBECSDebitForm.js.map +1 -1
  111. package/lib/module/components/CardField.js +1 -1
  112. package/lib/module/components/CardField.js.map +1 -1
  113. package/lib/module/components/CardForm.js +1 -1
  114. package/lib/module/components/CardForm.js.map +1 -1
  115. package/lib/module/components/PaymentMethodMessagingElement.js +2 -0
  116. package/lib/module/components/PaymentMethodMessagingElement.js.map +1 -0
  117. package/lib/module/components/PlatformPayButton.js +1 -1
  118. package/lib/module/components/PlatformPayButton.js.map +1 -1
  119. package/lib/module/components/StripeContainer.js +1 -1
  120. package/lib/module/components/StripeContainer.js.map +1 -1
  121. package/lib/module/components/StripeProvider.js +1 -1
  122. package/lib/module/components/StripeProvider.js.map +1 -1
  123. package/lib/module/connect/Components.js +1 -1
  124. package/lib/module/connect/Components.js.map +1 -1
  125. package/lib/module/connect/ConnectComponentsProvider.js +1 -1
  126. package/lib/module/connect/ConnectComponentsProvider.js.map +1 -1
  127. package/lib/module/connect/EmbeddedComponent.js +1 -1
  128. package/lib/module/connect/EmbeddedComponent.js.map +1 -1
  129. package/lib/module/connect/ModalCloseButton.js +1 -1
  130. package/lib/module/connect/ModalCloseButton.js.map +1 -1
  131. package/lib/module/connect/NavigationBar.js +1 -1
  132. package/lib/module/connect/NavigationBar.js.map +1 -1
  133. package/lib/module/connect/testUtils.js +1 -1
  134. package/lib/module/connect/testUtils.js.map +1 -1
  135. package/lib/module/events.js +1 -1
  136. package/lib/module/events.js.map +1 -1
  137. package/lib/module/functions.js +1 -1
  138. package/lib/module/functions.js.map +1 -1
  139. package/lib/module/helpers.js +1 -1
  140. package/lib/module/hooks/useCheckout.js +2 -0
  141. package/lib/module/hooks/useCheckout.js.map +1 -0
  142. package/lib/module/hooks/useOnramp.js +1 -1
  143. package/lib/module/hooks/useOnramp.js.map +1 -1
  144. package/lib/module/index.js +1 -1
  145. package/lib/module/index.js.map +1 -1
  146. package/lib/module/specs/NativeAddToWalletButton.js +1 -1
  147. package/lib/module/specs/NativeAddressSheet.js +1 -1
  148. package/lib/module/specs/NativeApplePayButton.js +1 -1
  149. package/lib/module/specs/NativeAuBECSDebitForm.js +1 -1
  150. package/lib/module/specs/NativeCardField.js +1 -1
  151. package/lib/module/specs/NativeCardField.js.map +1 -1
  152. package/lib/module/specs/NativeCardForm.js +1 -1
  153. package/lib/module/specs/NativeCardForm.js.map +1 -1
  154. package/lib/module/specs/NativeConnectAccountOnboardingView.js +1 -1
  155. package/lib/module/specs/NativeEmbeddedPaymentElement.js +1 -1
  156. package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -1
  157. package/lib/module/specs/NativeGooglePayButton.js +1 -1
  158. package/lib/module/specs/NativeNavigationBar.js +1 -1
  159. package/lib/module/specs/NativeOnrampSdkModule.js +1 -1
  160. package/lib/module/specs/NativeOnrampSdkModule.js.map +1 -1
  161. package/lib/module/specs/NativePaymentMethodMessagingElement.js +1 -1
  162. package/lib/module/specs/NativePaymentMethodMessagingElement.js.map +1 -1
  163. package/lib/module/specs/NativeStripeContainer.js +1 -1
  164. package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
  165. package/lib/module/types/Checkout.js +2 -0
  166. package/lib/module/types/Checkout.js.map +1 -0
  167. package/lib/module/types/EmbeddedPaymentElement.js +1 -1
  168. package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
  169. package/lib/module/types/Onramp.js.map +1 -1
  170. package/lib/module/types/PaymentIntent.js.map +1 -1
  171. package/lib/module/types/PaymentSheet.js.map +1 -1
  172. package/lib/typescript/src/components/PaymentMethodMessagingElement.d.ts +41 -0
  173. package/lib/typescript/src/components/PaymentMethodMessagingElement.d.ts.map +1 -0
  174. package/lib/typescript/src/connect/testUtils.d.ts +4 -0
  175. package/lib/typescript/src/connect/testUtils.d.ts.map +1 -1
  176. package/lib/typescript/src/events.d.ts.map +1 -1
  177. package/lib/typescript/src/functions.d.ts +2 -0
  178. package/lib/typescript/src/functions.d.ts.map +1 -1
  179. package/lib/typescript/src/hooks/useCheckout.d.ts +21 -0
  180. package/lib/typescript/src/hooks/useCheckout.d.ts.map +1 -0
  181. package/lib/typescript/src/hooks/useOnramp.d.ts +9 -3
  182. package/lib/typescript/src/hooks/useOnramp.d.ts.map +1 -1
  183. package/lib/typescript/src/index.d.ts +3 -0
  184. package/lib/typescript/src/index.d.ts.map +1 -1
  185. package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts +1 -1
  186. package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts.map +1 -1
  187. package/lib/typescript/src/specs/NativePaymentMethodMessagingElement.d.ts +1 -6
  188. package/lib/typescript/src/specs/NativePaymentMethodMessagingElement.d.ts.map +1 -1
  189. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +16 -1
  190. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
  191. package/lib/typescript/src/types/Checkout.d.ts +336 -0
  192. package/lib/typescript/src/types/Checkout.d.ts.map +1 -0
  193. package/lib/typescript/src/types/NextAction.d.ts +8 -1
  194. package/lib/typescript/src/types/NextAction.d.ts.map +1 -1
  195. package/lib/typescript/src/types/Onramp.d.ts +40 -1
  196. package/lib/typescript/src/types/Onramp.d.ts.map +1 -1
  197. package/lib/typescript/src/types/PaymentIntent.d.ts +11 -1
  198. package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -1
  199. package/lib/typescript/src/types/PaymentMethod.d.ts +10 -6
  200. package/lib/typescript/src/types/PaymentMethod.d.ts.map +1 -1
  201. package/lib/typescript/src/types/PaymentSheet.d.ts +22 -6
  202. package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
  203. package/lib/typescript/src/types/components/PaymentMethodMessagingElementComponent.d.ts +16 -1
  204. package/lib/typescript/src/types/components/PaymentMethodMessagingElementComponent.d.ts.map +1 -1
  205. package/package.json +8 -5
  206. package/src/components/PaymentMethodMessagingElement.tsx +109 -0
  207. package/src/components/StripeProvider.tsx +1 -1
  208. package/src/connect/testUtils.ts +2 -0
  209. package/src/events.ts +9 -3
  210. package/src/functions.ts +1 -1
  211. package/src/hooks/useCheckout.tsx +168 -0
  212. package/src/hooks/useOnramp.tsx +45 -24
  213. package/src/index.tsx +4 -0
  214. package/src/specs/NativeOnrampSdkModule.ts +1 -1
  215. package/src/specs/NativePaymentMethodMessagingElement.ts +0 -7
  216. package/src/specs/NativeStripeSdkModule.ts +53 -1
  217. package/src/types/Checkout.ts +377 -0
  218. package/src/types/NextAction.ts +9 -0
  219. package/src/types/Onramp.ts +45 -1
  220. package/src/types/PaymentIntent.ts +10 -0
  221. package/src/types/PaymentMethod.ts +9 -6
  222. package/src/types/PaymentSheet.ts +29 -6
  223. package/src/types/components/PaymentMethodMessagingElementComponent.tsx +17 -1
  224. package/stripe-react-native.podspec +8 -8
  225. package/android/spotless.gradle +0 -19
  226. package/android/src/main/java/com/reactnativestripesdk/FakeOnrampSdkModule.kt +0 -155
@@ -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=23.3.+
6
+ StripeSdk_stripeVersion=23.6.+
@@ -0,0 +1,8 @@
1
+ ## This file must *NOT* be checked into Version Control Systems,
2
+ # as it contains information specific to your local configuration.
3
+ #
4
+ # Location of the SDK. This is only used by Gradle.
5
+ # For customization when using a Version Control System, please read the
6
+ # header note.
7
+ #Tue Jul 29 21:50:46 PDT 2025
8
+ sdk.dir=/Users/cttsai/Library/Android/sdk
@@ -353,7 +353,6 @@ class PaymentLauncherManager(
353
353
  StripeIntent.NextActionType.AlipayRedirect,
354
354
  StripeIntent.NextActionType.BlikAuthorize,
355
355
  StripeIntent.NextActionType.WeChatPayRedirect,
356
- StripeIntent.NextActionType.UpiAwaitNotification,
357
356
  StripeIntent.NextActionType.CashAppRedirect,
358
357
  StripeIntent.NextActionType.SwishRedirect,
359
358
  StripeIntent.NextActionType.DisplayPromptPayDetails,
@@ -42,6 +42,7 @@ class PaymentMethodCreateParamsFactory(
42
42
  PaymentMethod.Type.Bancontact -> createBancontactParams()
43
43
  PaymentMethod.Type.Billie -> createBillieParams()
44
44
  PaymentMethod.Type.SepaDebit -> createSepaParams()
45
+ PaymentMethod.Type.Multibanco -> createMultibancoParams()
45
46
  PaymentMethod.Type.Oxxo -> createOXXOParams()
46
47
  PaymentMethod.Type.Eps -> createEPSParams()
47
48
  PaymentMethod.Type.GrabPay -> createGrabPayParams()
@@ -131,6 +132,26 @@ class PaymentMethodCreateParamsFactory(
131
132
  throw PaymentMethodCreateParamsException("You must provide billing details")
132
133
  }
133
134
 
135
+ @Throws(PaymentMethodCreateParamsException::class)
136
+ private fun createMultibancoParams(): PaymentMethodCreateParams {
137
+ billingDetailsParams?.let {
138
+ if (it.email.isNullOrBlank()) {
139
+ throw PaymentMethodCreateParamsException(
140
+ "When creating a Multibanco payment method, you must provide the following billing details: email",
141
+ )
142
+ }
143
+
144
+ return PaymentMethodCreateParams.createMultibanco(
145
+ billingDetails = it,
146
+ metadata = metadataParams,
147
+ )
148
+ }
149
+
150
+ throw PaymentMethodCreateParamsException(
151
+ "When creating a Multibanco payment method, you must provide the following billing details: email",
152
+ )
153
+ }
154
+
134
155
  @Throws(PaymentMethodCreateParamsException::class)
135
156
  private fun createEPSParams(): PaymentMethodCreateParams {
136
157
  billingDetailsParams?.let {
@@ -255,6 +276,7 @@ class PaymentMethodCreateParamsFactory(
255
276
  PaymentMethod.Type.Bancontact,
256
277
  PaymentMethod.Type.Billie,
257
278
  PaymentMethod.Type.SepaDebit,
279
+ PaymentMethod.Type.Multibanco,
258
280
  PaymentMethod.Type.Oxxo,
259
281
  PaymentMethod.Type.Eps,
260
282
  PaymentMethod.Type.GrabPay,
@@ -77,14 +77,13 @@ private fun parseFont(
77
77
  "family",
78
78
  context,
79
79
  )
80
- val scaleFactor = map.getDoubleOrNull("scale") ?: 1.0
81
- val textSize: Double = 16 * scaleFactor
80
+ val size = map.getDoubleOrNull("size") ?: 16.0
82
81
 
83
82
  val font =
84
83
  PaymentMethodMessagingElement.Appearance
85
84
  .Font()
86
85
  .fontFamily(fontFamily)
87
- .fontSizeSp(textSize.toFloat())
86
+ .fontSizeSp(size.toFloat())
88
87
 
89
88
  return font
90
89
  }
@@ -25,6 +25,7 @@ import com.facebook.react.bridge.UiThreadUtil
25
25
  import com.facebook.react.bridge.WritableMap
26
26
  import com.facebook.react.bridge.WritableNativeMap
27
27
  import com.facebook.react.module.annotations.ReactModule
28
+ import com.facebook.react.modules.systeminfo.ReactNativeVersion
28
29
  import com.reactnativestripesdk.addresssheet.AddressLauncherManager
29
30
  import com.reactnativestripesdk.customersheet.CustomerSheetManager
30
31
  import com.reactnativestripesdk.pushprovisioning.PushProvisioningProxy
@@ -32,6 +33,8 @@ import com.reactnativestripesdk.utils.ConfirmPaymentErrorType
32
33
  import com.reactnativestripesdk.utils.CreateTokenErrorType
33
34
  import com.reactnativestripesdk.utils.ErrorType
34
35
  import com.reactnativestripesdk.utils.GooglePayErrorType
36
+ import com.reactnativestripesdk.utils.RetrievePaymentIntentErrorType
37
+ import com.reactnativestripesdk.utils.RetrieveSetupIntentErrorType
35
38
  import com.reactnativestripesdk.utils.StripeUIManager
36
39
  import com.reactnativestripesdk.utils.createCanAddCardResult
37
40
  import com.reactnativestripesdk.utils.createError
@@ -59,6 +62,7 @@ import com.stripe.android.PaymentConfiguration
59
62
  import com.stripe.android.Stripe
60
63
  import com.stripe.android.core.ApiVersion
61
64
  import com.stripe.android.core.AppInfo
65
+ import com.stripe.android.core.reactnative.ReactNativeAnalytics
62
66
  import com.stripe.android.core.reactnative.ReactNativeSdkInternal
63
67
  import com.stripe.android.customersheet.CustomerSheet
64
68
  import com.stripe.android.googlepaylauncher.GooglePayLauncher
@@ -213,10 +217,16 @@ class StripeSdkModule(
213
217
  ).toString()
214
218
  ),
215
219
  "appVersion" to (packageInfo?.versionName ?: ""),
220
+ "isNewArchitecture" to BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
221
+ "reactNativeVersion" to
222
+ with(ReactNativeVersion.VERSION) {
223
+ "${get("major")}.${get("minor")}.${get("patch")}"
224
+ },
216
225
  ),
217
226
  )
218
227
  }
219
228
 
229
+ @SuppressLint("RestrictedApi")
220
230
  @ReactMethod
221
231
  override fun initialise(
222
232
  params: ReadableMap,
@@ -246,6 +256,11 @@ class StripeSdkModule(
246
256
 
247
257
  PaymentConfiguration.init(reactApplicationContext, publishableKey, stripeAccountId)
248
258
 
259
+ ReactNativeAnalytics.isNewArchitecture = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
260
+ ReactNativeAnalytics.reactNativeVersion =
261
+ with(ReactNativeVersion.VERSION) {
262
+ "${get("major")}.${get("minor")}.${get("patch")}"
263
+ }
249
264
  preventActivityRecreation()
250
265
  setupComposeCompatView()
251
266
 
@@ -683,8 +698,12 @@ class StripeSdkModule(
683
698
  promise: Promise,
684
699
  ) {
685
700
  CoroutineScope(Dispatchers.IO).launch {
686
- val paymentIntent = stripe.retrievePaymentIntentSynchronous(clientSecret)
687
- promise.resolve(createResult("paymentIntent", mapFromPaymentIntentResult(paymentIntent)))
701
+ try {
702
+ val paymentIntent = stripe.retrievePaymentIntentSynchronous(clientSecret)
703
+ promise.resolve(createResult("paymentIntent", mapFromPaymentIntentResult(paymentIntent)))
704
+ } catch (e: Exception) {
705
+ promise.resolve(createError(RetrievePaymentIntentErrorType.Unknown.toString(), e))
706
+ }
688
707
  }
689
708
  }
690
709
 
@@ -694,8 +713,12 @@ class StripeSdkModule(
694
713
  promise: Promise,
695
714
  ) {
696
715
  CoroutineScope(Dispatchers.IO).launch {
697
- val setupIntent = stripe.retrieveSetupIntentSynchronous(clientSecret)
698
- promise.resolve(createResult("setupIntent", mapFromSetupIntentResult(setupIntent)))
716
+ try {
717
+ val setupIntent = stripe.retrieveSetupIntentSynchronous(clientSecret)
718
+ promise.resolve(createResult("setupIntent", mapFromSetupIntentResult(setupIntent)))
719
+ } catch (e: Exception) {
720
+ promise.resolve(createError(RetrieveSetupIntentErrorType.Unknown.toString(), e))
721
+ }
699
722
  }
700
723
  }
701
724
 
@@ -1672,6 +1695,61 @@ class StripeSdkModule(
1672
1695
  // noop, iOS only.
1673
1696
  }
1674
1697
 
1698
+ // Checkout Session stubs — real implementations in a future PR.
1699
+
1700
+ override fun initCheckoutSession(clientSecret: String, configuration: ReadableMap, promise: Promise) {
1701
+ promise.reject("NotImplemented", "Checkout is not yet implemented on Android")
1702
+ }
1703
+
1704
+ override fun checkoutUpdateShippingAddress(
1705
+ sessionKey: String,
1706
+ address: ReadableMap,
1707
+ name: String?,
1708
+ phone: String?,
1709
+ promise: Promise,
1710
+ ) {
1711
+ promise.reject("NotImplemented", "Checkout is not yet implemented on Android")
1712
+ }
1713
+
1714
+ override fun checkoutUpdateBillingAddress(
1715
+ sessionKey: String,
1716
+ address: ReadableMap,
1717
+ name: String?,
1718
+ phone: String?,
1719
+ promise: Promise,
1720
+ ) {
1721
+ promise.reject("NotImplemented", "Checkout is not yet implemented on Android")
1722
+ }
1723
+
1724
+ override fun checkoutApplyPromotionCode(sessionKey: String, code: String, promise: Promise) {
1725
+ promise.reject("NotImplemented", "Checkout is not yet implemented on Android")
1726
+ }
1727
+
1728
+ override fun checkoutRemovePromotionCode(sessionKey: String, promise: Promise) {
1729
+ promise.reject("NotImplemented", "Checkout is not yet implemented on Android")
1730
+ }
1731
+
1732
+ override fun checkoutUpdateLineItemQuantity(
1733
+ sessionKey: String,
1734
+ lineItemId: String,
1735
+ quantity: Double,
1736
+ promise: Promise,
1737
+ ) {
1738
+ promise.reject("NotImplemented", "Checkout is not yet implemented on Android")
1739
+ }
1740
+
1741
+ override fun checkoutSelectShippingOption(sessionKey: String, id: String, promise: Promise) {
1742
+ promise.reject("NotImplemented", "Checkout is not yet implemented on Android")
1743
+ }
1744
+
1745
+ override fun checkoutUpdateTaxId(sessionKey: String, type: String, value: String, promise: Promise) {
1746
+ promise.reject("NotImplemented", "Checkout is not yet implemented on Android")
1747
+ }
1748
+
1749
+ override fun checkoutRefresh(sessionKey: String, promise: Promise) {
1750
+ promise.reject("NotImplemented", "Checkout is not yet implemented on Android")
1751
+ }
1752
+
1675
1753
  /**
1676
1754
  * Safely get and cast the current activity as an AppCompatActivity. If that fails, the promise
1677
1755
  * provided will be resolved with an error message instructing the user to retry the method.
@@ -20,7 +20,7 @@ class StripeSdkPackage : BaseReactPackage() {
20
20
  when (name) {
21
21
  StripeSdkModule.NAME -> StripeSdkModule(reactContext)
22
22
  NativeOnrampSdkModuleSpec.NAME -> {
23
- val onrampModuleClass = getOnrampModuleClass()
23
+ val onrampModuleClass = getOnrampModuleClass() ?: return null
24
24
  val constructor = onrampModuleClass.getConstructor(ReactApplicationContext::class.java)
25
25
  constructor.newInstance(reactContext) as NativeModule
26
26
  }
@@ -29,10 +29,10 @@ class StripeSdkPackage : BaseReactPackage() {
29
29
 
30
30
  override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
31
31
  val moduleList: Array<Class<out NativeModule?>> =
32
- arrayOf(
32
+ listOfNotNull(
33
33
  StripeSdkModule::class.java,
34
34
  getOnrampModuleClass(),
35
- )
35
+ ).toTypedArray()
36
36
  val reactModuleInfoMap: MutableMap<String, ReactModuleInfo> = HashMap()
37
37
  for (moduleClass in moduleList) {
38
38
  val reactModule = moduleClass.getAnnotation(ReactModule::class.java) ?: continue
@@ -63,12 +63,12 @@ class StripeSdkPackage : BaseReactPackage() {
63
63
  PaymentMethodMessagingElementViewManager(),
64
64
  )
65
65
 
66
- private fun getOnrampModuleClass(): Class<out NativeModule?> {
66
+ private fun getOnrampModuleClass(): Class<out NativeModule?>? {
67
67
  if (BuildConfig.IS_ONRAMP_INCLUDED) {
68
68
  @Suppress("UNCHECKED_CAST")
69
69
  return Class.forName("com.reactnativestripesdk.OnrampSdkModule") as Class<out NativeModule?>
70
70
  } else {
71
- return FakeOnrampSdkModule::class.java
71
+ return null
72
72
  }
73
73
  }
74
74
  }
@@ -140,10 +140,10 @@ internal fun mapPaymentMethodType(type: PaymentMethod.Type?): String =
140
140
  PaymentMethod.Type.GrabPay -> "GrabPay"
141
141
  PaymentMethod.Type.Ideal -> "Ideal"
142
142
  PaymentMethod.Type.Netbanking -> "Netbanking"
143
+ PaymentMethod.Type.Multibanco -> "Multibanco"
143
144
  PaymentMethod.Type.Oxxo -> "Oxxo"
144
145
  PaymentMethod.Type.P24 -> "P24"
145
146
  PaymentMethod.Type.SepaDebit -> "SepaDebit"
146
- PaymentMethod.Type.Upi -> "Upi"
147
147
  PaymentMethod.Type.WeChatPay -> "WeChatPay"
148
148
  PaymentMethod.Type.Klarna -> "Klarna"
149
149
  PaymentMethod.Type.USBankAccount -> "USBankAccount"
@@ -171,10 +171,10 @@ internal fun mapToPaymentMethodType(type: String?): PaymentMethod.Type? =
171
171
  "Fpx" -> PaymentMethod.Type.Fpx
172
172
  "GrabPay" -> PaymentMethod.Type.GrabPay
173
173
  "Netbanking" -> PaymentMethod.Type.Netbanking
174
+ "Multibanco" -> PaymentMethod.Type.Multibanco
174
175
  "Oxxo" -> PaymentMethod.Type.Oxxo
175
176
  "P24" -> PaymentMethod.Type.P24
176
177
  "SepaDebit" -> PaymentMethod.Type.SepaDebit
177
- "Upi" -> PaymentMethod.Type.Upi
178
178
  "WeChatPay" -> PaymentMethod.Type.WeChatPay
179
179
  "Klarna" -> PaymentMethod.Type.Klarna
180
180
  "USBankAccount" -> PaymentMethod.Type.USBankAccount
@@ -434,7 +434,6 @@ internal fun mapFromPaymentMethod(paymentMethod: PaymentMethod): WritableMap {
434
434
  it.putString("bank", paymentMethod.fpx?.bank)
435
435
  },
436
436
  )
437
- pm.putMap("Upi", Arguments.createMap().also { it.putString("vpa", paymentMethod.upi?.vpa) })
438
437
  pm.putMap(
439
438
  "USBankAccount",
440
439
  Arguments.createMap().also {
@@ -558,7 +557,6 @@ internal fun mapNextAction(
558
557
  NextActionType.CashAppRedirect,
559
558
  NextActionType.BlikAuthorize,
560
559
  NextActionType.UseStripeSdk,
561
- NextActionType.UpiAwaitNotification,
562
560
  NextActionType.DisplayPayNowDetails,
563
561
  NextActionType.DisplayPromptPayDetails,
564
562
  null,
@@ -293,6 +293,42 @@ public abstract class NativeStripeSdkModuleSpec extends ReactContextBaseJavaModu
293
293
  @DoNotStrip
294
294
  public abstract void pollAndClearPendingStripeConnectUrls(Promise promise);
295
295
 
296
+ @ReactMethod
297
+ @DoNotStrip
298
+ public abstract void initCheckoutSession(String clientSecret, ReadableMap configuration, Promise promise);
299
+
300
+ @ReactMethod
301
+ @DoNotStrip
302
+ public abstract void checkoutUpdateShippingAddress(String sessionKey, ReadableMap address, @Nullable String name, @Nullable String phone, Promise promise);
303
+
304
+ @ReactMethod
305
+ @DoNotStrip
306
+ public abstract void checkoutUpdateBillingAddress(String sessionKey, ReadableMap address, @Nullable String name, @Nullable String phone, Promise promise);
307
+
308
+ @ReactMethod
309
+ @DoNotStrip
310
+ public abstract void checkoutApplyPromotionCode(String sessionKey, String code, Promise promise);
311
+
312
+ @ReactMethod
313
+ @DoNotStrip
314
+ public abstract void checkoutRemovePromotionCode(String sessionKey, Promise promise);
315
+
316
+ @ReactMethod
317
+ @DoNotStrip
318
+ public abstract void checkoutUpdateLineItemQuantity(String sessionKey, String lineItemId, double quantity, Promise promise);
319
+
320
+ @ReactMethod
321
+ @DoNotStrip
322
+ public abstract void checkoutSelectShippingOption(String sessionKey, String id, Promise promise);
323
+
324
+ @ReactMethod
325
+ @DoNotStrip
326
+ public abstract void checkoutUpdateTaxId(String sessionKey, String type, String value, Promise promise);
327
+
328
+ @ReactMethod
329
+ @DoNotStrip
330
+ public abstract void checkoutRefresh(String sessionKey, Promise promise);
331
+
296
332
  @ReactMethod
297
333
  @DoNotStrip
298
334
  public abstract void addListener(String eventType);
@@ -4,8 +4,10 @@ package com.reactnativestripesdk
4
4
 
5
5
  import android.annotation.SuppressLint
6
6
  import androidx.compose.ui.graphics.Color
7
+ import com.facebook.react.bridge.Arguments
7
8
  import com.facebook.react.bridge.ReadableMap
8
9
  import com.stripe.android.crypto.onramp.ExperimentalCryptoOnramp
10
+ import com.stripe.android.crypto.onramp.model.KycInfo
9
11
  import com.stripe.android.crypto.onramp.model.OnrampConfiguration
10
12
  import com.stripe.android.crypto.onramp.model.PaymentMethodDisplayData
11
13
  import com.stripe.android.googlepaylauncher.GooglePayEnvironment
@@ -14,6 +16,8 @@ import com.stripe.android.link.LinkAppearance
14
16
  import com.stripe.android.link.LinkAppearance.Colors
15
17
  import com.stripe.android.link.LinkAppearance.PrimaryButton
16
18
  import com.stripe.android.link.LinkAppearance.Style
19
+ import com.stripe.android.model.DateOfBirth
20
+ import com.stripe.android.paymentsheet.PaymentSheet
17
21
 
18
22
  @SuppressLint("RestrictedApi")
19
23
  internal fun mapConfig(
@@ -50,6 +54,8 @@ internal fun mapGooglePayConfig(params: ReadableMap?): GooglePayPaymentMethodLau
50
54
  val merchantName = params.getString("merchantName") ?: return null
51
55
  val existingPaymentMethodRequired =
52
56
  params.hasKey("existingPaymentMethodRequired") && params.getBoolean("existingPaymentMethodRequired")
57
+ val isEmailRequired = if (params.hasKey("isEmailRequired")) params.getBoolean("isEmailRequired") else false
58
+ val allowCreditCards = if (params.hasKey("allowCreditCards")) params.getBoolean("allowCreditCards") else true
53
59
 
54
60
  val billingAddressConfig =
55
61
  mapGooglePayBillingAddressConfig(params.getMap("billingAddressConfig"))
@@ -58,6 +64,8 @@ internal fun mapGooglePayConfig(params: ReadableMap?): GooglePayPaymentMethodLau
58
64
  environment = if (testEnv) GooglePayEnvironment.Test else GooglePayEnvironment.Production,
59
65
  merchantCountryCode = merchantCountryCode,
60
66
  merchantName = merchantName,
67
+ isEmailRequired = isEmailRequired,
68
+ allowCreditCards = allowCreditCards,
61
69
  billingAddressConfig = billingAddressConfig,
62
70
  existingPaymentMethodRequired = existingPaymentMethodRequired,
63
71
  )
@@ -159,3 +167,38 @@ internal fun mapPaymentDetailsType(type: PaymentMethodDisplayData.Type): String
159
167
  PaymentMethodDisplayData.Type.BankAccount -> "BankAccount"
160
168
  PaymentMethodDisplayData.Type.GooglePay -> "GooglePay"
161
169
  }
170
+
171
+ @OptIn(ExperimentalCryptoOnramp::class)
172
+ @SuppressLint("RestrictedApi")
173
+ internal fun mapFromKycInfo(kycInfo: KycInfo): ReadableMap {
174
+ val result = Arguments.createMap()
175
+
176
+ kycInfo.firstName?.let { result.putString("firstName", it) }
177
+ kycInfo.lastName?.let { result.putString("lastName", it) }
178
+ kycInfo.idNumber?.let { result.putString("idNumber", it) }
179
+ kycInfo.address?.let { result.putMap("address", mapFromKycAddress(it)) }
180
+ kycInfo.dateOfBirth?.let { result.putMap("dateOfBirth", mapFromDateOfBirth(it)) }
181
+
182
+ return result
183
+ }
184
+
185
+ private fun mapFromKycAddress(address: PaymentSheet.Address): ReadableMap {
186
+ val result = Arguments.createMap()
187
+
188
+ address.city?.let { result.putString("city", it) }
189
+ address.country?.let { result.putString("country", it) }
190
+ address.line1?.let { result.putString("line1", it) }
191
+ address.line2?.let { result.putString("line2", it) }
192
+ address.postalCode?.let { result.putString("postalCode", it) }
193
+ address.state?.let { result.putString("state", it) }
194
+
195
+ return result
196
+ }
197
+
198
+ private fun mapFromDateOfBirth(dateOfBirth: DateOfBirth): ReadableMap {
199
+ val result = Arguments.createMap()
200
+ result.putInt("day", dateOfBirth.day)
201
+ result.putInt("month", dateOfBirth.month)
202
+ result.putInt("year", dateOfBirth.year)
203
+ return result
204
+ }
@@ -418,6 +418,7 @@ class OnrampSdkModule(
418
418
  }
419
419
  val currencyCode = googlePayParams.getString("currencyCode") ?: ""
420
420
  val amount = googlePayParams.getDouble("amount").toLong()
421
+
421
422
  val transactionId = googlePayParams.getString("transactionId")
422
423
  val label = googlePayParams.getString("label")
423
424
 
@@ -722,7 +723,10 @@ class OnrampSdkModule(
722
723
  result.displayData.sublabel?.let { displayData.putString("sublabel", it) }
723
724
  displayData.putString("type", mapPaymentDetailsType(result.displayData.type))
724
725
 
725
- promise.resolve(createResult("displayData", displayData))
726
+ val map = Arguments.createMap()
727
+ map.putMap("displayData", displayData)
728
+ result.kycInfo?.let { map.putMap("kycInfo", mapFromKycInfo(it)) }
729
+ promise.resolve(map)
726
730
  }
727
731
  }
728
732
 
@@ -404,7 +404,7 @@ class PaymentMethodMessagingElementConfigTest {
404
404
  readableMapOf(
405
405
  "font" to
406
406
  readableMapOf(
407
- "scale" to 1.5,
407
+ "size" to 20,
408
408
  ),
409
409
  )
410
410
 
@@ -416,7 +416,7 @@ class PaymentMethodMessagingElementConfigTest {
416
416
  PaymentMethodMessagingElement.Appearance
417
417
  .Font()
418
418
  .fontFamily(null)
419
- .fontSizeSp((16 * 1.5).toFloat())
419
+ .fontSizeSp((20).toFloat())
420
420
  font(font)
421
421
  colors(PaymentMethodMessagingElement.Appearance.Colors())
422
422
  }
@@ -433,7 +433,7 @@ class PaymentMethodMessagingElementConfigTest {
433
433
  "linkTextColor" to "#00FFFF",
434
434
  "font" to
435
435
  readableMapOf(
436
- "scale" to 1.2,
436
+ "size" to 20,
437
437
  ),
438
438
  )
439
439
 
@@ -3,13 +3,18 @@ package com.reactnativestripesdk.mappers
3
3
  import android.annotation.SuppressLint
4
4
  import com.facebook.react.bridge.WritableMap
5
5
  import com.reactnativestripesdk.utils.createCanAddCardResult
6
+ import com.reactnativestripesdk.utils.mapNextAction
7
+ import com.reactnativestripesdk.utils.mapPaymentMethodType
6
8
  import com.reactnativestripesdk.utils.mapToAddress
7
9
  import com.reactnativestripesdk.utils.mapToBillingDetails
10
+ import com.reactnativestripesdk.utils.mapToPaymentMethodType
8
11
  import com.reactnativestripesdk.utils.mapToPreferredNetworks
9
12
  import com.reactnativestripesdk.utils.parseCustomPaymentMethods
10
13
  import com.reactnativestripesdk.utils.readableArrayOf
11
14
  import com.reactnativestripesdk.utils.readableMapOf
12
15
  import com.stripe.android.model.CardBrand
16
+ import com.stripe.android.model.PaymentMethod
17
+ import com.stripe.android.model.StripeIntent
13
18
  import org.junit.Assert
14
19
  import org.junit.Assert.assertEquals
15
20
  import org.junit.Assert.assertFalse
@@ -80,6 +85,34 @@ class MappersTest {
80
85
  Assert.assertNull(details?.getMap("token"))
81
86
  }
82
87
 
88
+ @Test
89
+ fun mapPaymentMethodType_Multibanco_ReturnsString() {
90
+ assertEquals("Multibanco", mapPaymentMethodType(PaymentMethod.Type.Multibanco))
91
+ }
92
+
93
+ @Test
94
+ fun mapToPaymentMethodType_Multibanco_ReturnsType() {
95
+ assertEquals(PaymentMethod.Type.Multibanco, mapToPaymentMethodType("Multibanco"))
96
+ }
97
+
98
+ @Test
99
+ fun mapNextAction_DisplayMultibancoDetails_ReturnsVoucherUrl() {
100
+ val result =
101
+ mapNextAction(
102
+ StripeIntent.NextActionType.DisplayMultibancoDetails,
103
+ StripeIntent.NextActionData.DisplayMultibancoDetails(
104
+ hostedVoucherUrl = "https://payments.stripe.com/multibanco/voucher",
105
+ ),
106
+ )
107
+
108
+ assertNotNull(result)
109
+ assertEquals("multibanco", result?.getString("type"))
110
+ assertEquals(
111
+ "https://payments.stripe.com/multibanco/voucher",
112
+ result?.getString("voucherURL"),
113
+ )
114
+ }
115
+
83
116
  // ============================================
84
117
  // mapToPreferredNetworks Tests
85
118
  // ============================================