@stripe/stripe-react-native 0.48.0 → 0.50.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 (139) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +1 -1
  3. package/android/gradle.properties +1 -1
  4. package/android/src/main/AndroidManifest.xml +10 -0
  5. package/android/src/main/java/com/reactnativestripesdk/CustomPaymentMethodActivity.kt +81 -0
  6. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +171 -56
  7. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +34 -3
  8. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +0 -17
  9. package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +0 -2
  10. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +57 -3
  11. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +140 -19
  12. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +22 -0
  13. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +52 -6
  14. package/android/src/main/res/values/styles.xml +27 -0
  15. package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +8 -0
  16. package/ios/ApplePayButtonManager.m +4 -0
  17. package/ios/ApplePayButtonView.swift +11 -4
  18. package/ios/Mappers.swift +0 -5
  19. package/ios/NewArch/ApplePayButtonComponentView.mm +6 -0
  20. package/ios/OldArch/StripeSdkEventEmitterCompat.h +1 -1
  21. package/ios/OldArch/StripeSdkEventEmitterCompat.m +7 -1
  22. package/ios/PaymentMethodFactory.swift +0 -17
  23. package/ios/PaymentSheetAppearance.swift +22 -1
  24. package/ios/StripeSdk.mm +7 -0
  25. package/ios/StripeSdkEmitter.swift +1 -0
  26. package/ios/StripeSdkImpl+Embedded.swift +39 -17
  27. package/ios/StripeSdkImpl+PaymentSheet.swift +156 -5
  28. package/ios/StripeSdkImpl.swift +43 -10
  29. package/lib/commonjs/components/AddToWalletButton.js +1 -1
  30. package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
  31. package/lib/commonjs/components/AddressSheet.js +1 -1
  32. package/lib/commonjs/components/AddressSheet.js.map +1 -1
  33. package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
  34. package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
  35. package/lib/commonjs/components/CardField.js +1 -1
  36. package/lib/commonjs/components/CardField.js.map +1 -1
  37. package/lib/commonjs/components/CardForm.js +1 -1
  38. package/lib/commonjs/components/CardForm.js.map +1 -1
  39. package/lib/commonjs/components/CustomerSheet.js +1 -1
  40. package/lib/commonjs/components/CustomerSheet.js.map +1 -1
  41. package/lib/commonjs/components/PlatformPayButton.js +1 -1
  42. package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
  43. package/lib/commonjs/components/StripeContainer.js +1 -1
  44. package/lib/commonjs/components/StripeContainer.js.map +1 -1
  45. package/lib/commonjs/events.js.map +1 -1
  46. package/lib/commonjs/functions.js +1 -1
  47. package/lib/commonjs/functions.js.map +1 -1
  48. package/lib/commonjs/hooks/useStripe.js +1 -1
  49. package/lib/commonjs/hooks/useStripe.js.map +1 -1
  50. package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
  51. package/lib/commonjs/specs/NativeApplePayButton.js.map +1 -1
  52. package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
  53. package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
  54. package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
  55. package/lib/commonjs/types/PaymentIntent.js.map +1 -1
  56. package/lib/commonjs/types/PaymentSheet.js +1 -1
  57. package/lib/commonjs/types/PaymentSheet.js.map +1 -1
  58. package/lib/module/components/AddToWalletButton.js +1 -1
  59. package/lib/module/components/AddToWalletButton.js.map +1 -1
  60. package/lib/module/components/AddressSheet.js +1 -1
  61. package/lib/module/components/AddressSheet.js.map +1 -1
  62. package/lib/module/components/AuBECSDebitForm.js +1 -1
  63. package/lib/module/components/AuBECSDebitForm.js.map +1 -1
  64. package/lib/module/components/CardField.js +1 -1
  65. package/lib/module/components/CardField.js.map +1 -1
  66. package/lib/module/components/CardForm.js +1 -1
  67. package/lib/module/components/CardForm.js.map +1 -1
  68. package/lib/module/components/CustomerSheet.js +1 -1
  69. package/lib/module/components/CustomerSheet.js.map +1 -1
  70. package/lib/module/components/PlatformPayButton.js +1 -1
  71. package/lib/module/components/PlatformPayButton.js.map +1 -1
  72. package/lib/module/components/StripeContainer.js +1 -1
  73. package/lib/module/components/StripeContainer.js.map +1 -1
  74. package/lib/module/events.js.map +1 -1
  75. package/lib/module/functions.js +1 -1
  76. package/lib/module/functions.js.map +1 -1
  77. package/lib/module/hooks/useStripe.js +1 -1
  78. package/lib/module/hooks/useStripe.js.map +1 -1
  79. package/lib/module/specs/NativeApplePayButton.js +1 -1
  80. package/lib/module/specs/NativeApplePayButton.js.map +1 -1
  81. package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
  82. package/lib/module/types/EmbeddedPaymentElement.js +1 -1
  83. package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
  84. package/lib/module/types/PaymentIntent.js.map +1 -1
  85. package/lib/module/types/PaymentSheet.js +1 -1
  86. package/lib/module/types/PaymentSheet.js.map +1 -1
  87. package/lib/typescript/src/components/PlatformPayButton.d.ts.map +1 -1
  88. package/lib/typescript/src/events.d.ts +1 -1
  89. package/lib/typescript/src/events.d.ts.map +1 -1
  90. package/lib/typescript/src/functions.d.ts.map +1 -1
  91. package/lib/typescript/src/specs/NativeApplePayButton.d.ts +4 -0
  92. package/lib/typescript/src/specs/NativeApplePayButton.d.ts.map +1 -1
  93. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +2 -0
  94. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
  95. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +29 -0
  96. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
  97. package/lib/typescript/src/types/PaymentIntent.d.ts +2 -11
  98. package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -1
  99. package/lib/typescript/src/types/PaymentMethod.d.ts +2 -13
  100. package/lib/typescript/src/types/PaymentMethod.d.ts.map +1 -1
  101. package/lib/typescript/src/types/PaymentSheet.d.ts +78 -2
  102. package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
  103. package/package-lock.json +14114 -0
  104. package/package.json +1 -1
  105. package/patches/README.md +55 -0
  106. package/patches/old-arch-codegen-fix.patch +87 -0
  107. package/src/components/PlatformPayButton.tsx +12 -4
  108. package/src/events.ts +3 -1
  109. package/src/functions.ts +36 -1
  110. package/src/specs/NativeApplePayButton.ts +5 -0
  111. package/src/specs/NativeStripeSdkModule.ts +4 -0
  112. package/src/types/EmbeddedPaymentElement.tsx +80 -2
  113. package/src/types/PaymentIntent.ts +1 -11
  114. package/src/types/PaymentMethod.ts +0 -14
  115. package/src/types/PaymentSheet.ts +86 -1
  116. package/stripe-react-native.podspec +1 -1
  117. package/android/.gradle/8.11.1/checksums/checksums.lock +0 -0
  118. package/android/.gradle/8.11.1/checksums/md5-checksums.bin +0 -0
  119. package/android/.gradle/8.11.1/checksums/sha1-checksums.bin +0 -0
  120. package/android/.gradle/8.11.1/executionHistory/executionHistory.bin +0 -0
  121. package/android/.gradle/8.11.1/executionHistory/executionHistory.lock +0 -0
  122. package/android/.gradle/8.11.1/fileChanges/last-build.bin +0 -0
  123. package/android/.gradle/8.11.1/fileHashes/fileHashes.bin +0 -0
  124. package/android/.gradle/8.11.1/fileHashes/fileHashes.lock +0 -0
  125. package/android/.gradle/8.11.1/gc.properties +0 -0
  126. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  127. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  128. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  129. package/android/.gradle/config.properties +0 -2
  130. package/android/.gradle/file-system.probe +0 -0
  131. package/android/.gradle/vcs-1/gc.properties +0 -0
  132. package/android/.idea/caches/deviceStreaming.xml +0 -619
  133. package/android/.idea/compiler.xml +0 -6
  134. package/android/.idea/gradle.xml +0 -19
  135. package/android/.idea/migrations.xml +0 -10
  136. package/android/.idea/misc.xml +0 -10
  137. package/android/.idea/runConfigurations.xml +0 -17
  138. package/android/.idea/vcs.xml +0 -6
  139. package/android/local.properties +0 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-react-native",
3
- "version": "0.48.0",
3
+ "version": "0.50.0",
4
4
  "author": "Stripe",
5
5
  "description": "Stripe SDK for React Native",
6
6
  "main": "lib/commonjs/index",
@@ -0,0 +1,55 @@
1
+ # Old Architecture Codegen Fix
2
+
3
+ This patch fixes the codegen issue that occurs when using `@stripe/stripe-react-native` with React Native 0.74+ in the old architecture.
4
+
5
+ ## The Problem
6
+
7
+ When using React Native 0.74+ with the old architecture, you may encounter this error during pod install:
8
+
9
+ ```
10
+ UnsupportedModulePropertyParserError: Module NativeStripeSdkModule: TypeScript interfaces extending TurboModule must only contain 'FunctionTypeAnnotation's. Property 'onConfirmHandlerCallback' refers to a 'TSTypeReference'.
11
+ ```
12
+
13
+ This occurs because the React Native codegen in the old architecture doesn't support `EventEmitter` properties in TurboModule interfaces.
14
+
15
+ ## The Solution
16
+
17
+ This patch converts all `EventEmitter` properties to callback function methods, making them compatible with the old architecture codegen.
18
+
19
+ ## How to Apply
20
+
21
+ ### Option 1: Manual patch command
22
+
23
+ ```bash
24
+ cd node_modules/@stripe/stripe-react-native
25
+ patch -p0 < patches/old-arch-codegen-fix.patch
26
+ ```
27
+
28
+ ### Option 2: Using patch-package (Recommended)
29
+
30
+ 1. Install patch-package as a dev dependency:
31
+ ```bash
32
+ npm install --save-dev patch-package
33
+ ```
34
+
35
+ 2. Apply the patch manually first:
36
+ ```bash
37
+ cd node_modules/@stripe/stripe-react-native
38
+ patch -p0 < ../../patches/old-arch-codegen-fix.patch
39
+ ```
40
+
41
+ 3. Generate a patch-package patch:
42
+ ```bash
43
+ npx patch-package @stripe/stripe-react-native
44
+ ```
45
+
46
+ 4. Add postinstall script to your `package.json`:
47
+ ```json
48
+ {
49
+ "scripts": {
50
+ "postinstall": "patch-package"
51
+ }
52
+ }
53
+ ```
54
+
55
+ This ensures the patch is automatically applied whenever you run `npm install`.
@@ -0,0 +1,87 @@
1
+ --- src/specs/NativeStripeSdkModule.ts.orig 2025-07-09 10:31:12.373374861 -0600
2
+ +++ src/specs/NativeStripeSdkModule.ts 2025-07-09 10:31:34.254519742 -0600
3
+ @@ -1,7 +1,6 @@
4
+ import { TurboModuleRegistry } from 'react-native';
5
+ import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
6
+ import type {
7
+ - EventEmitter,
8
+ Int32,
9
+ } from 'react-native/Libraries/Types/CodegenTypes';
10
+ import type {
11
+ @@ -185,35 +184,47 @@
12
+ ): Promise<void>;
13
+ clearEmbeddedPaymentOption(viewTag: Int32): Promise<void>;
14
+
15
+ - // Events
16
+ - onConfirmHandlerCallback: EventEmitter<{
17
+ - paymentMethod: UnsafeObject<PaymentMethod.Result>;
18
+ - shouldSavePaymentMethod: boolean;
19
+ - }>;
20
+ - onFinancialConnectionsEvent: EventEmitter<
21
+ - UnsafeObject<FinancialConnectionsEvent>
22
+ - >;
23
+ - onOrderTrackingCallback: EventEmitter<void>;
24
+ - onCustomerAdapterFetchPaymentMethodsCallback: EventEmitter<void>;
25
+ - onCustomerAdapterAttachPaymentMethodCallback: EventEmitter<{
26
+ - paymentMethodId: string;
27
+ - }>;
28
+ - onCustomerAdapterDetachPaymentMethodCallback: EventEmitter<{
29
+ - paymentMethodId: string;
30
+ - }>;
31
+ - onCustomerAdapterSetSelectedPaymentOptionCallback: EventEmitter<{
32
+ - paymentOption: string;
33
+ - }>;
34
+ - onCustomerAdapterFetchSelectedPaymentOptionCallback: EventEmitter<void>;
35
+ - onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback: EventEmitter<void>;
36
+ - embeddedPaymentElementDidUpdateHeight: EventEmitter<UnsafeObject<any>>;
37
+ - embeddedPaymentElementWillPresent: EventEmitter<void>;
38
+ - embeddedPaymentElementDidUpdatePaymentOption: EventEmitter<UnsafeObject<any>>;
39
+ - embeddedPaymentElementFormSheetConfirmComplete: EventEmitter<
40
+ - UnsafeObject<any>
41
+ - >;
42
+ - embeddedPaymentElementRowSelectionImmediateAction: EventEmitter<void>;
43
+ - embeddedPaymentElementLoadingFailed: EventEmitter<UnsafeObject<any>>;
44
+ + // Events (callback form for old architecture)
45
+ + onConfirmHandlerCallback(
46
+ + callback: (event: {
47
+ + paymentMethod: UnsafeObject<PaymentMethod.Result>;
48
+ + shouldSavePaymentMethod: boolean;
49
+ + }) => void
50
+ + ): void;
51
+ + onFinancialConnectionsEvent(
52
+ + callback: (event: UnsafeObject<FinancialConnectionsEvent>) => void
53
+ + ): void;
54
+ + onOrderTrackingCallback(callback: () => void): void;
55
+ + onCustomerAdapterFetchPaymentMethodsCallback(callback: () => void): void;
56
+ + onCustomerAdapterAttachPaymentMethodCallback(
57
+ + callback: (event: { paymentMethodId: string }) => void
58
+ + ): void;
59
+ + onCustomerAdapterDetachPaymentMethodCallback(
60
+ + callback: (event: { paymentMethodId: string }) => void
61
+ + ): void;
62
+ + onCustomerAdapterSetSelectedPaymentOptionCallback(
63
+ + callback: (event: { paymentOption: string }) => void
64
+ + ): void;
65
+ + onCustomerAdapterFetchSelectedPaymentOptionCallback(
66
+ + callback: () => void
67
+ + ): void;
68
+ + onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback(
69
+ + callback: () => void
70
+ + ): void;
71
+ + embeddedPaymentElementDidUpdateHeight(
72
+ + callback: (event: UnsafeObject<any>) => void
73
+ + ): void;
74
+ + embeddedPaymentElementWillPresent(callback: () => void): void;
75
+ + embeddedPaymentElementDidUpdatePaymentOption(
76
+ + callback: (event: UnsafeObject<any>) => void
77
+ + ): void;
78
+ + embeddedPaymentElementFormSheetConfirmComplete(
79
+ + callback: (event: UnsafeObject<any>) => void
80
+ + ): void;
81
+ + embeddedPaymentElementRowSelectionImmediateAction(callback: () => void): void;
82
+ + embeddedPaymentElementLoadingFailed(
83
+ + callback: (event: UnsafeObject<any>) => void
84
+ + ): void;
85
+ }
86
+
87
+ export default TurboModuleRegistry.getEnforcing<Spec>('StripeSdk');
@@ -141,6 +141,17 @@ export function PlatformPayButton({
141
141
  }
142
142
  : undefined;
143
143
 
144
+ const callbackProps: any = {
145
+ onShippingMethodSelectedAction: shippingMethodCallback,
146
+ onShippingContactSelectedAction: shippingContactCallback,
147
+ onCouponCodeEnteredAction: couponCodeCallback,
148
+ onOrderTrackingAction: orderTrackingCallback,
149
+ hasShippingMethodCallback: !!onShippingMethodSelected,
150
+ hasShippingContactCallback: !!onShippingContactSelected,
151
+ hasCouponCodeCallback: !!onCouponCodeEntered,
152
+ hasOrderTrackingCallback: !!setOrderTracking,
153
+ };
154
+
144
155
  return (
145
156
  <TouchableOpacity
146
157
  disabled={disabled}
@@ -154,11 +165,8 @@ export function PlatformPayButton({
154
165
  buttonStyle={appearance}
155
166
  borderRadius={borderRadius}
156
167
  disabled={disabled ?? false}
157
- onShippingMethodSelectedAction={shippingMethodCallback}
158
- onShippingContactSelectedAction={shippingContactCallback}
159
- onCouponCodeEnteredAction={couponCodeCallback}
160
- onOrderTrackingAction={orderTrackingCallback}
161
168
  style={styles.nativeButtonStyle}
169
+ {...callbackProps}
162
170
  {...props}
163
171
  />
164
172
  ) : (
package/src/events.ts CHANGED
@@ -34,9 +34,11 @@ type Events =
34
34
  | 'onCustomerAdapterFetchSelectedPaymentOptionCallback'
35
35
  | 'onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback'
36
36
  | 'embeddedPaymentElementFormSheetConfirmComplete'
37
+ | 'embeddedPaymentElementRowSelectionImmediateAction'
37
38
  | 'embeddedPaymentElementDidUpdatePaymentOption'
38
39
  | 'embeddedPaymentElementDidUpdateHeight'
39
- | 'embeddedPaymentElementLoadingFailed';
40
+ | 'embeddedPaymentElementLoadingFailed'
41
+ | 'onCustomPaymentMethodConfirmHandlerCallback';
40
42
 
41
43
  export function addListener<EventT extends Events>(
42
44
  event: EventT,
package/src/functions.ts CHANGED
@@ -185,7 +185,10 @@ export const handleNextAction = async (
185
185
  paymentIntentClientSecret,
186
186
  returnURL ?? null
187
187
  )
188
- : await NativeStripeSdk.handleNextAction(paymentIntentClientSecret);
188
+ : await NativeStripeSdk.handleNextAction(
189
+ paymentIntentClientSecret,
190
+ returnURL ?? null
191
+ );
189
192
  if (error) {
190
193
  return {
191
194
  error,
@@ -352,6 +355,8 @@ export const verifyMicrodepositsForSetup = async (
352
355
  let confirmHandlerCallback: EventSubscription | null = null;
353
356
  let orderTrackingCallbackListener: EventSubscription | null = null;
354
357
  let financialConnectionsEventListener: EventSubscription | null = null;
358
+ let paymentSheetCustomPaymentMethodConfirmCallback: EventSubscription | null =
359
+ null;
355
360
 
356
361
  export const initPaymentSheet = async (
357
362
  params: PaymentSheet.SetupParams
@@ -372,6 +377,36 @@ export const initPaymentSheet = async (
372
377
  );
373
378
  }
374
379
 
380
+ // Setup custom payment method confirmation handler for PaymentSheet
381
+ if (params.customPaymentMethodConfiguration) {
382
+ const customPaymentMethodHandler =
383
+ params.customPaymentMethodConfiguration
384
+ .confirmCustomPaymentMethodCallback;
385
+ if (customPaymentMethodHandler) {
386
+ paymentSheetCustomPaymentMethodConfirmCallback?.remove();
387
+ paymentSheetCustomPaymentMethodConfirmCallback = addListener(
388
+ 'onCustomPaymentMethodConfirmHandlerCallback',
389
+ ({
390
+ customPaymentMethod,
391
+ billingDetails,
392
+ }: {
393
+ customPaymentMethod: PaymentSheet.CustomPaymentMethod;
394
+ billingDetails: import('./types').BillingDetails | null;
395
+ }) => {
396
+ // Call the user's handler with a result handler callback
397
+ customPaymentMethodHandler(
398
+ customPaymentMethod,
399
+ billingDetails,
400
+ (cpmResult: PaymentSheet.CustomPaymentMethodResult) => {
401
+ // Send the result back to the native side
402
+ NativeStripeSdk.customPaymentMethodResultCallback(cpmResult);
403
+ }
404
+ );
405
+ }
406
+ );
407
+ }
408
+ }
409
+
375
410
  const orderTrackingCallback = params?.applePay?.setOrderTracking;
376
411
  if (orderTrackingCallback) {
377
412
  orderTrackingCallbackListener?.remove();
@@ -31,6 +31,11 @@ export interface NativeProps extends ViewProps {
31
31
  onShippingContactSelectedAction?: DirectEventHandler<OnShippingContactSelectedActionEvent>;
32
32
  onCouponCodeEnteredAction?: DirectEventHandler<OnCouponCodeEnteredActionEvent>;
33
33
  onOrderTrackingAction?: DirectEventHandler<OnOrderTrackingActionEvent>;
34
+ // Boolean flags to indicate which callbacks are provided
35
+ hasShippingMethodCallback?: WithDefault<boolean, false>;
36
+ hasShippingContactCallback?: WithDefault<boolean, false>;
37
+ hasCouponCodeCallback?: WithDefault<boolean, false>;
38
+ hasOrderTrackingCallback?: WithDefault<boolean, false>;
34
39
  }
35
40
 
36
41
  type ComponentType = HostComponent<NativeProps>;
@@ -83,6 +83,9 @@ export interface Spec extends TurboModule {
83
83
  intentCreationCallback(
84
84
  result: UnsafeObject<PaymentSheet.IntentCreationCallbackParams>
85
85
  ): Promise<void>;
86
+ customPaymentMethodResultCallback(
87
+ result: UnsafeObject<PaymentSheet.CustomPaymentMethodResult>
88
+ ): Promise<void>;
86
89
  presentPaymentSheet(
87
90
  options: UnsafeObject<PaymentSheet.PresentOptions>
88
91
  ): Promise<PresentPaymentSheetResult>;
@@ -214,6 +217,7 @@ export interface Spec extends TurboModule {
214
217
  >;
215
218
  embeddedPaymentElementRowSelectionImmediateAction: EventEmitter<void>;
216
219
  embeddedPaymentElementLoadingFailed: EventEmitter<UnsafeObject<any>>;
220
+ onCustomPaymentMethodConfirmHandlerCallback: EventEmitter<UnsafeObject<any>>;
217
221
  }
218
222
 
219
223
  export default TurboModuleRegistry.getEnforcing<Spec>('StripeSdk');
@@ -92,6 +92,32 @@ export type EmbeddedFormSheetAction =
92
92
  type: 'continue';
93
93
  };
94
94
 
95
+ /**
96
+ * Describes how you handle row selections in EmbeddedPaymentElement.
97
+ * The embedded view may show payment method options that can be selected without further collecting further details in a form sheet.
98
+ * This type determines what happens upon a user tapping one of these payment options methods:
99
+ * - In the `default` case, the payment method option row enters a selected state.
100
+ * - In the `immediateAction` case, `onSelectPaymentOption` is called.
101
+ */
102
+ export type EmbeddedRowSelectionBehavior =
103
+ | {
104
+ /**
105
+ * When a payment method option is selected, the customer taps a button to continue or confirm payment.
106
+ * This is the default recommended integration.
107
+ */
108
+ type: 'default';
109
+ }
110
+ | {
111
+ /**
112
+ * When a payment method option is selected, `onSelectPaymentOption` is triggered.
113
+ * You can implement this function to immediately perform an action such as going back to the checkout screen or confirming the payment.
114
+ * Note that certain payment options like Apple Pay and saved payment methods are disabled in this mode if you set
115
+ * `EmbeddedPaymentElementConfiguration.formSheetAction` to `continue`
116
+ */
117
+ type: 'immediateAction';
118
+ onSelectPaymentOption?: () => void;
119
+ };
120
+
95
121
  /**
96
122
  * Configuration object (subset of EmbeddedPaymentElement.Configuration).
97
123
  */
@@ -166,6 +192,12 @@ export interface EmbeddedPaymentElementConfiguration {
166
192
  * The sheet has a button at the bottom. `formSheetAction` controls the action the button performs.
167
193
  */
168
194
  formSheetAction?: EmbeddedFormSheetAction;
195
+ /** Configuration for custom payment methods in EmbeddedPaymentElement */
196
+ customPaymentMethodConfiguration?: PaymentSheetTypes.CustomPaymentMethodConfiguration;
197
+ /** The view can display payment methods that, when tapped, do not open a sheet to collect additional details.
198
+ * `rowSelectionBehavior` controls the behavior tapping on these payment methods performs.
199
+ */
200
+ rowSelectionBehavior?: EmbeddedRowSelectionBehavior;
169
201
  }
170
202
 
171
203
  // -----------------------------------------------------------------------------
@@ -209,12 +241,14 @@ class EmbeddedPaymentElement {
209
241
  // -----------------------------------------------------------------------------
210
242
  let confirmHandlerCallback: EventSubscription | null = null;
211
243
  let formSheetActionConfirmCallback: EventSubscription | null = null;
244
+ let customPaymentMethodConfirmCallback: EventSubscription | null = null;
245
+ let rowSelectionCallback: EventSubscription | null = null;
212
246
 
213
247
  async function createEmbeddedPaymentElement(
214
248
  intentConfig: PaymentSheetTypes.IntentConfiguration,
215
249
  configuration: EmbeddedPaymentElementConfiguration
216
250
  ): Promise<EmbeddedPaymentElement> {
217
- setupConfirmHandlers(intentConfig, configuration);
251
+ setupConfirmAndSelectionHandlers(intentConfig, configuration);
218
252
 
219
253
  await NativeStripeSdkModule.createEmbeddedPaymentElement(
220
254
  intentConfig,
@@ -223,7 +257,7 @@ async function createEmbeddedPaymentElement(
223
257
  return new EmbeddedPaymentElement();
224
258
  }
225
259
 
226
- function setupConfirmHandlers(
260
+ function setupConfirmAndSelectionHandlers(
227
261
  intentConfig: PaymentSheetTypes.IntentConfiguration,
228
262
  configuration: EmbeddedPaymentElementConfiguration
229
263
  ) {
@@ -262,6 +296,50 @@ function setupConfirmHandlers(
262
296
  );
263
297
  }
264
298
  }
299
+
300
+ // Setup custom payment method confirmation handler
301
+ if (configuration.customPaymentMethodConfiguration) {
302
+ const customPaymentMethodHandler =
303
+ configuration.customPaymentMethodConfiguration
304
+ .confirmCustomPaymentMethodCallback;
305
+ if (customPaymentMethodHandler) {
306
+ customPaymentMethodConfirmCallback?.remove();
307
+ customPaymentMethodConfirmCallback = addListener(
308
+ 'onCustomPaymentMethodConfirmHandlerCallback',
309
+ ({
310
+ customPaymentMethod,
311
+ billingDetails,
312
+ }: {
313
+ customPaymentMethod: PaymentSheetTypes.CustomPaymentMethod;
314
+ billingDetails: BillingDetails | null;
315
+ }) => {
316
+ // Call the user's handler with a result handler callback
317
+ customPaymentMethodHandler(
318
+ customPaymentMethod,
319
+ billingDetails,
320
+ (result: PaymentSheetTypes.CustomPaymentMethodResult) => {
321
+ // Send the result back to the native side
322
+ NativeStripeSdkModule.customPaymentMethodResultCallback(result);
323
+ }
324
+ );
325
+ }
326
+ );
327
+ }
328
+ }
329
+
330
+ if (configuration.rowSelectionBehavior?.type === 'immediateAction') {
331
+ const rowSelectionHandler =
332
+ configuration.rowSelectionBehavior.onSelectPaymentOption;
333
+ if (rowSelectionHandler) {
334
+ rowSelectionCallback?.remove();
335
+ rowSelectionCallback = addListener(
336
+ 'embeddedPaymentElementRowSelectionImmediateAction',
337
+ () => {
338
+ rowSelectionHandler();
339
+ }
340
+ );
341
+ }
342
+ }
265
343
  }
266
344
 
267
345
  // -----------------------------------------------------------------------------
@@ -39,7 +39,6 @@ export type ConfirmParams =
39
39
  | SepaParams
40
40
  | EpsParams
41
41
  | AuBecsDebitParams
42
- | SofortParams
43
42
  | GrabPayParams
44
43
  | FPXParams
45
44
  | AfterpayClearpayParams
@@ -58,7 +57,7 @@ export type LastPaymentError = StripeError<string> & {
58
57
  paymentMethod: PaymentMethodResult;
59
58
  };
60
59
 
61
- export type FutureUsage = 'OffSession' | 'OnSession';
60
+ export type FutureUsage = 'OffSession' | 'OnSession' | 'None';
62
61
 
63
62
  export interface ShippingDetails {
64
63
  address: Required<Address>;
@@ -149,15 +148,6 @@ export interface OxxoParams {
149
148
  };
150
149
  }
151
150
 
152
- export interface SofortParams {
153
- paymentMethodType: 'Sofort';
154
- paymentMethodData: {
155
- country: string;
156
- billingDetails: BillingDetails;
157
- mandateData?: MandateData;
158
- metadata?: MetaData;
159
- };
160
- }
161
151
  export interface GrabPayParams {
162
152
  paymentMethodType: 'GrabPay';
163
153
  paymentMethodData?: {
@@ -20,7 +20,6 @@ export interface Result {
20
20
  Fpx: FpxResult;
21
21
  Ideal: IdealResult;
22
22
  SepaDebit: SepaDebitResult;
23
- Sofort: SofortResult;
24
23
  Upi: UpiResult;
25
24
  USBankAccount: USBankAccountResult;
26
25
  }
@@ -35,7 +34,6 @@ export type CreateParams =
35
34
  | SepaParams
36
35
  | EpsParams
37
36
  | AuBecsDebitParams
38
- | SofortParams
39
37
  | GrabPayParams
40
38
  | FPXParams
41
39
  | AfterpayClearpayParams
@@ -98,13 +96,6 @@ export interface OxxoParams {
98
96
  };
99
97
  }
100
98
 
101
- export interface SofortParams {
102
- paymentMethodType: 'Sofort';
103
- paymentMethodData: {
104
- country: string;
105
- billingDetails: BillingDetails;
106
- };
107
- }
108
99
  export interface GrabPayParams {
109
100
  paymentMethodType: 'GrabPay';
110
101
  paymentMethodData?: {
@@ -264,10 +255,6 @@ export interface SepaDebitResult {
264
255
  last4?: string;
265
256
  }
266
257
 
267
- export interface SofortResult {
268
- country?: string;
269
- }
270
-
271
258
  export interface UpiResult {
272
259
  vpa?: string;
273
260
  }
@@ -300,7 +287,6 @@ export type Type =
300
287
  | 'Eps'
301
288
  | 'Bancontact'
302
289
  | 'Oxxo'
303
- | 'Sofort'
304
290
  | 'Upi'
305
291
  | 'USBankAccount'
306
292
  | 'PayPal'
@@ -84,6 +84,8 @@ export type SetupParamsBase = IntentParams & {
84
84
  * Note: Card brand filtering is not currently supported in Link.
85
85
  */
86
86
  cardBrandAcceptance?: CardBrandAcceptance;
87
+ /** Configuration for custom payment methods in PaymentSheet */
88
+ customPaymentMethodConfiguration?: CustomPaymentMethodConfiguration;
87
89
  };
88
90
 
89
91
  export type SetupParams =
@@ -358,6 +360,10 @@ export enum RowStyle {
358
360
  FloatingButton = 'floatingButton',
359
361
  /** A flat style with a checkmark */
360
362
  FlatWithCheckmark = 'flatWithCheckmark',
363
+ /** A flat style with a chevron
364
+ * Note that the EmbeddedPaymentElementConfiguration.rowSelectionBehavior must be set to `immediateAction` to use this style.
365
+ */
366
+ FlatWithChevron = 'flatWithChevron',
361
367
  }
362
368
 
363
369
  /** Describes the appearance of the radio button */
@@ -381,6 +387,14 @@ export interface CheckmarkConfig {
381
387
  color?: ThemedColor;
382
388
  }
383
389
 
390
+ /** Describes the appearance of the chevron */
391
+ export interface ChevronConfig {
392
+ /** The color of the chevron, represented as a hex string #AARRGGBB or #RRGGBB.
393
+ * @default The iOS or Android system gray color
394
+ */
395
+ color?: ThemedColor;
396
+ }
397
+
384
398
  /** Describes the appearance of the flat style row */
385
399
  export interface FlatConfig {
386
400
  /** The thickness of the separator line between rows.
@@ -395,7 +409,7 @@ export interface FlatConfig {
395
409
 
396
410
  /** The insets of the separator line between rows.
397
411
  * @default { top: 0, left: 30, bottom: 0, right: 0 } for RowStyle.FlatWithRadio
398
- * @default { top: 0, left: 0, bottom: 0, right: 0 } for RowStyle.FlatWithCheckmark and RowStyle.FloatingButton
412
+ * @default { top: 0, left: 0, bottom: 0, right: 0 } for RowStyle.FlatWithCheckmark, RowStyle.FlatWithChevron, and RowStyle.FloatingButton
399
413
  */
400
414
  separatorInsets?: EdgeInsetsConfig;
401
415
 
@@ -414,6 +428,9 @@ export interface FlatConfig {
414
428
 
415
429
  /** Appearance settings for the checkmark (used when RowStyle is FlatWithCheckmark) */
416
430
  checkmark?: CheckmarkConfig;
431
+
432
+ /** Appearance settings for the chevron (used when RowStyle is FlatWithChevron) */
433
+ chevron?: ChevronConfig;
417
434
  }
418
435
 
419
436
  /** Describes the appearance of the floating button style payment method row */
@@ -562,6 +579,17 @@ export type PaymentMode = {
562
579
  /* Controls when the funds will be captured.
563
580
  Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method */
564
581
  captureMethod?: CaptureMethod;
582
+ /** Additional payment method options params.
583
+ Seealso: https://docs.stripe.com/api/payment_intents/create#create_payment_intent-payment_method_options */
584
+ paymentMethodOptions?: PaymentMethodOptions;
585
+ };
586
+
587
+ export type PaymentMethodOptions = {
588
+ /* This is an experimental feature that may be removed at any time
589
+ A map of payment method types to setup_future_usage value. (e.g. card: 'OffSession') */
590
+ setupFutureUsageValues: {
591
+ [key: string]: FutureUsage;
592
+ };
565
593
  };
566
594
 
567
595
  /* Use this if your integration creates a SetupIntent */
@@ -640,3 +668,60 @@ export type CardBrandAcceptance =
640
668
  */
641
669
  brands: CardBrandCategory[];
642
670
  };
671
+
672
+ /**
673
+ * Configuration for a custom payment method.
674
+ */
675
+ export interface CustomPaymentMethod {
676
+ /** The custom payment method ID (beginning with `cpmt_`) as created in your Stripe Dashboard. */
677
+ id: string;
678
+ /** Optional subtitle to display beneath the custom payment method name. */
679
+ subtitle?: string;
680
+ /** Whether to disable billing detail collection for this custom payment method. Defaults to true. */
681
+ disableBillingDetailCollection?: boolean;
682
+ }
683
+
684
+ /**
685
+ * Custom payment method confirmation result type for PaymentSheet.
686
+ */
687
+ export enum CustomPaymentMethodResultStatus {
688
+ /** The custom payment method transaction was completed successfully */
689
+ Completed = 'completed',
690
+ /** The custom payment method transaction was canceled by the user */
691
+ Canceled = 'canceled',
692
+ /** The custom payment method transaction failed */
693
+ Failed = 'failed',
694
+ }
695
+
696
+ /**
697
+ * Result object returned when a custom payment method transaction completes.
698
+ * Contains the transaction status and, in case of failure, an error message.
699
+ */
700
+ export type CustomPaymentMethodResult =
701
+ | { status: CustomPaymentMethodResultStatus.Completed }
702
+ | { status: CustomPaymentMethodResultStatus.Canceled }
703
+ | { status: CustomPaymentMethodResultStatus.Failed; error: string };
704
+
705
+ /**
706
+ * Callback function called when a custom payment method is selected and confirmed.
707
+ * Your implementation should complete the payment using your custom payment provider's SDK.
708
+ */
709
+ export type ConfirmCustomPaymentMethodCallback = (
710
+ customPaymentMethod: CustomPaymentMethod,
711
+ billingDetails: BillingDetails | null,
712
+ /**
713
+ * Call this function with the result of your custom payment method transaction.
714
+ * @param result The result of the custom payment method confirmation
715
+ */
716
+ resultHandler: (result: CustomPaymentMethodResult) => void
717
+ ) => void;
718
+
719
+ /**
720
+ * Configuration for custom payment methods in PaymentSheet.
721
+ */
722
+ export interface CustomPaymentMethodConfiguration {
723
+ /** Array of custom payment methods to display in the Payment Sheet */
724
+ customPaymentMethods: CustomPaymentMethod[];
725
+ /** Callback function to handle custom payment method confirmation */
726
+ confirmCustomPaymentMethodCallback: ConfirmCustomPaymentMethodCallback;
727
+ }
@@ -2,7 +2,7 @@ require 'json'
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
4
  # Keep stripe_version in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/stripe-identity-react-native.podspec
5
- stripe_version = '~> 24.15.0'
5
+ stripe_version = '~> 24.16.1'
6
6
 
7
7
  fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
8
8
 
File without changes
@@ -1,2 +0,0 @@
1
- #Mon Mar 10 14:09:18 MDT 2025
2
- gradle.version=8.11.1
@@ -1,2 +0,0 @@
1
- #Tue Sep 24 20:02:13 MDT 2024
2
- java.home=/Applications/Android Studio.app/Contents/jbr/Contents/Home
Binary file
File without changes