@stripe/stripe-react-native 0.48.0 → 0.49.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 (102) hide show
  1. package/.env +19 -0
  2. package/CHANGELOG.md +8 -0
  3. package/android/gradle.properties +1 -1
  4. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +85 -65
  5. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +18 -2
  6. package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +0 -2
  7. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +57 -3
  8. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +25 -0
  9. package/ios/PaymentSheetAppearance.swift +22 -1
  10. package/ios/StripeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  11. package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcuserdata/wooj.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  12. package/ios/StripeSdk.xcodeproj/xcuserdata/wooj.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
  13. package/ios/StripeSdkImpl+PaymentSheet.swift +43 -5
  14. package/ios/StripeSdkImpl.swift +5 -1
  15. package/lib/commonjs/components/AddToWalletButton.js +1 -1
  16. package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
  17. package/lib/commonjs/components/AddressSheet.js +1 -1
  18. package/lib/commonjs/components/AddressSheet.js.map +1 -1
  19. package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
  20. package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
  21. package/lib/commonjs/components/CardField.js +1 -1
  22. package/lib/commonjs/components/CardField.js.map +1 -1
  23. package/lib/commonjs/components/CardForm.js +1 -1
  24. package/lib/commonjs/components/CardForm.js.map +1 -1
  25. package/lib/commonjs/components/CustomerSheet.js +1 -1
  26. package/lib/commonjs/components/CustomerSheet.js.map +1 -1
  27. package/lib/commonjs/components/PlatformPayButton.js +1 -1
  28. package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
  29. package/lib/commonjs/components/StripeContainer.js +1 -1
  30. package/lib/commonjs/components/StripeContainer.js.map +1 -1
  31. package/lib/commonjs/events.js.map +1 -1
  32. package/lib/commonjs/functions.js +1 -1
  33. package/lib/commonjs/functions.js.map +1 -1
  34. package/lib/commonjs/hooks/useStripe.js +1 -1
  35. package/lib/commonjs/hooks/useStripe.js.map +1 -1
  36. package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
  37. package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
  38. package/lib/commonjs/types/PaymentSheet.js +1 -1
  39. package/lib/commonjs/types/PaymentSheet.js.map +1 -1
  40. package/lib/module/components/AddToWalletButton.js +1 -1
  41. package/lib/module/components/AddToWalletButton.js.map +1 -1
  42. package/lib/module/components/AddressSheet.js +1 -1
  43. package/lib/module/components/AddressSheet.js.map +1 -1
  44. package/lib/module/components/AuBECSDebitForm.js +1 -1
  45. package/lib/module/components/AuBECSDebitForm.js.map +1 -1
  46. package/lib/module/components/CardField.js +1 -1
  47. package/lib/module/components/CardField.js.map +1 -1
  48. package/lib/module/components/CardForm.js +1 -1
  49. package/lib/module/components/CardForm.js.map +1 -1
  50. package/lib/module/components/CustomerSheet.js +1 -1
  51. package/lib/module/components/CustomerSheet.js.map +1 -1
  52. package/lib/module/components/PlatformPayButton.js +1 -1
  53. package/lib/module/components/PlatformPayButton.js.map +1 -1
  54. package/lib/module/components/StripeContainer.js +1 -1
  55. package/lib/module/components/StripeContainer.js.map +1 -1
  56. package/lib/module/events.js.map +1 -1
  57. package/lib/module/functions.js +1 -1
  58. package/lib/module/functions.js.map +1 -1
  59. package/lib/module/hooks/useStripe.js +1 -1
  60. package/lib/module/hooks/useStripe.js.map +1 -1
  61. package/lib/module/types/EmbeddedPaymentElement.js +1 -1
  62. package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
  63. package/lib/module/types/PaymentSheet.js +1 -1
  64. package/lib/module/types/PaymentSheet.js.map +1 -1
  65. package/lib/typescript/src/events.d.ts +1 -1
  66. package/lib/typescript/src/events.d.ts.map +1 -1
  67. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +27 -0
  68. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
  69. package/lib/typescript/src/types/PaymentIntent.d.ts +1 -1
  70. package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -1
  71. package/lib/typescript/src/types/PaymentSheet.d.ts +23 -2
  72. package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
  73. package/package-lock.json +14114 -0
  74. package/package.json +1 -1
  75. package/src/events.ts +1 -0
  76. package/src/types/EmbeddedPaymentElement.tsx +47 -2
  77. package/src/types/PaymentIntent.ts +1 -1
  78. package/src/types/PaymentSheet.ts +27 -1
  79. package/stripe-react-native.podspec +1 -1
  80. package/android/.gradle/8.11.1/checksums/checksums.lock +0 -0
  81. package/android/.gradle/8.11.1/checksums/md5-checksums.bin +0 -0
  82. package/android/.gradle/8.11.1/checksums/sha1-checksums.bin +0 -0
  83. package/android/.gradle/8.11.1/executionHistory/executionHistory.bin +0 -0
  84. package/android/.gradle/8.11.1/executionHistory/executionHistory.lock +0 -0
  85. package/android/.gradle/8.11.1/fileChanges/last-build.bin +0 -0
  86. package/android/.gradle/8.11.1/fileHashes/fileHashes.bin +0 -0
  87. package/android/.gradle/8.11.1/fileHashes/fileHashes.lock +0 -0
  88. package/android/.gradle/8.11.1/gc.properties +0 -0
  89. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  90. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  91. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  92. package/android/.gradle/config.properties +0 -2
  93. package/android/.gradle/file-system.probe +0 -0
  94. package/android/.gradle/vcs-1/gc.properties +0 -0
  95. package/android/.idea/caches/deviceStreaming.xml +0 -619
  96. package/android/.idea/compiler.xml +0 -6
  97. package/android/.idea/gradle.xml +0 -19
  98. package/android/.idea/migrations.xml +0 -10
  99. package/android/.idea/misc.xml +0 -10
  100. package/android/.idea/runConfigurations.xml +0 -17
  101. package/android/.idea/vcs.xml +0 -6
  102. 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.49.0",
4
4
  "author": "Stripe",
5
5
  "description": "Stripe SDK for React Native",
6
6
  "main": "lib/commonjs/index",
package/src/events.ts CHANGED
@@ -34,6 +34,7 @@ type Events =
34
34
  | 'onCustomerAdapterFetchSelectedPaymentOptionCallback'
35
35
  | 'onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback'
36
36
  | 'embeddedPaymentElementFormSheetConfirmComplete'
37
+ | 'embeddedPaymentElementRowSelectionImmediateAction'
37
38
  | 'embeddedPaymentElementDidUpdatePaymentOption'
38
39
  | 'embeddedPaymentElementDidUpdateHeight'
39
40
  | 'embeddedPaymentElementLoadingFailed';
@@ -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,10 @@ 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
+ /** The view can display payment methods that, when tapped, do not open a sheet to collect additional details.
196
+ * `rowSelectionBehavior` controls the behavior tapping on these payment methods performs.
197
+ */
198
+ rowSelectionBehavior?: EmbeddedRowSelectionBehavior;
169
199
  }
170
200
 
171
201
  // -----------------------------------------------------------------------------
@@ -209,12 +239,13 @@ class EmbeddedPaymentElement {
209
239
  // -----------------------------------------------------------------------------
210
240
  let confirmHandlerCallback: EventSubscription | null = null;
211
241
  let formSheetActionConfirmCallback: EventSubscription | null = null;
242
+ let rowSelectionCallback: EventSubscription | null = null;
212
243
 
213
244
  async function createEmbeddedPaymentElement(
214
245
  intentConfig: PaymentSheetTypes.IntentConfiguration,
215
246
  configuration: EmbeddedPaymentElementConfiguration
216
247
  ): Promise<EmbeddedPaymentElement> {
217
- setupConfirmHandlers(intentConfig, configuration);
248
+ setupConfirmAndSelectionHandlers(intentConfig, configuration);
218
249
 
219
250
  await NativeStripeSdkModule.createEmbeddedPaymentElement(
220
251
  intentConfig,
@@ -223,7 +254,7 @@ async function createEmbeddedPaymentElement(
223
254
  return new EmbeddedPaymentElement();
224
255
  }
225
256
 
226
- function setupConfirmHandlers(
257
+ function setupConfirmAndSelectionHandlers(
227
258
  intentConfig: PaymentSheetTypes.IntentConfiguration,
228
259
  configuration: EmbeddedPaymentElementConfiguration
229
260
  ) {
@@ -262,6 +293,20 @@ function setupConfirmHandlers(
262
293
  );
263
294
  }
264
295
  }
296
+
297
+ if (configuration.rowSelectionBehavior?.type === 'immediateAction') {
298
+ const rowSelectionHandler =
299
+ configuration.rowSelectionBehavior.onSelectPaymentOption;
300
+ if (rowSelectionHandler) {
301
+ rowSelectionCallback?.remove();
302
+ rowSelectionCallback = addListener(
303
+ 'embeddedPaymentElementRowSelectionImmediateAction',
304
+ () => {
305
+ rowSelectionHandler();
306
+ }
307
+ );
308
+ }
309
+ }
265
310
  }
266
311
 
267
312
  // -----------------------------------------------------------------------------
@@ -58,7 +58,7 @@ export type LastPaymentError = StripeError<string> & {
58
58
  paymentMethod: PaymentMethodResult;
59
59
  };
60
60
 
61
- export type FutureUsage = 'OffSession' | 'OnSession';
61
+ export type FutureUsage = 'OffSession' | 'OnSession' | 'None';
62
62
 
63
63
  export interface ShippingDetails {
64
64
  address: Required<Address>;
@@ -358,6 +358,10 @@ export enum RowStyle {
358
358
  FloatingButton = 'floatingButton',
359
359
  /** A flat style with a checkmark */
360
360
  FlatWithCheckmark = 'flatWithCheckmark',
361
+ /** A flat style with a chevron
362
+ * Note that the EmbeddedPaymentElementConfiguration.rowSelectionBehavior must be set to `immediateAction` to use this style.
363
+ */
364
+ FlatWithChevron = 'flatWithChevron',
361
365
  }
362
366
 
363
367
  /** Describes the appearance of the radio button */
@@ -381,6 +385,14 @@ export interface CheckmarkConfig {
381
385
  color?: ThemedColor;
382
386
  }
383
387
 
388
+ /** Describes the appearance of the chevron */
389
+ export interface ChevronConfig {
390
+ /** The color of the chevron, represented as a hex string #AARRGGBB or #RRGGBB.
391
+ * @default The iOS or Android system gray color
392
+ */
393
+ color?: ThemedColor;
394
+ }
395
+
384
396
  /** Describes the appearance of the flat style row */
385
397
  export interface FlatConfig {
386
398
  /** The thickness of the separator line between rows.
@@ -395,7 +407,7 @@ export interface FlatConfig {
395
407
 
396
408
  /** The insets of the separator line between rows.
397
409
  * @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
410
+ * @default { top: 0, left: 0, bottom: 0, right: 0 } for RowStyle.FlatWithCheckmark, RowStyle.FlatWithChevron, and RowStyle.FloatingButton
399
411
  */
400
412
  separatorInsets?: EdgeInsetsConfig;
401
413
 
@@ -414,6 +426,9 @@ export interface FlatConfig {
414
426
 
415
427
  /** Appearance settings for the checkmark (used when RowStyle is FlatWithCheckmark) */
416
428
  checkmark?: CheckmarkConfig;
429
+
430
+ /** Appearance settings for the chevron (used when RowStyle is FlatWithChevron) */
431
+ chevron?: ChevronConfig;
417
432
  }
418
433
 
419
434
  /** Describes the appearance of the floating button style payment method row */
@@ -562,6 +577,17 @@ export type PaymentMode = {
562
577
  /* Controls when the funds will be captured.
563
578
  Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method */
564
579
  captureMethod?: CaptureMethod;
580
+ /** Additional payment method options params.
581
+ Seealso: https://docs.stripe.com/api/payment_intents/create#create_payment_intent-payment_method_options */
582
+ paymentMethodOptions?: PaymentMethodOptions;
583
+ };
584
+
585
+ export type PaymentMethodOptions = {
586
+ /* This is an experimental feature that may be removed at any time
587
+ A map of payment method types to setup_future_usage value. (e.g. card: 'OffSession') */
588
+ setupFutureUsageValues: {
589
+ [key: string]: FutureUsage;
590
+ };
565
591
  };
566
592
 
567
593
  /* Use this if your integration creates a SetupIntent */
@@ -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