@stripe/stripe-react-native 0.44.0 → 0.45.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 (314) hide show
  1. package/.clang-format +90 -0
  2. package/.editorconfig +3 -0
  3. package/CHANGELOG.md +7 -1
  4. package/android/build.gradle +89 -18
  5. package/android/gradle.properties +1 -1
  6. package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormViewManager.kt +15 -6
  7. package/android/src/main/java/com/reactnativestripesdk/CardChangeEvent.kt +56 -0
  8. package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +4 -4
  9. package/android/src/main/java/com/reactnativestripesdk/CardFieldViewManager.kt +55 -45
  10. package/android/src/main/java/com/reactnativestripesdk/{CardFocusEvent.kt → CardFocusChangeEvent.kt} +2 -2
  11. package/android/src/main/java/com/reactnativestripesdk/CardFormCompleteEvent.kt +17 -16
  12. package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +5 -5
  13. package/android/src/main/java/com/reactnativestripesdk/CardFormViewManager.kt +39 -33
  14. package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +4 -2
  15. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +182 -0
  16. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +231 -0
  17. package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +8 -5
  18. package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt +14 -6
  19. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +3 -1
  20. package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +17 -0
  21. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +266 -0
  22. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +8 -13
  23. package/android/src/main/java/com/reactnativestripesdk/StripeContainerManager.kt +11 -3
  24. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +106 -59
  25. package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +34 -4
  26. package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +33 -27
  27. package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +49 -24
  28. package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetFragment.kt +16 -3
  29. package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerAdapter.kt +11 -29
  30. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +36 -12
  31. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +5 -3
  32. package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +4 -0
  33. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +21 -0
  34. package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddToWalletButtonManagerDelegate.java +49 -0
  35. package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddToWalletButtonManagerInterface.java +25 -0
  36. package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddressSheetViewManagerDelegate.java +64 -0
  37. package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddressSheetViewManagerInterface.java +30 -0
  38. package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerDelegate.java +41 -0
  39. package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerInterface.java +20 -0
  40. package/android/src/oldarch/java/com/facebook/react/viewmanagers/AuBECSDebitFormManagerDelegate.java +36 -0
  41. package/android/src/oldarch/java/com/facebook/react/viewmanagers/AuBECSDebitFormManagerInterface.java +20 -0
  42. package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFieldManagerDelegate.java +73 -0
  43. package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFieldManagerInterface.java +31 -0
  44. package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFormManagerDelegate.java +67 -0
  45. package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFormManagerInterface.java +29 -0
  46. package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerDelegate.java +49 -0
  47. package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerInterface.java +21 -0
  48. package/android/src/oldarch/java/com/facebook/react/viewmanagers/GooglePayButtonManagerDelegate.java +38 -0
  49. package/android/src/oldarch/java/com/facebook/react/viewmanagers/GooglePayButtonManagerInterface.java +19 -0
  50. package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeContainerManagerDelegate.java +32 -0
  51. package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeContainerManagerInterface.java +17 -0
  52. package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +311 -0
  53. package/ios/AddressSheet/AddressSheetUtils.swift +21 -19
  54. package/ios/AddressSheet/AddressSheetView.swift +23 -17
  55. package/ios/ApplePayButtonManager.m +0 -1
  56. package/ios/ApplePayButtonManager.swift +1 -3
  57. package/ios/ApplePayButtonView.swift +25 -20
  58. package/ios/ApplePayViewController.swift +22 -22
  59. package/ios/AuBECSDebitFormView.swift +14 -8
  60. package/ios/CardFieldManager.swift +1 -4
  61. package/ios/CardFieldView.swift +28 -25
  62. package/ios/CardFormManager.swift +1 -4
  63. package/ios/CardFormView.swift +25 -16
  64. package/ios/CustomerSheet/CustomerSheetUtils.swift +12 -16
  65. package/ios/CustomerSheet/ReactNativeCustomerAdapter.swift +8 -8
  66. package/ios/EmbeddedPaymentElementManager.m +6 -0
  67. package/ios/EmbeddedPaymentElementView.swift +48 -0
  68. package/ios/NewArch/AddToWalletButtonComponentView.h +10 -0
  69. package/ios/NewArch/AddToWalletButtonComponentView.mm +93 -0
  70. package/ios/NewArch/AddressSheetViewComponentView.h +10 -0
  71. package/ios/NewArch/AddressSheetViewComponentView.mm +109 -0
  72. package/ios/NewArch/ApplePayButtonComponentView.h +10 -0
  73. package/ios/NewArch/ApplePayButtonComponentView.mm +124 -0
  74. package/ios/NewArch/AuBECSDebitFormComponentView.h +10 -0
  75. package/ios/NewArch/AuBECSDebitFormComponentView.mm +95 -0
  76. package/ios/NewArch/CardFieldComponentView.h +10 -0
  77. package/ios/NewArch/CardFieldComponentView.mm +125 -0
  78. package/ios/NewArch/CardFormComponentView.h +10 -0
  79. package/ios/NewArch/CardFormComponentView.mm +108 -0
  80. package/ios/NewArch/StripeContainerComponentView.h +10 -0
  81. package/ios/NewArch/StripeContainerComponentView.mm +74 -0
  82. package/ios/NewArch/StripeNewArchConversions.h +20 -0
  83. package/ios/NewArch/StripeNewArchConversions.mm +47 -0
  84. package/ios/OldArch/StripeSdkEventEmitterCompat.h +27 -0
  85. package/ios/OldArch/StripeSdkEventEmitterCompat.m +105 -0
  86. package/ios/PaymentOptionDisplayData+ReactNative.swift +55 -0
  87. package/ios/PaymentSheetAppearance.swift +194 -1
  88. package/ios/PushProvisioning/AddToWalletButtonView.swift +19 -13
  89. package/ios/StripeContainerView.swift +5 -3
  90. package/ios/StripeSdk.h +21 -0
  91. package/ios/StripeSdk.mm +415 -0
  92. package/ios/StripeSdkEmitter.swift +19 -0
  93. package/ios/{StripeSdk+CustomerSheet.swift → StripeSdkImpl+CustomerSheet.swift} +24 -25
  94. package/ios/StripeSdkImpl+Embedded.swift +327 -0
  95. package/ios/{StripeSdk+PaymentSheet.swift → StripeSdkImpl+PaymentSheet.swift} +18 -29
  96. package/ios/{StripeSdk.swift → StripeSdkImpl.swift} +50 -72
  97. package/ios/StripeSwiftInterop.h +25 -0
  98. package/ios/stripe_react_native.h +2 -0
  99. package/lib/commonjs/components/AddToWalletButton.js +1 -1
  100. package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
  101. package/lib/commonjs/components/AddressSheet.js +1 -1
  102. package/lib/commonjs/components/AddressSheet.js.map +1 -1
  103. package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
  104. package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
  105. package/lib/commonjs/components/CardField.js +1 -1
  106. package/lib/commonjs/components/CardField.js.map +1 -1
  107. package/lib/commonjs/components/CardForm.js +1 -1
  108. package/lib/commonjs/components/CardForm.js.map +1 -1
  109. package/lib/commonjs/components/CustomerSheet.js +1 -1
  110. package/lib/commonjs/components/CustomerSheet.js.map +1 -1
  111. package/lib/commonjs/components/PlatformPayButton.js +1 -1
  112. package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
  113. package/lib/commonjs/components/StripeContainer.js +1 -1
  114. package/lib/commonjs/components/StripeContainer.js.map +1 -1
  115. package/lib/commonjs/components/StripeProvider.js +1 -1
  116. package/lib/commonjs/components/StripeProvider.js.map +1 -1
  117. package/lib/commonjs/events.js +2 -0
  118. package/lib/commonjs/events.js.map +1 -0
  119. package/lib/commonjs/functions.js +1 -1
  120. package/lib/commonjs/functions.js.map +1 -1
  121. package/lib/commonjs/index.js +1 -1
  122. package/lib/commonjs/index.js.map +1 -1
  123. package/lib/commonjs/specs/NativeAddToWalletButton.js +2 -0
  124. package/lib/commonjs/specs/NativeAddToWalletButton.js.map +1 -0
  125. package/lib/commonjs/specs/NativeAddressSheet.js +2 -0
  126. package/lib/commonjs/specs/NativeAddressSheet.js.map +1 -0
  127. package/lib/commonjs/specs/NativeApplePayButton.js +2 -0
  128. package/lib/commonjs/specs/NativeApplePayButton.js.map +1 -0
  129. package/lib/commonjs/specs/NativeAuBECSDebitForm.js +2 -0
  130. package/lib/commonjs/specs/NativeAuBECSDebitForm.js.map +1 -0
  131. package/lib/commonjs/specs/NativeCardField.js +2 -0
  132. package/lib/commonjs/specs/NativeCardField.js.map +1 -0
  133. package/lib/commonjs/specs/NativeCardForm.js +2 -0
  134. package/lib/commonjs/specs/NativeCardForm.js.map +1 -0
  135. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +2 -0
  136. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -0
  137. package/lib/commonjs/specs/NativeGooglePayButton.js +2 -0
  138. package/lib/commonjs/specs/NativeGooglePayButton.js.map +1 -0
  139. package/lib/commonjs/specs/NativeStripeContainer.js +2 -0
  140. package/lib/commonjs/specs/NativeStripeContainer.js.map +1 -0
  141. package/lib/commonjs/specs/NativeStripeSdkModule.js +2 -0
  142. package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -0
  143. package/lib/commonjs/specs/utils.js +2 -0
  144. package/lib/commonjs/specs/utils.js.map +1 -0
  145. package/lib/commonjs/types/EmbeddedPaymentElement.js +2 -0
  146. package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -0
  147. package/lib/commonjs/types/PaymentSheet.js +1 -1
  148. package/lib/commonjs/types/PaymentSheet.js.map +1 -1
  149. package/lib/module/components/AddToWalletButton.js +1 -1
  150. package/lib/module/components/AddToWalletButton.js.map +1 -1
  151. package/lib/module/components/AddressSheet.js +1 -1
  152. package/lib/module/components/AddressSheet.js.map +1 -1
  153. package/lib/module/components/AuBECSDebitForm.js +1 -1
  154. package/lib/module/components/AuBECSDebitForm.js.map +1 -1
  155. package/lib/module/components/CardField.js +1 -1
  156. package/lib/module/components/CardField.js.map +1 -1
  157. package/lib/module/components/CardForm.js +1 -1
  158. package/lib/module/components/CardForm.js.map +1 -1
  159. package/lib/module/components/CustomerSheet.js +1 -1
  160. package/lib/module/components/CustomerSheet.js.map +1 -1
  161. package/lib/module/components/PlatformPayButton.js +1 -1
  162. package/lib/module/components/PlatformPayButton.js.map +1 -1
  163. package/lib/module/components/StripeContainer.js +1 -1
  164. package/lib/module/components/StripeContainer.js.map +1 -1
  165. package/lib/module/components/StripeProvider.js +1 -1
  166. package/lib/module/components/StripeProvider.js.map +1 -1
  167. package/lib/module/events.js +2 -0
  168. package/lib/module/events.js.map +1 -0
  169. package/lib/module/functions.js +1 -1
  170. package/lib/module/functions.js.map +1 -1
  171. package/lib/module/index.js +1 -1
  172. package/lib/module/index.js.map +1 -1
  173. package/lib/module/specs/NativeAddToWalletButton.js +2 -0
  174. package/lib/module/specs/NativeAddToWalletButton.js.map +1 -0
  175. package/lib/module/specs/NativeAddressSheet.js +2 -0
  176. package/lib/module/specs/NativeAddressSheet.js.map +1 -0
  177. package/lib/module/specs/NativeApplePayButton.js +2 -0
  178. package/lib/module/specs/NativeApplePayButton.js.map +1 -0
  179. package/lib/module/specs/NativeAuBECSDebitForm.js +2 -0
  180. package/lib/module/specs/NativeAuBECSDebitForm.js.map +1 -0
  181. package/lib/module/specs/NativeCardField.js +2 -0
  182. package/lib/module/specs/NativeCardField.js.map +1 -0
  183. package/lib/module/specs/NativeCardForm.js +2 -0
  184. package/lib/module/specs/NativeCardForm.js.map +1 -0
  185. package/lib/module/specs/NativeEmbeddedPaymentElement.js +2 -0
  186. package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -0
  187. package/lib/module/specs/NativeGooglePayButton.js +2 -0
  188. package/lib/module/specs/NativeGooglePayButton.js.map +1 -0
  189. package/lib/module/specs/NativeStripeContainer.js +2 -0
  190. package/lib/module/specs/NativeStripeContainer.js.map +1 -0
  191. package/lib/module/specs/NativeStripeSdkModule.js +2 -0
  192. package/lib/module/specs/NativeStripeSdkModule.js.map +1 -0
  193. package/lib/module/specs/utils.js +2 -0
  194. package/lib/module/specs/utils.js.map +1 -0
  195. package/lib/module/types/EmbeddedPaymentElement.js +2 -0
  196. package/lib/module/types/EmbeddedPaymentElement.js.map +1 -0
  197. package/lib/module/types/PaymentSheet.js +1 -1
  198. package/lib/module/types/PaymentSheet.js.map +1 -1
  199. package/lib/typescript/src/components/AddToWalletButton.d.ts.map +1 -1
  200. package/lib/typescript/src/components/AddressSheet.d.ts.map +1 -1
  201. package/lib/typescript/src/components/AuBECSDebitForm.d.ts.map +1 -1
  202. package/lib/typescript/src/components/CardField.d.ts +1 -1
  203. package/lib/typescript/src/components/CardField.d.ts.map +1 -1
  204. package/lib/typescript/src/components/CardForm.d.ts +1 -1
  205. package/lib/typescript/src/components/CardForm.d.ts.map +1 -1
  206. package/lib/typescript/src/components/CustomerSheet.d.ts +1 -1
  207. package/lib/typescript/src/components/CustomerSheet.d.ts.map +1 -1
  208. package/lib/typescript/src/components/StripeContainer.d.ts.map +1 -1
  209. package/lib/typescript/src/events.d.ts +13 -0
  210. package/lib/typescript/src/events.d.ts.map +1 -0
  211. package/lib/typescript/src/functions.d.ts.map +1 -1
  212. package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts +4 -4
  213. package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts.map +1 -1
  214. package/lib/typescript/src/hooks/useStripe.d.ts +2 -2
  215. package/lib/typescript/src/hooks/useStripe.d.ts.map +1 -1
  216. package/lib/typescript/src/index.d.ts +2 -0
  217. package/lib/typescript/src/index.d.ts.map +1 -1
  218. package/lib/typescript/src/specs/NativeAddToWalletButton.d.ts +27 -0
  219. package/lib/typescript/src/specs/NativeAddToWalletButton.d.ts.map +1 -0
  220. package/lib/typescript/src/specs/NativeAddressSheet.d.ts +34 -0
  221. package/lib/typescript/src/specs/NativeAddressSheet.d.ts.map +1 -0
  222. package/lib/typescript/src/specs/NativeApplePayButton.d.ts +28 -0
  223. package/lib/typescript/src/specs/NativeApplePayButton.d.ts.map +1 -0
  224. package/lib/typescript/src/specs/NativeAuBECSDebitForm.d.ts +19 -0
  225. package/lib/typescript/src/specs/NativeAuBECSDebitForm.d.ts.map +1 -0
  226. package/lib/typescript/src/specs/NativeCardField.d.ts +33 -0
  227. package/lib/typescript/src/specs/NativeCardField.d.ts.map +1 -0
  228. package/lib/typescript/src/specs/NativeCardForm.d.ts +31 -0
  229. package/lib/typescript/src/specs/NativeCardForm.d.ts.map +1 -0
  230. package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts +22 -0
  231. package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts.map +1 -0
  232. package/lib/typescript/src/specs/NativeGooglePayButton.d.ts +11 -0
  233. package/lib/typescript/src/specs/NativeGooglePayButton.d.ts.map +1 -0
  234. package/lib/typescript/src/specs/NativeStripeContainer.d.ts +8 -0
  235. package/lib/typescript/src/specs/NativeStripeContainer.d.ts.map +1 -0
  236. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +93 -0
  237. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -0
  238. package/lib/typescript/src/specs/utils.d.ts +20 -0
  239. package/lib/typescript/src/specs/utils.d.ts.map +1 -0
  240. package/lib/typescript/src/types/CustomerSheet.d.ts +1 -5
  241. package/lib/typescript/src/types/CustomerSheet.d.ts.map +1 -1
  242. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +161 -0
  243. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -0
  244. package/lib/typescript/src/types/PaymentSheet.d.ts +97 -4
  245. package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
  246. package/lib/typescript/src/types/components/CardFieldInput.d.ts +3 -2
  247. package/lib/typescript/src/types/components/CardFieldInput.d.ts.map +1 -1
  248. package/lib/typescript/src/types/components/CardFormView.d.ts +3 -1
  249. package/lib/typescript/src/types/components/CardFormView.d.ts.map +1 -1
  250. package/package.json +20 -1
  251. package/src/components/AddToWalletButton.tsx +2 -5
  252. package/src/components/AddressSheet.tsx +5 -16
  253. package/src/components/AuBECSDebitForm.tsx +3 -12
  254. package/src/components/CardField.tsx +20 -30
  255. package/src/components/CardForm.tsx +14 -29
  256. package/src/components/CustomerSheet.tsx +23 -25
  257. package/src/components/PlatformPayButton.tsx +6 -6
  258. package/src/components/StripeContainer.tsx +5 -12
  259. package/src/components/StripeProvider.tsx +1 -1
  260. package/src/events.ts +49 -0
  261. package/src/functions.ts +13 -24
  262. package/src/hooks/useFinancialConnectionsSheet.tsx +2 -2
  263. package/src/hooks/useStripe.tsx +2 -2
  264. package/src/index.tsx +3 -0
  265. package/src/specs/NativeAddToWalletButton.ts +40 -0
  266. package/src/specs/NativeAddressSheet.ts +50 -0
  267. package/src/specs/NativeApplePayButton.ts +40 -0
  268. package/src/specs/NativeAuBECSDebitForm.ts +24 -0
  269. package/src/specs/NativeCardField.ts +51 -0
  270. package/src/specs/NativeCardForm.ts +43 -0
  271. package/src/specs/NativeEmbeddedPaymentElement.ts +37 -0
  272. package/src/specs/NativeGooglePayButton.ts +20 -0
  273. package/src/specs/NativeStripeContainer.ts +12 -0
  274. package/src/specs/NativeStripeSdkModule.ts +219 -0
  275. package/src/specs/utils.ts +22 -0
  276. package/src/types/CustomerSheet.ts +1 -5
  277. package/src/types/EmbeddedPaymentElement.tsx +467 -0
  278. package/src/types/PaymentSheet.ts +114 -4
  279. package/src/types/components/CardFieldInput.ts +1 -2
  280. package/src/types/components/CardFormView.ts +1 -1
  281. package/stripe-react-native.podspec +27 -2
  282. package/android/.gradle/8.11.1/checksums/checksums.lock +0 -0
  283. package/android/.gradle/8.11.1/checksums/md5-checksums.bin +0 -0
  284. package/android/.gradle/8.11.1/checksums/sha1-checksums.bin +0 -0
  285. package/android/.gradle/8.11.1/executionHistory/executionHistory.lock +0 -0
  286. package/android/.gradle/8.11.1/fileChanges/last-build.bin +0 -0
  287. package/android/.gradle/8.11.1/fileHashes/fileHashes.lock +0 -0
  288. package/android/.gradle/8.11.1/gc.properties +0 -0
  289. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  290. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  291. package/android/.gradle/vcs-1/gc.properties +0 -0
  292. package/android/src/main/java/com/reactnativestripesdk/CardChangedEvent.kt +0 -54
  293. package/ios/StripeSdk.m +0 -244
  294. package/lib/commonjs/NativeStripeSdk.js +0 -2
  295. package/lib/commonjs/NativeStripeSdk.js.map +0 -1
  296. package/lib/commonjs/components/ApplePayButtonNative.js +0 -2
  297. package/lib/commonjs/components/ApplePayButtonNative.js.map +0 -1
  298. package/lib/commonjs/components/GooglePayButtonNative.js +0 -2
  299. package/lib/commonjs/components/GooglePayButtonNative.js.map +0 -1
  300. package/lib/module/NativeStripeSdk.js +0 -2
  301. package/lib/module/NativeStripeSdk.js.map +0 -1
  302. package/lib/module/components/ApplePayButtonNative.js +0 -2
  303. package/lib/module/components/ApplePayButtonNative.js.map +0 -1
  304. package/lib/module/components/GooglePayButtonNative.js +0 -2
  305. package/lib/module/components/GooglePayButtonNative.js.map +0 -1
  306. package/lib/typescript/src/NativeStripeSdk.d.ts +0 -58
  307. package/lib/typescript/src/NativeStripeSdk.d.ts.map +0 -1
  308. package/lib/typescript/src/components/ApplePayButtonNative.d.ts +0 -4
  309. package/lib/typescript/src/components/ApplePayButtonNative.d.ts.map +0 -1
  310. package/lib/typescript/src/components/GooglePayButtonNative.d.ts +0 -4
  311. package/lib/typescript/src/components/GooglePayButtonNative.d.ts.map +0 -1
  312. package/src/NativeStripeSdk.tsx +0 -159
  313. package/src/components/ApplePayButtonNative.tsx +0 -5
  314. package/src/components/GooglePayButtonNative.tsx +0 -7
@@ -44,11 +44,9 @@ class FinancialConnectionsSheetFragment : Fragment() {
44
44
  super.onCreate(savedInstanceState)
45
45
 
46
46
  val stripeSdkModule: StripeSdkModule? = context.getNativeModule(StripeSdkModule::class.java)
47
- if (stripeSdkModule != null && stripeSdkModule.eventListenerCount > 0) {
48
- FinancialConnections.setEventListener { event ->
49
- val params = mapFromFinancialConnectionsEvent(event)
50
- stripeSdkModule.sendEvent(context, "onFinancialConnectionsEvent", params)
51
- }
47
+ FinancialConnections.setEventListener { event ->
48
+ val params = mapFromFinancialConnectionsEvent(event)
49
+ stripeSdkModule?.emitOnFinancialConnectionsEvent(params)
52
50
  }
53
51
  }
54
52
 
@@ -70,6 +68,7 @@ class FinancialConnectionsSheetFragment : Fragment() {
70
68
  ::onFinancialConnectionsSheetForTokenResult,
71
69
  ).present(configuration = configuration)
72
70
  }
71
+
73
72
  Mode.ForSession -> {
74
73
  FinancialConnectionsSheet
75
74
  .create(this, ::onFinancialConnectionsSheetForDataResult)
@@ -90,9 +89,11 @@ class FinancialConnectionsSheetFragment : Fragment() {
90
89
  is FinancialConnectionsSheetForTokenResult.Canceled -> {
91
90
  promise.resolve(createError(ErrorType.Canceled.toString(), "The flow has been canceled"))
92
91
  }
92
+
93
93
  is FinancialConnectionsSheetForTokenResult.Failed -> {
94
94
  promise.resolve(createError(ErrorType.Failed.toString(), result.error))
95
95
  }
96
+
96
97
  is FinancialConnectionsSheetForTokenResult.Completed -> {
97
98
  promise.resolve(createTokenResult(result))
98
99
  (context.currentActivity as? FragmentActivity)
@@ -109,9 +110,11 @@ class FinancialConnectionsSheetFragment : Fragment() {
109
110
  is FinancialConnectionsSheetResult.Canceled -> {
110
111
  promise.resolve(createError(ErrorType.Canceled.toString(), "The flow has been canceled"))
111
112
  }
113
+
112
114
  is FinancialConnectionsSheetResult.Failed -> {
113
115
  promise.resolve(createError(ErrorType.Failed.toString(), result.error))
114
116
  }
117
+
115
118
  is FinancialConnectionsSheetResult.Completed -> {
116
119
  promise.resolve(
117
120
  WritableNativeMap().also {
@@ -4,11 +4,21 @@ import com.facebook.react.module.annotations.ReactModule
4
4
  import com.facebook.react.uimanager.SimpleViewManager
5
5
  import com.facebook.react.uimanager.ThemedReactContext
6
6
  import com.facebook.react.uimanager.annotations.ReactProp
7
+ import com.facebook.react.viewmanagers.GooglePayButtonManagerDelegate
8
+ import com.facebook.react.viewmanagers.GooglePayButtonManagerInterface
7
9
 
8
10
  @ReactModule(name = GooglePayButtonManager.REACT_CLASS)
9
- class GooglePayButtonManager : SimpleViewManager<GooglePayButtonView>() {
11
+ class GooglePayButtonManager :
12
+ SimpleViewManager<GooglePayButtonView>(),
13
+ GooglePayButtonManagerInterface<GooglePayButtonView> {
14
+ private val delegate = GooglePayButtonManagerDelegate(this)
15
+
10
16
  override fun getName() = REACT_CLASS
11
17
 
18
+ override fun getDelegate() = delegate
19
+
20
+ override fun createViewInstance(reactContext: ThemedReactContext): GooglePayButtonView = GooglePayButtonView(reactContext)
21
+
12
22
  override fun onAfterUpdateTransaction(view: GooglePayButtonView) {
13
23
  super.onAfterUpdateTransaction(view)
14
24
 
@@ -16,7 +26,7 @@ class GooglePayButtonManager : SimpleViewManager<GooglePayButtonView>() {
16
26
  }
17
27
 
18
28
  @ReactProp(name = "type")
19
- fun type(
29
+ override fun setType(
20
30
  view: GooglePayButtonView,
21
31
  buttonType: Int,
22
32
  ) {
@@ -24,7 +34,7 @@ class GooglePayButtonManager : SimpleViewManager<GooglePayButtonView>() {
24
34
  }
25
35
 
26
36
  @ReactProp(name = "appearance")
27
- fun appearance(
37
+ override fun setAppearance(
28
38
  view: GooglePayButtonView,
29
39
  appearance: Int,
30
40
  ) {
@@ -32,15 +42,13 @@ class GooglePayButtonManager : SimpleViewManager<GooglePayButtonView>() {
32
42
  }
33
43
 
34
44
  @ReactProp(name = "borderRadius")
35
- fun borderRadius(
45
+ override fun setBorderRadius(
36
46
  view: GooglePayButtonView,
37
47
  borderRadius: Int,
38
48
  ) {
39
49
  view.setBorderRadius(borderRadius)
40
50
  }
41
51
 
42
- override fun createViewInstance(reactContext: ThemedReactContext): GooglePayButtonView = GooglePayButtonView(reactContext)
43
-
44
52
  companion object {
45
53
  const val REACT_CLASS = "GooglePayButton"
46
54
  }
@@ -19,7 +19,7 @@ import com.stripe.android.model.PaymentMethodOptionsParams
19
19
 
20
20
  class PaymentMethodCreateParamsFactory(
21
21
  private val paymentMethodData: ReadableMap?,
22
- private val options: ReadableMap,
22
+ private val options: ReadableMap?,
23
23
  private val cardFieldView: CardFieldView?,
24
24
  private val cardFormView: CardFormView?,
25
25
  ) {
@@ -267,6 +267,7 @@ class PaymentMethodCreateParamsFactory(
267
267
  PaymentMethod.Type.Card -> createCardStripeIntentParams(clientSecret, isPaymentIntent)
268
268
  PaymentMethod.Type.USBankAccount ->
269
269
  createUSBankAccountStripeIntentParams(clientSecret, isPaymentIntent)
270
+
270
271
  PaymentMethod.Type.Affirm -> createAffirmStripeIntentParams(clientSecret, isPaymentIntent)
271
272
  PaymentMethod.Type.Ideal,
272
273
  PaymentMethod.Type.Alipay,
@@ -304,6 +305,7 @@ class PaymentMethodCreateParamsFactory(
304
305
  )
305
306
  }
306
307
  }
308
+
307
309
  null -> ConfirmPaymentIntentParams.create(clientSecret)
308
310
  else -> {
309
311
  throw Exception("This paymentMethodType is not supported yet")
@@ -0,0 +1,17 @@
1
+ import com.facebook.react.bridge.Arguments
2
+ import com.facebook.react.bridge.WritableMap
3
+ import com.reactnativestripesdk.utils.mapFromPaymentSheetBillingDetails
4
+ import com.stripe.android.paymentelement.EmbeddedPaymentElement
5
+ import com.stripe.android.paymentelement.ExperimentalEmbeddedPaymentElementApi
6
+
7
+ /**
8
+ * Serialize Stripe's PaymentOptionDisplayData into a WritableMap
9
+ * that can be sent over the RN bridge.
10
+ */
11
+ @OptIn(ExperimentalEmbeddedPaymentElementApi::class)
12
+ fun EmbeddedPaymentElement.PaymentOptionDisplayData.toWritableMap(): WritableMap =
13
+ Arguments.createMap().apply {
14
+ putString("label", label)
15
+ putString("paymentMethodType", paymentMethodType)
16
+ putMap("billingDetails", mapFromPaymentSheetBillingDetails(billingDetails))
17
+ }
@@ -1,11 +1,15 @@
1
1
  package com.reactnativestripesdk
2
2
 
3
+ import android.annotation.SuppressLint
3
4
  import android.content.Context
5
+ import android.content.res.Configuration
4
6
  import android.graphics.Color
5
7
  import android.os.Bundle
6
8
  import com.reactnativestripesdk.utils.PaymentSheetAppearanceException
9
+ import com.stripe.android.paymentelement.ExperimentalEmbeddedPaymentElementApi
7
10
  import com.stripe.android.paymentsheet.PaymentSheet
8
11
 
12
+ @SuppressLint("RestrictedApi")
9
13
  fun buildPaymentSheetAppearance(
10
14
  userParams: Bundle?,
11
15
  context: Context,
@@ -14,6 +18,28 @@ fun buildPaymentSheetAppearance(
14
18
  val lightColorParams = colorParams?.getBundle(PaymentSheetAppearanceKeys.LIGHT) ?: colorParams
15
19
  val darkColorParams = colorParams?.getBundle(PaymentSheetAppearanceKeys.DARK) ?: colorParams
16
20
 
21
+ val embeddedAppearance =
22
+ buildEmbeddedAppearance(
23
+ userParams?.getBundle(PaymentSheetAppearanceKeys.EMBEDDED_PAYMENT_ELEMENT),
24
+ lightColorParams,
25
+ context,
26
+ )
27
+
28
+ embeddedAppearance?.let {
29
+ return PaymentSheet.Appearance(
30
+ typography = buildTypography(userParams?.getBundle(PaymentSheetAppearanceKeys.FONT), context),
31
+ colorsLight = buildColors(lightColorParams, PaymentSheet.Colors.defaultLight),
32
+ colorsDark = buildColors(darkColorParams, PaymentSheet.Colors.defaultDark),
33
+ shapes = buildShapes(userParams?.getBundle(PaymentSheetAppearanceKeys.SHAPES)),
34
+ primaryButton =
35
+ buildPrimaryButton(
36
+ userParams?.getBundle(PaymentSheetAppearanceKeys.PRIMARY_BUTTON),
37
+ context,
38
+ ),
39
+ embeddedAppearance = embeddedAppearance,
40
+ )
41
+ }
42
+
17
43
  return PaymentSheet.Appearance(
18
44
  typography = buildTypography(userParams?.getBundle(PaymentSheetAppearanceKeys.FONT), context),
19
45
  colorsLight = buildColors(lightColorParams, PaymentSheet.Colors.defaultLight),
@@ -213,6 +239,205 @@ private fun buildPrimaryButtonColors(
213
239
  ),
214
240
  )
215
241
 
242
+ @OptIn(ExperimentalEmbeddedPaymentElementApi::class)
243
+ @SuppressLint("RestrictedApi")
244
+ @Throws(PaymentSheetAppearanceException::class)
245
+ private fun buildEmbeddedAppearance(
246
+ embeddedParams: Bundle?,
247
+ defaultColorsBundle: Bundle?,
248
+ context: Context,
249
+ ): PaymentSheet.Appearance.Embedded? {
250
+ if (embeddedParams == null) {
251
+ return null
252
+ }
253
+
254
+ val rowParams =
255
+ getBundleOrNull(embeddedParams, PaymentSheetAppearanceKeys.ROW)
256
+ ?: return null
257
+
258
+ val defaultColors = buildColors(defaultColorsBundle, PaymentSheet.Colors.defaultLight)
259
+
260
+ // Default style
261
+ val styleString = rowParams.getString(PaymentSheetAppearanceKeys.STYLE, "flatWithRadio")
262
+
263
+ val defaultAdditionalInsetsDp = 6.0f
264
+ val defaultSeparatorThicknessDp = 1.0f
265
+ val defaultSpacingDp = 12.0f
266
+ val defaultCheckmarkInsetDp = 0f
267
+
268
+ val additionalInsets = getFloatOr(rowParams, PaymentSheetAppearanceKeys.ADDITIONAL_INSETS, defaultAdditionalInsetsDp)
269
+
270
+ val rowStyle: PaymentSheet.Appearance.Embedded.RowStyle =
271
+ when (styleString) {
272
+ "flatWithRadio" -> {
273
+ val flatParams = getBundleOrNull(rowParams, PaymentSheetAppearanceKeys.FLAT)
274
+ val radioParams = getBundleOrNull(flatParams, PaymentSheetAppearanceKeys.RADIO)
275
+ val separatorInsetsParams = getBundleOrNull(flatParams, PaymentSheetAppearanceKeys.SEPARATOR_INSETS)
276
+
277
+ // Default separator insets specific to FlatWithRadio
278
+ val defaultSeparatorStartInsetDp = 30.0f
279
+ val defaultSeparatorEndInsetDp = 0.0f
280
+
281
+ // Parse dimensions as Floats
282
+ val separatorThickness = getFloatOr(flatParams, PaymentSheetAppearanceKeys.SEPARATOR_THICKNESS, defaultSeparatorThicknessDp)
283
+ val startSeparatorInset = getFloatOr(separatorInsetsParams, PaymentSheetAppearanceKeys.LEFT, defaultSeparatorStartInsetDp)
284
+ val endSeparatorInset = getFloatOr(separatorInsetsParams, PaymentSheetAppearanceKeys.RIGHT, defaultSeparatorEndInsetDp)
285
+
286
+ // Parse booleans
287
+ val topEnabled = getBooleanOr(flatParams, PaymentSheetAppearanceKeys.TOP_SEPARATOR_ENABLED, true)
288
+ val bottomEnabled = getBooleanOr(flatParams, PaymentSheetAppearanceKeys.BOTTOM_SEPARATOR_ENABLED, true)
289
+
290
+ // Parse individual colors using default colors
291
+ val parsedSeparatorColor =
292
+ dynamicColorFromParams(
293
+ context,
294
+ flatParams,
295
+ PaymentSheetAppearanceKeys.SEPARATOR_COLOR,
296
+ defaultColors.componentBorder,
297
+ )
298
+
299
+ val parsedSelectedColor =
300
+ dynamicColorFromParams(
301
+ context,
302
+ radioParams,
303
+ PaymentSheetAppearanceKeys.SELECTED_COLOR,
304
+ defaultColors.primary,
305
+ )
306
+
307
+ val parsedUnselectedColor =
308
+ dynamicColorFromParams(
309
+ context,
310
+ radioParams,
311
+ PaymentSheetAppearanceKeys.UNSELECTED_COLOR,
312
+ defaultColors.componentBorder,
313
+ )
314
+
315
+ val flatRadioColors =
316
+ PaymentSheet.Appearance.Embedded.RowStyle.FlatWithRadio.Colors(
317
+ separatorColor = parsedSeparatorColor,
318
+ unselectedColor = parsedUnselectedColor,
319
+ selectedColor = parsedSelectedColor,
320
+ )
321
+
322
+ PaymentSheet.Appearance.Embedded.RowStyle.FlatWithRadio(
323
+ separatorThicknessDp = separatorThickness,
324
+ startSeparatorInsetDp = startSeparatorInset,
325
+ endSeparatorInsetDp = endSeparatorInset,
326
+ topSeparatorEnabled = topEnabled,
327
+ bottomSeparatorEnabled = bottomEnabled,
328
+ additionalVerticalInsetsDp = additionalInsets,
329
+ horizontalInsetsDp = 0.0F, // We do not have an iOS equal for this API so it's not configurable in React Native
330
+ colorsLight = flatRadioColors,
331
+ colorsDark = flatRadioColors,
332
+ )
333
+ }
334
+ "flatWithCheckmark" -> {
335
+ val flatParams = getBundleOrNull(rowParams, PaymentSheetAppearanceKeys.FLAT)
336
+ val checkmarkParams = getBundleOrNull(flatParams, PaymentSheetAppearanceKeys.CHECKMARK)
337
+ val separatorInsetsParams = getBundleOrNull(flatParams, PaymentSheetAppearanceKeys.SEPARATOR_INSETS)
338
+
339
+ // Default separator insets specific to FlatWithCheckmark
340
+ val defaultSeparatorStartInsetDp = 0.0f
341
+ val defaultSeparatorEndInsetDp = 0.0f
342
+
343
+ // Parse dimensions as Floats
344
+ val separatorThickness = getFloatOr(flatParams, PaymentSheetAppearanceKeys.SEPARATOR_THICKNESS, defaultSeparatorThicknessDp)
345
+ val startSeparatorInset = getFloatOr(separatorInsetsParams, PaymentSheetAppearanceKeys.LEFT, defaultSeparatorStartInsetDp)
346
+ val endSeparatorInset = getFloatOr(separatorInsetsParams, PaymentSheetAppearanceKeys.RIGHT, defaultSeparatorEndInsetDp)
347
+ val checkmarkInset = getFloatOr(checkmarkParams, PaymentSheetAppearanceKeys.CHECKMARK_INSET, defaultCheckmarkInsetDp)
348
+
349
+ // Parse booleans
350
+ val topEnabled = getBooleanOr(flatParams, PaymentSheetAppearanceKeys.TOP_SEPARATOR_ENABLED, true)
351
+ val bottomEnabled = getBooleanOr(flatParams, PaymentSheetAppearanceKeys.BOTTOM_SEPARATOR_ENABLED, true)
352
+
353
+ // Parse individual colors using root defaults
354
+ val parsedSeparatorColor =
355
+ dynamicColorFromParams(
356
+ context,
357
+ flatParams,
358
+ PaymentSheetAppearanceKeys.SEPARATOR_COLOR,
359
+ defaultColors.componentBorder,
360
+ )
361
+
362
+ val parsedCheckmarkColor =
363
+ dynamicColorFromParams(
364
+ context,
365
+ checkmarkParams,
366
+ PaymentSheetAppearanceKeys.COLOR,
367
+ defaultColors.primary,
368
+ )
369
+
370
+ // Create the required Colors object
371
+ val flatCheckmarkColors =
372
+ PaymentSheet.Appearance.Embedded.RowStyle.FlatWithCheckmark.Colors(
373
+ separatorColor = parsedSeparatorColor,
374
+ checkmarkColor = parsedCheckmarkColor,
375
+ )
376
+
377
+ PaymentSheet.Appearance.Embedded.RowStyle.FlatWithCheckmark(
378
+ separatorThicknessDp = separatorThickness,
379
+ startSeparatorInsetDp = startSeparatorInset,
380
+ endSeparatorInsetDp = endSeparatorInset,
381
+ topSeparatorEnabled = topEnabled,
382
+ bottomSeparatorEnabled = bottomEnabled,
383
+ checkmarkInsetDp = checkmarkInset,
384
+ additionalVerticalInsetsDp = additionalInsets,
385
+ horizontalInsetsDp = 0.0F, // We do not have an iOS equal for this API so it's not configurable in React Native
386
+ colorsLight = flatCheckmarkColors,
387
+ colorsDark = flatCheckmarkColors,
388
+ )
389
+ }
390
+ "floatingButton" -> {
391
+ val floatingParams = getBundleOrNull(rowParams, PaymentSheetAppearanceKeys.FLOATING)
392
+ PaymentSheet.Appearance.Embedded.RowStyle.FloatingButton(
393
+ additionalInsetsDp = additionalInsets,
394
+ spacingDp = getFloatOr(floatingParams, PaymentSheetAppearanceKeys.SPACING, defaultSpacingDp),
395
+ )
396
+ }
397
+ else -> {
398
+ System.err.println("WARN: Unsupported embedded payment element row style received: $styleString. Falling back to default.")
399
+ return null
400
+ }
401
+ }
402
+
403
+ return PaymentSheet.Appearance.Embedded(style = rowStyle)
404
+ }
405
+
406
+ /**
407
+ * Pulls a light/dark hex‑string map out of [params],
408
+ * chooses the right one based on the current UI mode,
409
+ * and parses it (falling back to [defaultColor]).
410
+ */
411
+ private fun dynamicColorFromParams(
412
+ context: Context,
413
+ params: Bundle?,
414
+ key: String,
415
+ defaultColor: Int,
416
+ ): Int {
417
+ // Expect a nested Bundle { "light": "#RRGGBB", "dark": "#RRGGBB" }
418
+ val colorBundle = params?.getBundle(key)
419
+ if (colorBundle != null) {
420
+ val isDark =
421
+ (
422
+ context.resources.configuration.uiMode
423
+ and Configuration.UI_MODE_NIGHT_MASK
424
+ ) == Configuration.UI_MODE_NIGHT_YES
425
+
426
+ // Pick the hex for current mode, or null
427
+ val hex =
428
+ if (isDark) {
429
+ colorBundle.getString(PaymentSheetAppearanceKeys.DARK)
430
+ } else {
431
+ colorBundle.getString(PaymentSheetAppearanceKeys.LIGHT)
432
+ }
433
+
434
+ return colorFromHexOrDefault(hex, defaultColor)
435
+ }
436
+
437
+ // no override bundle → just use default
438
+ return defaultColor
439
+ }
440
+
216
441
  private fun getDoubleOrNull(
217
442
  bundle: Bundle?,
218
443
  key: String,
@@ -250,6 +475,22 @@ private fun getFloatOr(
250
475
  return defaultValue
251
476
  }
252
477
 
478
+ private fun getBundleOrNull(
479
+ bundle: Bundle?,
480
+ key: String,
481
+ ): Bundle? = bundle?.getBundle(key)
482
+
483
+ private fun getBooleanOr(
484
+ bundle: Bundle?,
485
+ key: String,
486
+ defaultValue: Boolean,
487
+ ): Boolean =
488
+ if (bundle?.containsKey(key) == true) {
489
+ bundle.getBoolean(key)
490
+ } else {
491
+ defaultValue
492
+ }
493
+
253
494
  private fun getFloatOrNull(
254
495
  bundle: Bundle?,
255
496
  key: String,
@@ -327,5 +568,30 @@ private class PaymentSheetAppearanceKeys {
327
568
  const val PRIMARY_BUTTON = "primaryButton"
328
569
  const val TEXT = "text"
329
570
  const val BORDER = "border"
571
+
572
+ const val EMBEDDED_PAYMENT_ELEMENT = "embeddedPaymentElement"
573
+ const val ROW = "row"
574
+ const val STYLE = "style"
575
+ const val ADDITIONAL_INSETS = "additionalInsets"
576
+
577
+ const val FLAT = "flat"
578
+ const val SEPARATOR_THICKNESS = "separatorThickness"
579
+ const val SEPARATOR_COLOR = "separatorColor"
580
+ const val SEPARATOR_INSETS = "separatorInsets"
581
+ const val TOP_SEPARATOR_ENABLED = "topSeparatorEnabled"
582
+ const val BOTTOM_SEPARATOR_ENABLED = "bottomSeparatorEnabled"
583
+ const val RADIO = "radio"
584
+ const val SELECTED_COLOR = "selectedColor"
585
+ const val UNSELECTED_COLOR = "unselectedColor"
586
+ const val CHECKMARK = "checkmark"
587
+ const val COLOR = "color"
588
+ const val CHECKMARK_INSET = "inset"
589
+
590
+ const val FLOATING = "floating"
591
+ const val SPACING = "spacing"
592
+
593
+ // Keys for EdgeInsetsConfig
594
+ const val LEFT = "left"
595
+ const val RIGHT = "right"
330
596
  }
331
597
  }
@@ -163,11 +163,13 @@ class PaymentSheetFragment(
163
163
  ),
164
164
  )
165
165
  }
166
+
166
167
  is PaymentSheetResult.Failed -> {
167
168
  resolvePaymentResult(
168
169
  createError(PaymentSheetErrorType.Failed.toString(), paymentResult.error),
169
170
  )
170
171
  }
172
+
171
173
  is PaymentSheetResult.Completed -> {
172
174
  resolvePaymentResult(WritableNativeMap())
173
175
  // Remove the fragment now, we can be sure it won't be needed again if an intent is
@@ -183,22 +185,13 @@ class PaymentSheetFragment(
183
185
  val createIntentCallback =
184
186
  CreateIntentCallback { paymentMethod, shouldSavePaymentMethod ->
185
187
  val stripeSdkModule: StripeSdkModule? = context.getNativeModule(StripeSdkModule::class.java)
186
- if (stripeSdkModule == null || stripeSdkModule.eventListenerCount == 0) {
187
- return@CreateIntentCallback CreateIntentResult.Failure(
188
- cause =
189
- Exception(
190
- "Tried to call confirmHandler, but no callback was found. Please file an issue: https://github.com/stripe/stripe-react-native/issues",
191
- ),
192
- displayMessage = "An unexpected error occurred",
193
- )
194
- }
195
188
  val params =
196
189
  Arguments.createMap().apply {
197
190
  putMap("paymentMethod", mapFromPaymentMethod(paymentMethod))
198
191
  putBoolean("shouldSavePaymentMethod", shouldSavePaymentMethod)
199
192
  }
200
193
 
201
- stripeSdkModule.sendEvent(context, "onConfirmHandlerCallback", params)
194
+ stripeSdkModule?.emitOnConfirmHandlerCallback(params)
202
195
 
203
196
  val resultFromJavascript = paymentSheetIntentCreationCallback.await()
204
197
  // reset the completable
@@ -352,7 +345,8 @@ class PaymentSheetFragment(
352
345
  override fun onActivitySaveInstanceState(
353
346
  activity: Activity,
354
347
  outState: Bundle,
355
- ) {}
348
+ ) {
349
+ }
356
350
 
357
351
  override fun onActivityDestroyed(activity: Activity) {
358
352
  paymentSheetActivity = null
@@ -509,7 +503,7 @@ class PaymentSheetFragment(
509
503
  }
510
504
 
511
505
  @Throws(PaymentSheetException::class)
512
- private fun buildIntentConfiguration(intentConfigurationParams: Bundle?): PaymentSheet.IntentConfiguration? {
506
+ internal fun buildIntentConfiguration(intentConfigurationParams: Bundle?): PaymentSheet.IntentConfiguration? {
513
507
  if (intentConfigurationParams == null) {
514
508
  return null
515
509
  }
@@ -556,7 +550,7 @@ class PaymentSheetFragment(
556
550
 
557
551
  @OptIn(ExperimentalCustomerSessionApi::class)
558
552
  @Throws(PaymentSheetException::class)
559
- private fun buildCustomerConfiguration(bundle: Bundle?): PaymentSheet.CustomerConfiguration? {
553
+ internal fun buildCustomerConfiguration(bundle: Bundle?): PaymentSheet.CustomerConfiguration? {
560
554
  val customerId = bundle?.getString("customerId").orEmpty()
561
555
  val customerEphemeralKeySecret = bundle?.getString("customerEphemeralKeySecret").orEmpty()
562
556
  val customerSessionClientSecret = bundle?.getString("customerSessionClientSecret").orEmpty()
@@ -638,6 +632,7 @@ fun mapToAddressCollectionMode(str: String?): PaymentSheet.BillingDetailsCollect
638
632
  when (str) {
639
633
  "automatic" ->
640
634
  PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode.Automatic
635
+
641
636
  "never" -> PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode.Never
642
637
  "full" -> PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode.Full
643
638
  else -> PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode.Automatic
@@ -4,20 +4,28 @@ import com.facebook.react.module.annotations.ReactModule
4
4
  import com.facebook.react.uimanager.ThemedReactContext
5
5
  import com.facebook.react.uimanager.ViewGroupManager
6
6
  import com.facebook.react.uimanager.annotations.ReactProp
7
+ import com.facebook.react.viewmanagers.StripeContainerManagerDelegate
8
+ import com.facebook.react.viewmanagers.StripeContainerManagerInterface
7
9
 
8
10
  @ReactModule(name = StripeContainerManager.REACT_CLASS)
9
- class StripeContainerManager : ViewGroupManager<StripeContainerView>() {
11
+ class StripeContainerManager :
12
+ ViewGroupManager<StripeContainerView>(),
13
+ StripeContainerManagerInterface<StripeContainerView> {
14
+ private val delegate = StripeContainerManagerDelegate(this)
15
+
10
16
  override fun getName() = REACT_CLASS
11
17
 
18
+ override fun getDelegate() = delegate
19
+
12
20
  @ReactProp(name = "keyboardShouldPersistTaps")
13
- fun setKeyboardShouldPersistTaps(
21
+ override fun setKeyboardShouldPersistTaps(
14
22
  view: StripeContainerView,
15
23
  keyboardShouldPersistTaps: Boolean,
16
24
  ) {
17
25
  view.setKeyboardShouldPersistTaps(keyboardShouldPersistTaps)
18
26
  }
19
27
 
20
- override fun createViewInstance(reactContext: ThemedReactContext): StripeContainerView = StripeContainerView(reactContext)
28
+ override fun createViewInstance(reactContext: ThemedReactContext) = StripeContainerView(reactContext)
21
29
 
22
30
  companion object {
23
31
  const val REACT_CLASS = "StripeContainer"