@stripe/stripe-react-native 0.43.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 (319) hide show
  1. package/.clang-format +90 -0
  2. package/.editorconfig +3 -0
  3. package/CHANGELOG.md +19 -1
  4. package/android/build.gradle +89 -17
  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 +28 -13
  23. package/android/src/main/java/com/reactnativestripesdk/StripeContainerManager.kt +11 -3
  24. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +108 -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 +6 -6
  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 -24
  94. package/ios/StripeSdkImpl+Embedded.swift +327 -0
  95. package/ios/{StripeSdk+PaymentSheet.swift → StripeSdkImpl+PaymentSheet.swift} +61 -49
  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/helpers.js +1 -1
  122. package/lib/commonjs/helpers.js.map +1 -1
  123. package/lib/commonjs/index.js +1 -1
  124. package/lib/commonjs/index.js.map +1 -1
  125. package/lib/commonjs/specs/NativeAddToWalletButton.js +2 -0
  126. package/lib/commonjs/specs/NativeAddToWalletButton.js.map +1 -0
  127. package/lib/commonjs/specs/NativeAddressSheet.js +2 -0
  128. package/lib/commonjs/specs/NativeAddressSheet.js.map +1 -0
  129. package/lib/commonjs/specs/NativeApplePayButton.js +2 -0
  130. package/lib/commonjs/specs/NativeApplePayButton.js.map +1 -0
  131. package/lib/commonjs/specs/NativeAuBECSDebitForm.js +2 -0
  132. package/lib/commonjs/specs/NativeAuBECSDebitForm.js.map +1 -0
  133. package/lib/commonjs/specs/NativeCardField.js +2 -0
  134. package/lib/commonjs/specs/NativeCardField.js.map +1 -0
  135. package/lib/commonjs/specs/NativeCardForm.js +2 -0
  136. package/lib/commonjs/specs/NativeCardForm.js.map +1 -0
  137. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +2 -0
  138. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -0
  139. package/lib/commonjs/specs/NativeGooglePayButton.js +2 -0
  140. package/lib/commonjs/specs/NativeGooglePayButton.js.map +1 -0
  141. package/lib/commonjs/specs/NativeStripeContainer.js +2 -0
  142. package/lib/commonjs/specs/NativeStripeContainer.js.map +1 -0
  143. package/lib/commonjs/specs/NativeStripeSdkModule.js +2 -0
  144. package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -0
  145. package/lib/commonjs/specs/utils.js +2 -0
  146. package/lib/commonjs/specs/utils.js.map +1 -0
  147. package/lib/commonjs/types/EmbeddedPaymentElement.js +2 -0
  148. package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -0
  149. package/lib/commonjs/types/PaymentSheet.js +1 -1
  150. package/lib/commonjs/types/PaymentSheet.js.map +1 -1
  151. package/lib/module/components/AddToWalletButton.js +1 -1
  152. package/lib/module/components/AddToWalletButton.js.map +1 -1
  153. package/lib/module/components/AddressSheet.js +1 -1
  154. package/lib/module/components/AddressSheet.js.map +1 -1
  155. package/lib/module/components/AuBECSDebitForm.js +1 -1
  156. package/lib/module/components/AuBECSDebitForm.js.map +1 -1
  157. package/lib/module/components/CardField.js +1 -1
  158. package/lib/module/components/CardField.js.map +1 -1
  159. package/lib/module/components/CardForm.js +1 -1
  160. package/lib/module/components/CardForm.js.map +1 -1
  161. package/lib/module/components/CustomerSheet.js +1 -1
  162. package/lib/module/components/CustomerSheet.js.map +1 -1
  163. package/lib/module/components/PlatformPayButton.js +1 -1
  164. package/lib/module/components/PlatformPayButton.js.map +1 -1
  165. package/lib/module/components/StripeContainer.js +1 -1
  166. package/lib/module/components/StripeContainer.js.map +1 -1
  167. package/lib/module/components/StripeProvider.js +1 -1
  168. package/lib/module/components/StripeProvider.js.map +1 -1
  169. package/lib/module/events.js +2 -0
  170. package/lib/module/events.js.map +1 -0
  171. package/lib/module/functions.js +1 -1
  172. package/lib/module/functions.js.map +1 -1
  173. package/lib/module/helpers.js +1 -1
  174. package/lib/module/helpers.js.map +1 -1
  175. package/lib/module/index.js +1 -1
  176. package/lib/module/index.js.map +1 -1
  177. package/lib/module/specs/NativeAddToWalletButton.js +2 -0
  178. package/lib/module/specs/NativeAddToWalletButton.js.map +1 -0
  179. package/lib/module/specs/NativeAddressSheet.js +2 -0
  180. package/lib/module/specs/NativeAddressSheet.js.map +1 -0
  181. package/lib/module/specs/NativeApplePayButton.js +2 -0
  182. package/lib/module/specs/NativeApplePayButton.js.map +1 -0
  183. package/lib/module/specs/NativeAuBECSDebitForm.js +2 -0
  184. package/lib/module/specs/NativeAuBECSDebitForm.js.map +1 -0
  185. package/lib/module/specs/NativeCardField.js +2 -0
  186. package/lib/module/specs/NativeCardField.js.map +1 -0
  187. package/lib/module/specs/NativeCardForm.js +2 -0
  188. package/lib/module/specs/NativeCardForm.js.map +1 -0
  189. package/lib/module/specs/NativeEmbeddedPaymentElement.js +2 -0
  190. package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -0
  191. package/lib/module/specs/NativeGooglePayButton.js +2 -0
  192. package/lib/module/specs/NativeGooglePayButton.js.map +1 -0
  193. package/lib/module/specs/NativeStripeContainer.js +2 -0
  194. package/lib/module/specs/NativeStripeContainer.js.map +1 -0
  195. package/lib/module/specs/NativeStripeSdkModule.js +2 -0
  196. package/lib/module/specs/NativeStripeSdkModule.js.map +1 -0
  197. package/lib/module/specs/utils.js +2 -0
  198. package/lib/module/specs/utils.js.map +1 -0
  199. package/lib/module/types/EmbeddedPaymentElement.js +2 -0
  200. package/lib/module/types/EmbeddedPaymentElement.js.map +1 -0
  201. package/lib/module/types/PaymentSheet.js +1 -1
  202. package/lib/module/types/PaymentSheet.js.map +1 -1
  203. package/lib/typescript/src/components/AddToWalletButton.d.ts.map +1 -1
  204. package/lib/typescript/src/components/AddressSheet.d.ts.map +1 -1
  205. package/lib/typescript/src/components/AuBECSDebitForm.d.ts.map +1 -1
  206. package/lib/typescript/src/components/CardField.d.ts +1 -1
  207. package/lib/typescript/src/components/CardField.d.ts.map +1 -1
  208. package/lib/typescript/src/components/CardForm.d.ts +1 -1
  209. package/lib/typescript/src/components/CardForm.d.ts.map +1 -1
  210. package/lib/typescript/src/components/CustomerSheet.d.ts +1 -1
  211. package/lib/typescript/src/components/CustomerSheet.d.ts.map +1 -1
  212. package/lib/typescript/src/components/StripeContainer.d.ts.map +1 -1
  213. package/lib/typescript/src/events.d.ts +13 -0
  214. package/lib/typescript/src/events.d.ts.map +1 -0
  215. package/lib/typescript/src/functions.d.ts.map +1 -1
  216. package/lib/typescript/src/helpers.d.ts.map +1 -1
  217. package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts +4 -4
  218. package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts.map +1 -1
  219. package/lib/typescript/src/hooks/useStripe.d.ts +2 -2
  220. package/lib/typescript/src/hooks/useStripe.d.ts.map +1 -1
  221. package/lib/typescript/src/index.d.ts +2 -0
  222. package/lib/typescript/src/index.d.ts.map +1 -1
  223. package/lib/typescript/src/specs/NativeAddToWalletButton.d.ts +27 -0
  224. package/lib/typescript/src/specs/NativeAddToWalletButton.d.ts.map +1 -0
  225. package/lib/typescript/src/specs/NativeAddressSheet.d.ts +34 -0
  226. package/lib/typescript/src/specs/NativeAddressSheet.d.ts.map +1 -0
  227. package/lib/typescript/src/specs/NativeApplePayButton.d.ts +28 -0
  228. package/lib/typescript/src/specs/NativeApplePayButton.d.ts.map +1 -0
  229. package/lib/typescript/src/specs/NativeAuBECSDebitForm.d.ts +19 -0
  230. package/lib/typescript/src/specs/NativeAuBECSDebitForm.d.ts.map +1 -0
  231. package/lib/typescript/src/specs/NativeCardField.d.ts +33 -0
  232. package/lib/typescript/src/specs/NativeCardField.d.ts.map +1 -0
  233. package/lib/typescript/src/specs/NativeCardForm.d.ts +31 -0
  234. package/lib/typescript/src/specs/NativeCardForm.d.ts.map +1 -0
  235. package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts +22 -0
  236. package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts.map +1 -0
  237. package/lib/typescript/src/specs/NativeGooglePayButton.d.ts +11 -0
  238. package/lib/typescript/src/specs/NativeGooglePayButton.d.ts.map +1 -0
  239. package/lib/typescript/src/specs/NativeStripeContainer.d.ts +8 -0
  240. package/lib/typescript/src/specs/NativeStripeContainer.d.ts.map +1 -0
  241. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +93 -0
  242. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -0
  243. package/lib/typescript/src/specs/utils.d.ts +20 -0
  244. package/lib/typescript/src/specs/utils.d.ts.map +1 -0
  245. package/lib/typescript/src/types/CustomerSheet.d.ts +1 -1
  246. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +161 -0
  247. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -0
  248. package/lib/typescript/src/types/PaymentSheet.d.ts +112 -0
  249. package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
  250. package/lib/typescript/src/types/components/CardFieldInput.d.ts +3 -2
  251. package/lib/typescript/src/types/components/CardFieldInput.d.ts.map +1 -1
  252. package/lib/typescript/src/types/components/CardFormView.d.ts +3 -1
  253. package/lib/typescript/src/types/components/CardFormView.d.ts.map +1 -1
  254. package/package.json +20 -1
  255. package/src/components/AddToWalletButton.tsx +2 -5
  256. package/src/components/AddressSheet.tsx +5 -16
  257. package/src/components/AuBECSDebitForm.tsx +3 -12
  258. package/src/components/CardField.tsx +20 -30
  259. package/src/components/CardForm.tsx +14 -29
  260. package/src/components/CustomerSheet.tsx +23 -25
  261. package/src/components/PlatformPayButton.tsx +6 -6
  262. package/src/components/StripeContainer.tsx +5 -12
  263. package/src/components/StripeProvider.tsx +1 -1
  264. package/src/events.ts +49 -0
  265. package/src/functions.ts +13 -24
  266. package/src/helpers.ts +2 -1
  267. package/src/hooks/useFinancialConnectionsSheet.tsx +2 -2
  268. package/src/hooks/useStripe.tsx +2 -2
  269. package/src/index.tsx +3 -0
  270. package/src/specs/NativeAddToWalletButton.ts +40 -0
  271. package/src/specs/NativeAddressSheet.ts +50 -0
  272. package/src/specs/NativeApplePayButton.ts +40 -0
  273. package/src/specs/NativeAuBECSDebitForm.ts +24 -0
  274. package/src/specs/NativeCardField.ts +51 -0
  275. package/src/specs/NativeCardForm.ts +43 -0
  276. package/src/specs/NativeEmbeddedPaymentElement.ts +37 -0
  277. package/src/specs/NativeGooglePayButton.ts +20 -0
  278. package/src/specs/NativeStripeContainer.ts +12 -0
  279. package/src/specs/NativeStripeSdkModule.ts +219 -0
  280. package/src/specs/utils.ts +22 -0
  281. package/src/types/CustomerSheet.ts +1 -1
  282. package/src/types/EmbeddedPaymentElement.tsx +467 -0
  283. package/src/types/PaymentSheet.ts +131 -0
  284. package/src/types/components/CardFieldInput.ts +1 -2
  285. package/src/types/components/CardFormView.ts +1 -1
  286. package/stripe-react-native.podspec +27 -2
  287. package/android/.gradle/8.11.1/checksums/checksums.lock +0 -0
  288. package/android/.gradle/8.11.1/checksums/md5-checksums.bin +0 -0
  289. package/android/.gradle/8.11.1/checksums/sha1-checksums.bin +0 -0
  290. package/android/.gradle/8.11.1/executionHistory/executionHistory.lock +0 -0
  291. package/android/.gradle/8.11.1/fileChanges/last-build.bin +0 -0
  292. package/android/.gradle/8.11.1/fileHashes/fileHashes.lock +0 -0
  293. package/android/.gradle/8.11.1/gc.properties +0 -0
  294. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  295. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  296. package/android/.gradle/vcs-1/gc.properties +0 -0
  297. package/android/src/main/java/com/reactnativestripesdk/CardChangedEvent.kt +0 -54
  298. package/ios/StripeSdk.m +0 -244
  299. package/lib/commonjs/NativeStripeSdk.js +0 -2
  300. package/lib/commonjs/NativeStripeSdk.js.map +0 -1
  301. package/lib/commonjs/components/ApplePayButtonNative.js +0 -2
  302. package/lib/commonjs/components/ApplePayButtonNative.js.map +0 -1
  303. package/lib/commonjs/components/GooglePayButtonNative.js +0 -2
  304. package/lib/commonjs/components/GooglePayButtonNative.js.map +0 -1
  305. package/lib/module/NativeStripeSdk.js +0 -2
  306. package/lib/module/NativeStripeSdk.js.map +0 -1
  307. package/lib/module/components/ApplePayButtonNative.js +0 -2
  308. package/lib/module/components/ApplePayButtonNative.js.map +0 -1
  309. package/lib/module/components/GooglePayButtonNative.js +0 -2
  310. package/lib/module/components/GooglePayButtonNative.js.map +0 -1
  311. package/lib/typescript/src/NativeStripeSdk.d.ts +0 -58
  312. package/lib/typescript/src/NativeStripeSdk.d.ts.map +0 -1
  313. package/lib/typescript/src/components/ApplePayButtonNative.d.ts +0 -4
  314. package/lib/typescript/src/components/ApplePayButtonNative.d.ts.map +0 -1
  315. package/lib/typescript/src/components/GooglePayButtonNative.d.ts +0 -4
  316. package/lib/typescript/src/components/GooglePayButtonNative.d.ts.map +0 -1
  317. package/src/NativeStripeSdk.tsx +0 -159
  318. package/src/components/ApplePayButtonNative.tsx +0 -5
  319. package/src/components/GooglePayButtonNative.tsx +0 -7
@@ -0,0 +1,327 @@
1
+ //
2
+ // EmbeddedPaymentElementManager.swift
3
+ // stripe-react-native
4
+ //
5
+ // Created by Nick Porter on 4/15/25.
6
+ //
7
+
8
+ import Foundation
9
+ @_spi(EmbeddedPaymentElementPrivateBeta) @_spi(ExperimentalAllowsRemovalOfLastSavedPaymentMethodAPI) @_spi(CustomerSessionBetaAccess) @_spi(STP) import StripePaymentSheet
10
+
11
+ @objc(StripeSdkImpl)
12
+ extension StripeSdkImpl {
13
+
14
+ // MARK: Public API wrappers
15
+
16
+ @objc(createEmbeddedPaymentElement:configuration:resolve:reject:)
17
+ public func createEmbeddedPaymentElement(intentConfig: NSDictionary,
18
+ configuration: NSDictionary,
19
+ resolve: @escaping RCTPromiseResolveBlock,
20
+ reject: @escaping RCTPromiseRejectBlock) {
21
+ guard let modeParams = intentConfig["mode"] as? NSDictionary else {
22
+ resolve(Errors.createError(ErrorType.Failed, "One of `paymentIntentClientSecret`, `setupIntentClientSecret`, or `intentConfiguration.mode` is required"))
23
+ return
24
+ }
25
+ if intentConfig.object(forKey: "confirmHandler") == nil {
26
+ resolve(Errors.createError(ErrorType.Failed, "You must provide `intentConfiguration.confirmHandler` if you are not passing an intent client secret"))
27
+ return
28
+ }
29
+ let captureMethodString = intentConfig["captureMethod"] as? String
30
+ let intentConfig = buildIntentConfiguration(
31
+ modeParams: modeParams,
32
+ paymentMethodTypes: intentConfig["paymentMethodTypes"] as? [String],
33
+ captureMethod: mapCaptureMethod(captureMethodString)
34
+ )
35
+
36
+ guard let configuration = buildEmbeddedPaymentElementConfiguration(params: configuration).configuration else {
37
+ resolve(Errors.createError(ErrorType.Failed, "Invalid configuration"))
38
+ return
39
+ }
40
+
41
+ Task {
42
+ do {
43
+ let embeddedPaymentElement = try await EmbeddedPaymentElement.create(
44
+ intentConfiguration: intentConfig,
45
+ configuration: configuration
46
+ )
47
+ embeddedPaymentElement.delegate = embeddedInstanceDelegate
48
+ embeddedPaymentElement.presentingViewController = RCTPresentedViewController()
49
+ self.embeddedInstance = embeddedPaymentElement
50
+
51
+ // success: resolve promise
52
+ resolve(nil)
53
+
54
+ // publish initial state
55
+ embeddedInstanceDelegate.embeddedPaymentElementDidUpdateHeight(embeddedPaymentElement: embeddedPaymentElement)
56
+ embeddedInstanceDelegate.embeddedPaymentElementDidUpdatePaymentOption(embeddedPaymentElement: embeddedPaymentElement)
57
+ } catch {
58
+ // 1) still resolve the promise so JS hook can finish loading
59
+ resolve(nil)
60
+
61
+ // 2) emit a loading‐failed event with the error message
62
+ let msg = error.localizedDescription
63
+ self.emitter?.emitEmbeddedPaymentElementLoadingFailed(["message": msg])
64
+ }
65
+ }
66
+
67
+ }
68
+
69
+ @objc(confirmEmbeddedPaymentElement:reject:)
70
+ public func confirmEmbeddedPaymentElement(resolve: @escaping RCTPromiseResolveBlock,
71
+ reject: @escaping RCTPromiseRejectBlock) {
72
+ embeddedInstance?.presentingViewController = RCTPresentedViewController()
73
+ embeddedInstance?.confirm { result in
74
+ switch result {
75
+ case .completed:
76
+ // Return an object with { status: 'completed' }
77
+ resolve(["status": "completed"])
78
+ case .canceled:
79
+ // Return an object with { status: 'canceled' }
80
+ resolve(["status": "canceled"])
81
+ case .failed(let error):
82
+ // Return an object with { status: 'failed', error }
83
+ resolve([
84
+ "status": "failed",
85
+ "error": error.localizedDescription
86
+ ])
87
+ }
88
+ }
89
+ }
90
+
91
+ @objc(updateEmbeddedPaymentElement:resolve:reject:)
92
+ public func updateEmbeddedPaymentElement(
93
+ intentConfig: NSDictionary,
94
+ resolve: @escaping RCTPromiseResolveBlock,
95
+ reject: @escaping RCTPromiseRejectBlock
96
+ ) {
97
+ guard let modeParams = intentConfig["mode"] as? NSDictionary else {
98
+ resolve(Errors.createError(
99
+ ErrorType.Failed,
100
+ "One of `paymentIntentClientSecret`, `setupIntentClientSecret`, or `intentConfiguration.mode` is required"
101
+ ))
102
+ return
103
+ }
104
+ let captureMethodString = intentConfig["captureMethod"] as? String
105
+ let intentConfiguration = buildIntentConfiguration(
106
+ modeParams: modeParams,
107
+ paymentMethodTypes: intentConfig["paymentMethodTypes"] as? [String],
108
+ captureMethod: mapCaptureMethod(captureMethodString)
109
+ )
110
+
111
+ Task {
112
+ guard let updateResult = await self.embeddedInstance?.update(intentConfiguration: intentConfiguration) else {
113
+ resolve(Errors.createError(
114
+ ErrorType.Failed,
115
+ "No EmbeddedPaymentElement instance — did you call create first?"
116
+ ))
117
+ return
118
+ }
119
+
120
+ switch updateResult {
121
+ case .succeeded:
122
+ resolve(["status": "succeeded"])
123
+ case .canceled:
124
+ resolve(["status": "canceled"])
125
+ case .failed(let error):
126
+ self.emitter?.emitEmbeddedPaymentElementLoadingFailed(["message": error.localizedDescription])
127
+ // We don't resolve with an error b/c loading errors are handled via the embeddedPaymentElementLoadingFailed event
128
+ resolve(nil)
129
+ }
130
+ }
131
+ }
132
+
133
+ @objc(clearEmbeddedPaymentOption)
134
+ public func clearEmbeddedPaymentOption() {
135
+ DispatchQueue.main.async {
136
+ self.embeddedInstance?.clearPaymentOption()
137
+ }
138
+ }
139
+
140
+ }
141
+
142
+ // MARK: EmbeddedPaymentElementDelegate
143
+
144
+ class StripeSdkEmbeddedPaymentElementDelegate: EmbeddedPaymentElementDelegate {
145
+ weak var sdkImpl: StripeSdkImpl?
146
+
147
+ init(sdkImpl: StripeSdkImpl) {
148
+ self.sdkImpl = sdkImpl
149
+ }
150
+
151
+ func embeddedPaymentElementDidUpdateHeight(embeddedPaymentElement: StripePaymentSheet.EmbeddedPaymentElement) {
152
+ let newHeight = embeddedPaymentElement.view.systemLayoutSizeFitting(CGSize(width: embeddedPaymentElement.view.bounds.width, height: UIView.layoutFittingCompressedSize.height)).height
153
+ self.sdkImpl?.emitter?.emitEmbeddedPaymentElementDidUpdateHeight(["height": newHeight])
154
+ }
155
+
156
+ func embeddedPaymentElementDidUpdatePaymentOption(embeddedPaymentElement: EmbeddedPaymentElement) {
157
+ let displayDataDict = embeddedPaymentElement.paymentOption?.toDictionary()
158
+ self.sdkImpl?.emitter?.emitEmbeddedPaymentElementDidUpdatePaymentOption(["paymentOption": displayDataDict as Any])
159
+ }
160
+
161
+ func embeddedPaymentElementWillPresent(embeddedPaymentElement: EmbeddedPaymentElement) {
162
+ self.sdkImpl?.emitter?.emitEmbeddedPaymentElementWillPresent()
163
+ }
164
+ }
165
+
166
+ // MARK: Config parsing
167
+
168
+ extension StripeSdkImpl {
169
+ @nonobjc
170
+ internal func buildEmbeddedPaymentElementConfiguration(
171
+ params: NSDictionary
172
+ ) -> (error: NSDictionary?, configuration: EmbeddedPaymentElement.Configuration?) {
173
+ var configuration = EmbeddedPaymentElement.Configuration()
174
+
175
+ configuration.primaryButtonLabel = params["primaryButtonLabel"] as? String
176
+
177
+ if let appearanceParams = params["appearance"] as? NSDictionary {
178
+ do {
179
+ configuration.appearance = try PaymentSheetAppearance.buildAppearanceFromParams(userParams: appearanceParams)
180
+ } catch {
181
+ return(error: Errors.createError(ErrorType.Failed, error.localizedDescription), configuration: nil)
182
+ }
183
+ }
184
+
185
+ if let applePayParams = params["applePay"] as? NSDictionary {
186
+ do {
187
+ configuration.applePay = try ApplePayUtils.buildPaymentSheetApplePayConfig(
188
+ merchantIdentifier: self.merchantIdentifier,
189
+ merchantCountryCode: applePayParams["merchantCountryCode"] as? String,
190
+ paymentSummaryItems: applePayParams["cartItems"] as? [[String : Any]],
191
+ buttonType: applePayParams["buttonType"] as? NSNumber,
192
+ customHandlers: buildCustomerHandlersForPaymentSheet(applePayParams: applePayParams)
193
+ )
194
+ } catch {
195
+ return(error: Errors.createError(ErrorType.Failed, error.localizedDescription), configuration: nil)
196
+ }
197
+ }
198
+
199
+ if let linkParams = params["link"] as? NSDictionary {
200
+ let display = StripeSdkImpl.mapToLinkDisplay(value: linkParams["display"] as? String)
201
+ configuration.link = PaymentSheet.LinkConfiguration(display: display)
202
+ }
203
+
204
+ if let merchantDisplayName = params["merchantDisplayName"] as? String {
205
+ configuration.merchantDisplayName = merchantDisplayName
206
+ }
207
+
208
+ if let returnURL = params["returnURL"] as? String {
209
+ configuration.returnURL = returnURL
210
+ }
211
+
212
+ if let allowsDelayedPaymentMethods = params["allowsDelayedPaymentMethods"] as? Bool {
213
+ configuration.allowsDelayedPaymentMethods = allowsDelayedPaymentMethods
214
+ }
215
+
216
+ if let removeSavedPaymentMethodMessage = params["removeSavedPaymentMethodMessage"] as? String {
217
+ configuration.removeSavedPaymentMethodMessage = removeSavedPaymentMethodMessage
218
+ }
219
+
220
+ if let billingConfigParams = params["billingDetailsCollectionConfiguration"] as? [String: Any?] {
221
+ configuration.billingDetailsCollectionConfiguration.name = StripeSdkImpl.mapToCollectionMode(str: billingConfigParams["name"] as? String)
222
+ configuration.billingDetailsCollectionConfiguration.phone = StripeSdkImpl.mapToCollectionMode(str: billingConfigParams["phone"] as? String)
223
+ configuration.billingDetailsCollectionConfiguration.email = StripeSdkImpl.mapToCollectionMode(str: billingConfigParams["email"] as? String)
224
+ configuration.billingDetailsCollectionConfiguration.address = StripeSdkImpl.mapToAddressCollectionMode(str: billingConfigParams["address"] as? String)
225
+ configuration.billingDetailsCollectionConfiguration.attachDefaultsToPaymentMethod = billingConfigParams["attachDefaultsToPaymentMethod"] as? Bool == true
226
+ }
227
+
228
+ if let defaultBillingDetails = params["defaultBillingDetails"] as? [String: Any?] {
229
+ configuration.defaultBillingDetails.name = defaultBillingDetails["name"] as? String
230
+ configuration.defaultBillingDetails.email = defaultBillingDetails["email"] as? String
231
+ configuration.defaultBillingDetails.phone = defaultBillingDetails["phone"] as? String
232
+
233
+ if let address = defaultBillingDetails["address"] as? [String: String] {
234
+ configuration.defaultBillingDetails.address = .init(city: address["city"],
235
+ country: address["country"],
236
+ line1: address["line1"],
237
+ line2: address["line2"],
238
+ postalCode: address["postalCode"],
239
+ state: address["state"])
240
+ }
241
+
242
+ }
243
+
244
+ if let defaultShippingDetails = params["defaultShippingDetails"] as? NSDictionary {
245
+ configuration.shippingDetails = {
246
+ return AddressSheetUtils.buildAddressDetails(params: defaultShippingDetails)
247
+ }
248
+ }
249
+
250
+ if #available(iOS 13.0, *) {
251
+ if let style = params["style"] as? String {
252
+ configuration.style = Mappers.mapToUserInterfaceStyle(style)
253
+ }
254
+ }
255
+
256
+ if let customerId = params["customerId"] as? String {
257
+ let customerEphemeralKeySecret = params["customerEphemeralKeySecret"] as? String
258
+ let customerClientSecret = params["customerSessionClientSecret"] as? String
259
+ if customerEphemeralKeySecret != nil && customerClientSecret != nil {
260
+ return(error: Errors.createError(ErrorType.Failed, "`customerEphemeralKeySecret` and `customerSessionClientSecret cannot both be set"), configuration: nil)
261
+ } else if let customerEphemeralKeySecret {
262
+ if (!Errors.isEKClientSecretValid(clientSecret: customerEphemeralKeySecret)) {
263
+ return(error: Errors.createError(ErrorType.Failed, "`customerEphemeralKeySecret` format does not match expected client secret formatting."), configuration: nil)
264
+ }
265
+ configuration.customer = .init(id: customerId, ephemeralKeySecret: customerEphemeralKeySecret)
266
+ } else if let customerClientSecret {
267
+ configuration.customer = .init(id: customerId, customerSessionClientSecret: customerClientSecret)
268
+ }
269
+ }
270
+
271
+ if let preferredNetworksAsInts = params["preferredNetworks"] as? Array<Int> {
272
+ configuration.preferredNetworks = preferredNetworksAsInts.map(Mappers.intToCardBrand).compactMap { $0 }
273
+ }
274
+
275
+ if let allowsRemovalOfLastSavedPaymentMethod = params["allowsRemovalOfLastSavedPaymentMethod"] as? Bool {
276
+ configuration.allowsRemovalOfLastSavedPaymentMethod = allowsRemovalOfLastSavedPaymentMethod
277
+ }
278
+
279
+ if let paymentMethodOrder = params["paymentMethodOrder"] as? Array<String> {
280
+ configuration.paymentMethodOrder = paymentMethodOrder
281
+ }
282
+
283
+ configuration.cardBrandAcceptance = computeCardBrandAcceptance(params: params)
284
+
285
+ if let formSheetActionParams = params["formSheetAction"] as? NSDictionary,
286
+ let actionType = formSheetActionParams["type"] as? String {
287
+ if actionType == "confirm" {
288
+ configuration.formSheetAction = .confirm { [weak self] (result: EmbeddedPaymentElementResult) in
289
+ guard let self = self else { return }
290
+ let resultDict: [String: Any]
291
+ switch result {
292
+ case .completed:
293
+ resultDict = ["status": "completed"]
294
+ case .canceled:
295
+ resultDict = ["status": "canceled"]
296
+ case .failed(let error):
297
+ resultDict = [
298
+ "status": "failed",
299
+ "error": error.localizedDescription
300
+ ]
301
+ }
302
+
303
+ // Send the result back to JS via an event.
304
+ self.emitter?.emitEmbeddedPaymentElementFormSheetConfirmComplete(resultDict)
305
+ }
306
+ } else if actionType == "continue" {
307
+ configuration.formSheetAction = .continue
308
+ }
309
+ }
310
+
311
+ if let rowSelectionBehaviorParams = params["rowSelectionBehavior"] as? NSDictionary,
312
+ let behaviorType = rowSelectionBehaviorParams["type"] as? String {
313
+ if behaviorType == "default" {
314
+ configuration.rowSelectionBehavior = .default
315
+ } else if behaviorType == "immediateAction" {
316
+ configuration.rowSelectionBehavior = .immediateAction { [weak self] in
317
+ // Send an event back to JS to notify that a row has been selected.
318
+ // Replace the event name and body details as needed.
319
+ self?.emitter?.emitEmbeddedPaymentElementRowSelectionImmediateAction()
320
+ }
321
+ }
322
+ }
323
+
324
+ return (nil, configuration)
325
+ }
326
+
327
+ }
@@ -6,14 +6,14 @@
6
6
  //
7
7
 
8
8
  import Foundation
9
- @_spi(ExperimentalAllowsRemovalOfLastSavedPaymentMethodAPI) @_spi(CustomerSessionBetaAccess) @_spi(STP) import StripePaymentSheet
9
+ @_spi(ExperimentalAllowsRemovalOfLastSavedPaymentMethodAPI) @_spi(CustomerSessionBetaAccess) @_spi(EmbeddedPaymentElementPrivateBeta) @_spi(STP) import StripePaymentSheet
10
10
 
11
- extension StripeSdk {
11
+ extension StripeSdkImpl {
12
12
  internal func buildPaymentSheetConfiguration(
13
13
  params: NSDictionary
14
14
  ) -> (error: NSDictionary?, configuration: PaymentSheet.Configuration?) {
15
15
  var configuration = PaymentSheet.Configuration()
16
-
16
+
17
17
  configuration.primaryButtonLabel = params["primaryButtonLabel"] as? String
18
18
 
19
19
  if let appearanceParams = params["appearance"] as? NSDictionary {
@@ -37,7 +37,16 @@ extension StripeSdk {
37
37
  return(error: Errors.createError(ErrorType.Failed, error.localizedDescription), configuration: nil)
38
38
  }
39
39
  }
40
-
40
+
41
+ if let linkParams = params["link"] as? NSDictionary {
42
+ do {
43
+ let display = StripeSdkImpl.mapToLinkDisplay(value: linkParams["display"] as? String)
44
+ configuration.link = PaymentSheet.LinkConfiguration(display: display)
45
+ } catch {
46
+ return(error: Errors.createError(ErrorType.Failed, error.localizedDescription), configuration: nil)
47
+ }
48
+ }
49
+
41
50
  if let merchantDisplayName = params["merchantDisplayName"] as? String {
42
51
  configuration.merchantDisplayName = merchantDisplayName
43
52
  }
@@ -49,16 +58,16 @@ extension StripeSdk {
49
58
  if let allowsDelayedPaymentMethods = params["allowsDelayedPaymentMethods"] as? Bool {
50
59
  configuration.allowsDelayedPaymentMethods = allowsDelayedPaymentMethods
51
60
  }
52
-
61
+
53
62
  if let removeSavedPaymentMethodMessage = params["removeSavedPaymentMethodMessage"] as? String {
54
63
  configuration.removeSavedPaymentMethodMessage = removeSavedPaymentMethodMessage
55
64
  }
56
-
65
+
57
66
  if let billingConfigParams = params["billingDetailsCollectionConfiguration"] as? [String: Any?] {
58
- configuration.billingDetailsCollectionConfiguration.name = StripeSdk.mapToCollectionMode(str: billingConfigParams["name"] as? String)
59
- configuration.billingDetailsCollectionConfiguration.phone = StripeSdk.mapToCollectionMode(str: billingConfigParams["phone"] as? String)
60
- configuration.billingDetailsCollectionConfiguration.email = StripeSdk.mapToCollectionMode(str: billingConfigParams["email"] as? String)
61
- configuration.billingDetailsCollectionConfiguration.address = StripeSdk.mapToAddressCollectionMode(str: billingConfigParams["address"] as? String)
67
+ configuration.billingDetailsCollectionConfiguration.name = StripeSdkImpl.mapToCollectionMode(str: billingConfigParams["name"] as? String)
68
+ configuration.billingDetailsCollectionConfiguration.phone = StripeSdkImpl.mapToCollectionMode(str: billingConfigParams["phone"] as? String)
69
+ configuration.billingDetailsCollectionConfiguration.email = StripeSdkImpl.mapToCollectionMode(str: billingConfigParams["email"] as? String)
70
+ configuration.billingDetailsCollectionConfiguration.address = StripeSdkImpl.mapToAddressCollectionMode(str: billingConfigParams["address"] as? String)
62
71
  configuration.billingDetailsCollectionConfiguration.attachDefaultsToPaymentMethod = billingConfigParams["attachDefaultsToPaymentMethod"] as? Bool == true
63
72
  }
64
73
 
@@ -77,19 +86,19 @@ extension StripeSdk {
77
86
  }
78
87
 
79
88
  }
80
-
89
+
81
90
  if let defaultShippingDetails = params["defaultShippingDetails"] as? NSDictionary {
82
91
  configuration.shippingDetails = {
83
92
  return AddressSheetUtils.buildAddressDetails(params: defaultShippingDetails)
84
93
  }
85
94
  }
86
-
95
+
87
96
  if #available(iOS 13.0, *) {
88
97
  if let style = params["style"] as? String {
89
98
  configuration.style = Mappers.mapToUserInterfaceStyle(style)
90
99
  }
91
100
  }
92
-
101
+
93
102
  if let customerId = params["customerId"] as? String {
94
103
  var customerEphemeralKeySecret = params["customerEphemeralKeySecret"] as? String
95
104
  var customerClientSecret = params["customerSessionClientSecret"] as? String
@@ -104,19 +113,19 @@ extension StripeSdk {
104
113
  configuration.customer = .init(id: customerId, customerSessionClientSecret: customerClientSecret)
105
114
  }
106
115
  }
107
-
116
+
108
117
  if let preferredNetworksAsInts = params["preferredNetworks"] as? Array<Int> {
109
118
  configuration.preferredNetworks = preferredNetworksAsInts.map(Mappers.intToCardBrand).compactMap { $0 }
110
119
  }
111
-
120
+
112
121
  if let allowsRemovalOfLastSavedPaymentMethod = params["allowsRemovalOfLastSavedPaymentMethod"] as? Bool {
113
122
  configuration.allowsRemovalOfLastSavedPaymentMethod = allowsRemovalOfLastSavedPaymentMethod
114
123
  }
115
-
124
+
116
125
  if let paymentMethodOrder = params["paymentMethodOrder"] as? Array<String> {
117
126
  configuration.paymentMethodOrder = paymentMethodOrder
118
127
  }
119
-
128
+
120
129
  switch params["paymentMethodLayout"] as? String? {
121
130
  case "Horizontal":
122
131
  configuration.paymentMethodLayout = .horizontal
@@ -125,20 +134,20 @@ extension StripeSdk {
125
134
  default:
126
135
  configuration.paymentMethodLayout = .automatic
127
136
  }
128
-
137
+
129
138
  configuration.cardBrandAcceptance = computeCardBrandAcceptance(params: params)
130
-
139
+
131
140
  return (nil, configuration)
132
141
  }
133
-
142
+
134
143
  internal func preparePaymentSheetInstance(
135
144
  params: NSDictionary,
136
145
  configuration: PaymentSheet.Configuration,
137
146
  resolve: @escaping RCTPromiseResolveBlock
138
147
  ) {
139
148
  self.paymentSheetFlowController = nil
140
-
141
- func handlePaymentSheetFlowControllerResult(result: Result<PaymentSheet.FlowController, Error>, stripeSdk: StripeSdk?) {
149
+
150
+ func handlePaymentSheetFlowControllerResult(result: Result<PaymentSheet.FlowController, Error>, stripeSdk: StripeSdkImpl?) {
142
151
  switch result {
143
152
  case .failure(let error):
144
153
  resolve(Errors.createError(ErrorType.Failed, error as NSError))
@@ -204,7 +213,7 @@ extension StripeSdk {
204
213
  paymentMethodTypes: intentConfiguration["paymentMethodTypes"] as? [String],
205
214
  captureMethod: mapCaptureMethod(captureMethodString)
206
215
  )
207
-
216
+
208
217
  if params["customFlow"] as? Bool == true {
209
218
  PaymentSheet.FlowController.create(intentConfiguration: intentConfig, configuration: configuration) { [weak self] result in
210
219
  handlePaymentSheetFlowControllerResult(result: result, stripeSdk: self)
@@ -218,7 +227,7 @@ extension StripeSdk {
218
227
  }
219
228
  }
220
229
  }
221
-
230
+
222
231
  internal func computeCardBrandAcceptance(params: NSDictionary) -> PaymentSheet.CardBrandAcceptance {
223
232
  if let cardBrandAcceptanceParams = params["cardBrandAcceptance"] as? NSDictionary {
224
233
  if let filter = cardBrandAcceptanceParams["filter"] as? String {
@@ -240,10 +249,10 @@ extension StripeSdk {
240
249
  }
241
250
  }
242
251
  }
243
-
252
+
244
253
  return .all
245
254
  }
246
-
255
+
247
256
  private func mapToCardBrandCategory(brand: String) -> PaymentSheet.CardBrandAcceptance.BrandCategory? {
248
257
  switch brand {
249
258
  case "visa":
@@ -258,8 +267,8 @@ extension StripeSdk {
258
267
  return nil
259
268
  }
260
269
  }
261
-
262
- private func mapCaptureMethod(_ captureMethod: String?) -> PaymentSheet.IntentConfiguration.CaptureMethod {
270
+
271
+ func mapCaptureMethod(_ captureMethod: String?) -> PaymentSheet.IntentConfiguration.CaptureMethod {
263
272
  if let captureMethod = captureMethod {
264
273
  switch captureMethod {
265
274
  case "Automatic": return PaymentSheet.IntentConfiguration.CaptureMethod.automatic
@@ -270,8 +279,8 @@ extension StripeSdk {
270
279
  }
271
280
  return PaymentSheet.IntentConfiguration.CaptureMethod.automatic
272
281
  }
273
-
274
- private func buildIntentConfiguration(
282
+
283
+ func buildIntentConfiguration(
275
284
  modeParams: NSDictionary,
276
285
  paymentMethodTypes: [String]?,
277
286
  captureMethod: PaymentSheet.IntentConfiguration.CaptureMethod
@@ -297,19 +306,15 @@ extension StripeSdk {
297
306
  mode: mode,
298
307
  paymentMethodTypes: paymentMethodTypes,
299
308
  confirmHandler: { paymentMethod, shouldSavePaymentMethod, intentCreationCallback in
300
- if (self.hasEventListeners) {
301
- self.paymentSheetIntentCreationCallback = intentCreationCallback
302
- self.sendEvent(withName: "onConfirmHandlerCallback", body: [
303
- "paymentMethod": Mappers.mapFromPaymentMethod(paymentMethod) ?? NSNull(),
304
- "shouldSavePaymentMethod": shouldSavePaymentMethod
305
- ])
306
- } else {
307
- RCTMakeAndLogError("Tried to call confirmHandler, but no callback was found. Please file an issue: https://github.com/stripe/stripe-react-native/issues", nil, nil)
308
- }
309
+ self.paymentSheetIntentCreationCallback = intentCreationCallback
310
+ self.emitter?.emitOnConfirmHandlerCallback([
311
+ "paymentMethod": Mappers.mapFromPaymentMethod(paymentMethod) ?? NSNull(),
312
+ "shouldSavePaymentMethod": shouldSavePaymentMethod
313
+ ])
309
314
  })
310
315
  }
311
-
312
- private func buildCustomerHandlersForPaymentSheet(applePayParams: NSDictionary) -> PaymentSheet.ApplePayConfiguration.Handlers? {
316
+
317
+ func buildCustomerHandlersForPaymentSheet(applePayParams: NSDictionary) -> PaymentSheet.ApplePayConfiguration.Handlers? {
313
318
  if (applePayParams["request"] == nil) {
314
319
  return nil
315
320
  }
@@ -323,18 +328,14 @@ extension StripeSdk {
323
328
  return request
324
329
  }, authorizationResultHandler: { result, completion in
325
330
  if applePayParams.object(forKey: "setOrderTracking") != nil {
326
- if (self.hasEventListeners) {
327
- self.orderTrackingHandler = (result, completion)
328
- self.sendEvent(withName: "onOrderTrackingCallback", body: [:])
329
- } else {
330
- RCTMakeAndLogError("Order tracking is enabled, but no callback was found. Please file an issue: https://github.com/stripe/stripe-react-native/issues", nil, nil)
331
- }
331
+ self.orderTrackingHandler = (result, completion)
332
+ self.emitter?.emitOnOrderTrackingCallback()
332
333
  } else {
333
334
  completion(result)
334
335
  }
335
336
  })
336
337
  }
337
-
338
+
338
339
  internal static func mapToCollectionMode(str: String?) -> PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode {
339
340
  switch str {
340
341
  case "automatic":
@@ -347,7 +348,7 @@ extension StripeSdk {
347
348
  return .automatic
348
349
  }
349
350
  }
350
-
351
+
351
352
  internal static func mapToAddressCollectionMode(str: String?) -> PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode {
352
353
  switch str {
353
354
  case "automatic":
@@ -360,5 +361,16 @@ extension StripeSdk {
360
361
  return .automatic
361
362
  }
362
363
  }
364
+
365
+ internal static func mapToLinkDisplay(value: String?) -> PaymentSheet.LinkConfiguration.Display {
366
+ switch value {
367
+ case "automatic":
368
+ return .automatic
369
+ case "never":
370
+ return .never
371
+ default:
372
+ return .automatic
373
+ }
374
+ }
363
375
  }
364
376