@stripe/stripe-react-native 0.27.2 → 0.29.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 (141) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +2 -2
  3. package/android/gradle.properties +1 -1
  4. package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +4 -0
  5. package/android/src/main/java/com/reactnativestripesdk/CardFieldViewManager.kt +5 -0
  6. package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +4 -0
  7. package/android/src/main/java/com/reactnativestripesdk/CardFormViewManager.kt +5 -0
  8. package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +33 -7
  9. package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt +0 -5
  10. package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +11 -27
  11. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +131 -6
  12. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +29 -6
  13. package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +2 -0
  14. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +14 -1
  15. package/ios/ApplePayButtonView.swift +4 -18
  16. package/ios/ApplePayViewController.swift +1 -28
  17. package/ios/CardFieldManager.m +1 -0
  18. package/ios/CardFieldView.swift +6 -0
  19. package/ios/CardFormManager.m +2 -2
  20. package/ios/CardFormView.swift +9 -9
  21. package/ios/StripeSdk+PaymentSheet.swift +100 -10
  22. package/ios/StripeSdk.m +15 -29
  23. package/ios/StripeSdk.swift +32 -91
  24. package/jest/mock.js +0 -6
  25. package/lib/commonjs/NativeStripeSdk.js.map +1 -1
  26. package/lib/commonjs/components/ApplePayButtonNative.js.map +1 -1
  27. package/lib/commonjs/components/CardField.js +1 -1
  28. package/lib/commonjs/components/CardField.js.map +1 -1
  29. package/lib/commonjs/components/CardForm.js +1 -1
  30. package/lib/commonjs/components/CardForm.js.map +1 -1
  31. package/lib/commonjs/components/GooglePayButtonNative.js.map +1 -1
  32. package/lib/commonjs/components/PlatformPayButton.js +1 -1
  33. package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
  34. package/lib/commonjs/functions.js +1 -1
  35. package/lib/commonjs/functions.js.map +1 -1
  36. package/lib/commonjs/hooks/useStripe.js +1 -1
  37. package/lib/commonjs/hooks/useStripe.js.map +1 -1
  38. package/lib/commonjs/index.js +1 -1
  39. package/lib/commonjs/index.js.map +1 -1
  40. package/lib/commonjs/types/ApplePay.js.map +1 -1
  41. package/lib/commonjs/types/PaymentIntent.js.map +1 -1
  42. package/lib/commonjs/types/PaymentSheet.js +1 -1
  43. package/lib/commonjs/types/PaymentSheet.js.map +1 -1
  44. package/lib/commonjs/types/PlatformPay.js.map +1 -1
  45. package/lib/commonjs/types/components/CardFieldInput.js.map +1 -1
  46. package/lib/commonjs/types/components/CardFormView.js.map +1 -1
  47. package/lib/commonjs/types/components/GooglePayButtonComponent.js.map +1 -1
  48. package/lib/commonjs/types/index.js +1 -1
  49. package/lib/commonjs/types/index.js.map +1 -1
  50. package/lib/module/NativeStripeSdk.js.map +1 -1
  51. package/lib/module/components/ApplePayButtonNative.js.map +1 -1
  52. package/lib/module/components/CardField.js +1 -1
  53. package/lib/module/components/CardField.js.map +1 -1
  54. package/lib/module/components/CardForm.js +1 -1
  55. package/lib/module/components/CardForm.js.map +1 -1
  56. package/lib/module/components/GooglePayButtonNative.js.map +1 -1
  57. package/lib/module/components/PlatformPayButton.js +1 -1
  58. package/lib/module/components/PlatformPayButton.js.map +1 -1
  59. package/lib/module/functions.js +1 -1
  60. package/lib/module/functions.js.map +1 -1
  61. package/lib/module/hooks/useStripe.js +1 -1
  62. package/lib/module/hooks/useStripe.js.map +1 -1
  63. package/lib/module/index.js +1 -1
  64. package/lib/module/index.js.map +1 -1
  65. package/lib/module/types/ApplePay.js.map +1 -1
  66. package/lib/module/types/PaymentIntent.js.map +1 -1
  67. package/lib/module/types/PaymentSheet.js +1 -1
  68. package/lib/module/types/PaymentSheet.js.map +1 -1
  69. package/lib/module/types/PlatformPay.js.map +1 -1
  70. package/lib/module/types/components/CardFieldInput.js.map +1 -1
  71. package/lib/module/types/components/CardFormView.js.map +1 -1
  72. package/lib/module/types/components/GooglePayButtonComponent.js.map +1 -1
  73. package/lib/module/types/index.js +1 -1
  74. package/lib/module/types/index.js.map +1 -1
  75. package/lib/typescript/src/NativeStripeSdk.d.ts +4 -15
  76. package/lib/typescript/src/components/ApplePayButtonNative.d.ts +1 -1
  77. package/lib/typescript/src/components/CardField.d.ts +2 -0
  78. package/lib/typescript/src/components/CardForm.d.ts +2 -0
  79. package/lib/typescript/src/components/GooglePayButtonNative.d.ts +1 -1
  80. package/lib/typescript/src/components/PlatformPayButton.d.ts +2 -1
  81. package/lib/typescript/src/functions.d.ts +8 -27
  82. package/lib/typescript/src/hooks/usePlatformPay.d.ts +1 -1
  83. package/lib/typescript/src/hooks/useStripe.d.ts +2 -18
  84. package/lib/typescript/src/index.d.ts +0 -7
  85. package/lib/typescript/src/types/ApplePay.d.ts +0 -52
  86. package/lib/typescript/src/types/PaymentIntent.d.ts +3 -2
  87. package/lib/typescript/src/types/PaymentSheet.d.ts +48 -2
  88. package/lib/typescript/src/types/PlatformPay.d.ts +35 -5
  89. package/lib/typescript/src/types/components/CardFieldInput.d.ts +1 -0
  90. package/lib/typescript/src/types/components/CardFormView.d.ts +1 -0
  91. package/lib/typescript/src/types/components/GooglePayButtonComponent.d.ts +0 -1
  92. package/lib/typescript/src/types/index.d.ts +1 -4
  93. package/package.json +1 -1
  94. package/src/NativeStripeSdk.tsx +6 -31
  95. package/src/components/ApplePayButtonNative.tsx +1 -1
  96. package/src/components/CardField.tsx +2 -0
  97. package/src/components/CardForm.tsx +2 -4
  98. package/src/components/GooglePayButtonNative.tsx +1 -1
  99. package/src/components/PlatformPayButton.tsx +2 -1
  100. package/src/functions.ts +54 -200
  101. package/src/hooks/useStripe.tsx +2 -109
  102. package/src/index.tsx +0 -7
  103. package/src/types/ApplePay.ts +0 -71
  104. package/src/types/PaymentIntent.ts +4 -2
  105. package/src/types/PaymentSheet.ts +86 -2
  106. package/src/types/PlatformPay.ts +36 -5
  107. package/src/types/components/CardFieldInput.ts +1 -0
  108. package/src/types/components/CardFormView.ts +1 -1
  109. package/src/types/components/GooglePayButtonComponent.ts +0 -1
  110. package/src/types/index.ts +0 -6
  111. package/stripe-react-native.podspec +1 -1
  112. package/lib/commonjs/components/ApplePayButton.js +0 -2
  113. package/lib/commonjs/components/ApplePayButton.js.map +0 -1
  114. package/lib/commonjs/components/GooglePayButton.js +0 -2
  115. package/lib/commonjs/components/GooglePayButton.js.map +0 -1
  116. package/lib/commonjs/hooks/useApplePay.js +0 -2
  117. package/lib/commonjs/hooks/useApplePay.js.map +0 -1
  118. package/lib/commonjs/hooks/useGooglePay.js +0 -2
  119. package/lib/commonjs/hooks/useGooglePay.js.map +0 -1
  120. package/lib/commonjs/types/GooglePay.js +0 -2
  121. package/lib/commonjs/types/GooglePay.js.map +0 -1
  122. package/lib/module/components/ApplePayButton.js +0 -2
  123. package/lib/module/components/ApplePayButton.js.map +0 -1
  124. package/lib/module/components/GooglePayButton.js +0 -2
  125. package/lib/module/components/GooglePayButton.js.map +0 -1
  126. package/lib/module/hooks/useApplePay.js +0 -2
  127. package/lib/module/hooks/useApplePay.js.map +0 -1
  128. package/lib/module/hooks/useGooglePay.js +0 -2
  129. package/lib/module/hooks/useGooglePay.js.map +0 -1
  130. package/lib/module/types/GooglePay.js +0 -2
  131. package/lib/module/types/GooglePay.js.map +0 -1
  132. package/lib/typescript/src/components/ApplePayButton.d.ts +0 -31
  133. package/lib/typescript/src/components/GooglePayButton.d.ts +0 -26
  134. package/lib/typescript/src/hooks/useApplePay.d.ts +0 -54
  135. package/lib/typescript/src/hooks/useGooglePay.d.ts +0 -11
  136. package/lib/typescript/src/types/GooglePay.d.ts +0 -47
  137. package/src/components/ApplePayButton.tsx +0 -108
  138. package/src/components/GooglePayButton.tsx +0 -58
  139. package/src/hooks/useApplePay.tsx +0 -161
  140. package/src/hooks/useGooglePay.tsx +0 -72
  141. package/src/types/GooglePay.ts +0 -74
@@ -24,7 +24,8 @@ export interface Props extends AccessibilityProps {
24
24
  shippingMethod: ShippingMethod;
25
25
  }) => void;
26
26
  /**
27
- * This callback is triggered whenever the user selects a shipping contact in the Apple Pay sheet.
27
+ * This callback is triggered whenever the user selects a shipping contact in the Apple Pay sheet IF
28
+ * ContactField.PostalAddress was included in the requiredShippingAddressFields array.
28
29
  * It receives one parameter: an `event` object with a `shippingContact` field. You MUST
29
30
  * update the Apple Pay sheet in your callback using the updatePlatformPaySheet function, otherwise the
30
31
  * Apple Pay sheet will hang and the payment flow will automatically cancel.
@@ -1,4 +1,4 @@
1
- import { ApplePay, ApplePayError, ApplePayResult, PlatformPayError, ConfirmPaymentResult, ConfirmPaymentSheetPaymentResult, SetupIntent, PaymentIntent, ConfirmSetupIntentResult, CreatePaymentMethodResult, CreateTokenForCVCUpdateResult, CreateTokenResult, GooglePayInitResult, HandleNextActionResult, InitPaymentSheetResult, PaymentMethod, PaymentSheet, PayWithGooglePayResult, PresentPaymentSheetResult, RetrievePaymentIntentResult, RetrieveSetupIntentResult, StripeError, GooglePay, CreateGooglePayPaymentMethodResult, OpenApplePaySetupResult, Token, VerifyMicrodepositsParams, VerifyMicrodepositsForPaymentResult, VerifyMicrodepositsForSetupResult, CollectBankAccountForPaymentResult, CollectBankAccountForSetupResult, IsCardInWalletResult, CanAddCardToWalletParams, CanAddCardToWalletResult, FinancialConnections, PlatformPay } from './types';
1
+ import type { PlatformPayError, ConfirmPaymentResult, ConfirmPaymentSheetPaymentResult, SetupIntent, PaymentIntent, ConfirmSetupIntentResult, CreatePaymentMethodResult, CreateTokenForCVCUpdateResult, CreateTokenResult, HandleNextActionResult, InitPaymentSheetResult, PaymentMethod, PaymentSheet, PresentPaymentSheetResult, RetrievePaymentIntentResult, RetrieveSetupIntentResult, StripeError, Token, VerifyMicrodepositsParams, VerifyMicrodepositsForPaymentResult, VerifyMicrodepositsForSetupResult, CollectBankAccountForPaymentResult, CollectBankAccountForSetupResult, IsCardInWalletResult, CanAddCardToWalletParams, CanAddCardToWalletResult, FinancialConnections, PlatformPay } from './types';
2
2
  export declare const createPaymentMethod: (params: PaymentMethod.CreateParams, options?: PaymentMethod.CreateOptions) => Promise<CreatePaymentMethodResult>;
3
3
  export declare const createToken: (params: Token.CreateParams) => Promise<CreateTokenResult>;
4
4
  export declare const retrievePaymentIntent: (clientSecret: string) => Promise<RetrievePaymentIntentResult>;
@@ -12,21 +12,6 @@ export declare const retrieveSetupIntent: (clientSecret: string) => Promise<Retr
12
12
  * @returns A promise that resolves to an object containing either a `paymentIntent` field, or an `error` field.
13
13
  */
14
14
  export declare const confirmPayment: (paymentIntentClientSecret: string, params?: PaymentIntent.ConfirmParams | undefined, options?: PaymentIntent.ConfirmOptions) => Promise<ConfirmPaymentResult>;
15
- /** @deprecated Use `isPlatformPaySupported` instead. */
16
- export declare const isApplePaySupported: () => Promise<boolean>;
17
- /** @deprecated Use `confirmPlatformPaySetupIntent`, `confirmPlatformPayPayment`, or `createPlatformPayPaymentMethod` instead. */
18
- export declare const presentApplePay: (params: ApplePay.PresentParams) => Promise<ApplePayResult>;
19
- /** @deprecated Use `updatePlatformPaySheet` instead. */
20
- export declare const updateApplePaySummaryItems: (summaryItems: ApplePay.CartSummaryItem[], errorAddressFields?: Array<{
21
- field: ApplePay.AddressFields;
22
- message?: string;
23
- }>) => Promise<{
24
- error?: StripeError<ApplePayError>;
25
- }>;
26
- /** @deprecated Use `confirmPlatformPaySetupIntent` or `confirmPlatformPayPayment` instead. */
27
- export declare const confirmApplePayPayment: (clientSecret: string) => Promise<{
28
- error?: StripeError<ApplePayError>;
29
- }>;
30
15
  /** Handles any nextAction required to authenticate the PaymentIntent.
31
16
  * Call this method if you are using manual confirmation. See https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=custom
32
17
  *
@@ -36,6 +21,12 @@ export declare const confirmApplePayPayment: (clientSecret: string) => Promise<{
36
21
  export declare const handleNextAction: (paymentIntentClientSecret: string, returnURL?: string | undefined) => Promise<HandleNextActionResult>;
37
22
  export declare const confirmSetupIntent: (paymentIntentClientSecret: string, params: SetupIntent.ConfirmParams, options?: SetupIntent.ConfirmOptions) => Promise<ConfirmSetupIntentResult>;
38
23
  export declare const createTokenForCVCUpdate: (cvc: string) => Promise<CreateTokenForCVCUpdateResult>;
24
+ /**
25
+ * Call this method in your app whenever you receive a URL for a Stripe callback.
26
+ * For convenience, you can pass all URLs you receive to this method first, and
27
+ * check the return value to easily determine whether it is a callback URL that Stripe will handle
28
+ * or if your app should process it normally. This is iOS-only, and will always return false on Android.
29
+ */
39
30
  export declare const handleURLCallback: (url: string) => Promise<boolean>;
40
31
  export declare const verifyMicrodepositsForPayment: (clientSecret: string, params: VerifyMicrodepositsParams) => Promise<VerifyMicrodepositsForPaymentResult>;
41
32
  export declare const verifyMicrodepositsForSetup: (clientSecret: string, params: VerifyMicrodepositsParams) => Promise<VerifyMicrodepositsForSetupResult>;
@@ -48,16 +39,6 @@ export declare const confirmPaymentSheetPayment: () => Promise<ConfirmPaymentShe
48
39
  * is also cleared during logout.
49
40
  */
50
41
  export declare const resetPaymentSheetCustomer: () => Promise<null>;
51
- /** @deprecated Use `isPlatformPaySupported` instead. */
52
- export declare const isGooglePaySupported: (params?: GooglePay.IsSupportedParams | undefined) => Promise<boolean>;
53
- /** @deprecated Use `confirmPlatformPaySetupIntent`, `confirmPlatformPayPayment`, or `createPlatformPayPaymentMethod` instead. */
54
- export declare const initGooglePay: (params: GooglePay.InitParams) => Promise<GooglePayInitResult>;
55
- /** @deprecated Use `confirmPlatformPaySetupIntent`, `confirmPlatformPayPayment`, or `createPlatformPayPaymentMethod` instead. */
56
- export declare const presentGooglePay: (params: GooglePay.PresentParams) => Promise<PayWithGooglePayResult>;
57
- /** @deprecated Use `createPlatformPayPaymentMethod` instead. */
58
- export declare const createGooglePayPaymentMethod: (params: GooglePay.CreatePaymentMethodParams) => Promise<CreateGooglePayPaymentMethodResult>;
59
- /** @deprecated Use `openNativePaySetup` instead. */
60
- export declare const openApplePaySetup: () => Promise<OpenApplePaySetupResult>;
61
42
  export declare const collectBankAccountForPayment: (clientSecret: string, params: PaymentMethod.CollectBankAccountParams) => Promise<CollectBankAccountForPaymentResult>;
62
43
  export declare const collectBankAccountForSetup: (clientSecret: string, params: PaymentMethod.CollectBankAccountParams) => Promise<CollectBankAccountForSetupResult>;
63
44
  /**
@@ -96,7 +77,7 @@ export declare const Constants: {
96
77
  * @returns A boolean indicating whether or not the native wallet is supported.
97
78
  */
98
79
  export declare const isPlatformPaySupported: (params?: {
99
- googlePay?: GooglePay.IsSupportedParams | undefined;
80
+ googlePay?: PlatformPay.IsGooglePaySupportedParams | undefined;
100
81
  } | undefined) => Promise<boolean>;
101
82
  /**
102
83
  * Launches the relevant native wallet sheet (Apple Pay on iOS, Google Pay on Android) in order to confirm a Stripe [SetupIntent](https://stripe.com/docs/api/setup_intents).
@@ -10,7 +10,7 @@ export declare function usePlatformPay(): {
10
10
  * @returns A boolean indicating whether or not the native wallet is supported.
11
11
  */
12
12
  isPlatformPaySupported: (params?: {
13
- googlePay?: import("../types/GooglePay").IsSupportedParams | undefined;
13
+ googlePay?: PlatformPay.IsGooglePaySupportedParams | undefined;
14
14
  } | undefined) => Promise<boolean>;
15
15
  /**
16
16
  * Launches the relevant native wallet sheet (Apple Pay on iOS, Google Pay on Android) in order to confirm a Stripe [SetupIntent](https://stripe.com/docs/api/setup_intents).
@@ -1,4 +1,4 @@
1
- import type { PaymentMethod, PaymentIntent, ApplePay, PaymentSheet, CreatePaymentMethodResult, RetrievePaymentIntentResult, RetrieveSetupIntentResult, ConfirmPaymentResult, HandleNextActionResult, ConfirmSetupIntentResult, CreateTokenForCVCUpdateResult, ApplePayResult, ApplePayError, StripeError, InitPaymentSheetResult, PresentPaymentSheetResult, ConfirmPaymentSheetPaymentResult, SetupIntent, CreateTokenResult, PayWithGooglePayResult, GooglePayInitResult, GooglePay, CreateGooglePayPaymentMethodResult, OpenApplePaySetupResult, Token, VerifyMicrodepositsParams, VerifyMicrodepositsForPaymentResult, VerifyMicrodepositsForSetupResult, CollectBankAccountForSetupResult, CollectBankAccountForPaymentResult, CanAddCardToWalletParams, CanAddCardToWalletResult, FinancialConnections, PlatformPay, PlatformPayError } from '../types';
1
+ import type { PaymentMethod, PaymentIntent, PaymentSheet, CreatePaymentMethodResult, RetrievePaymentIntentResult, RetrieveSetupIntentResult, ConfirmPaymentResult, HandleNextActionResult, ConfirmSetupIntentResult, CreateTokenForCVCUpdateResult, StripeError, InitPaymentSheetResult, PresentPaymentSheetResult, ConfirmPaymentSheetPaymentResult, SetupIntent, CreateTokenResult, Token, VerifyMicrodepositsParams, VerifyMicrodepositsForPaymentResult, VerifyMicrodepositsForSetupResult, CollectBankAccountForSetupResult, CollectBankAccountForPaymentResult, CanAddCardToWalletParams, CanAddCardToWalletResult, FinancialConnections, PlatformPay, PlatformPayError } from '../types';
2
2
  /**
3
3
  * useStripe hook
4
4
  */
@@ -8,29 +8,13 @@ export declare function useStripe(): {
8
8
  confirmPayment: (paymentIntentClientSecret: string, data?: PaymentIntent.ConfirmParams | undefined, options?: PaymentIntent.ConfirmOptions) => Promise<ConfirmPaymentResult>;
9
9
  createPaymentMethod: (data: PaymentMethod.CreateParams, options?: PaymentMethod.CreateOptions) => Promise<CreatePaymentMethodResult>;
10
10
  handleNextAction: (paymentIntentClientSecret: string, returnURL?: string | undefined) => Promise<HandleNextActionResult>;
11
- isApplePaySupported: boolean | null;
12
- presentApplePay: (params: ApplePay.PresentParams) => Promise<ApplePayResult>;
13
- confirmApplePayPayment: (clientSecret: string) => Promise<{
14
- error?: StripeError<ApplePayError>;
15
- }>;
16
11
  confirmSetupIntent: (paymentIntentClientSecret: string, data: SetupIntent.ConfirmParams, options?: SetupIntent.ConfirmOptions) => Promise<ConfirmSetupIntentResult>;
17
12
  createTokenForCVCUpdate: (cvc: string) => Promise<CreateTokenForCVCUpdateResult>;
18
- updateApplePaySummaryItems: (summaryItems: ApplePay.CartSummaryItem[], errorAddressFields?: Array<{
19
- field: ApplePay.AddressFields;
20
- message?: string;
21
- }>) => Promise<{
22
- error?: StripeError<ApplePayError>;
23
- }>;
24
13
  handleURLCallback: (url: string) => Promise<boolean>;
25
14
  confirmPaymentSheetPayment: () => Promise<ConfirmPaymentSheetPaymentResult>;
26
15
  presentPaymentSheet: (options?: PaymentSheet.PresentOptions | undefined) => Promise<PresentPaymentSheetResult>;
27
16
  initPaymentSheet: (params: PaymentSheet.SetupParams) => Promise<InitPaymentSheetResult>;
28
17
  createToken: (params: Token.CreateParams) => Promise<CreateTokenResult>;
29
- isGooglePaySupported: (params?: GooglePay.IsSupportedParams | undefined) => Promise<boolean>;
30
- initGooglePay: (params: GooglePay.InitParams) => Promise<GooglePayInitResult>;
31
- presentGooglePay: (params: GooglePay.PresentParams) => Promise<PayWithGooglePayResult>;
32
- createGooglePayPaymentMethod: (params: GooglePay.CreatePaymentMethodParams) => Promise<CreateGooglePayPaymentMethodResult>;
33
- openApplePaySetup: () => Promise<OpenApplePaySetupResult>;
34
18
  collectBankAccountForPayment: (clientSecret: string, params: PaymentMethod.CollectBankAccountParams) => Promise<CollectBankAccountForPaymentResult>;
35
19
  collectBankAccountForSetup: (clientSecret: string, params: PaymentMethod.CollectBankAccountParams) => Promise<CollectBankAccountForSetupResult>;
36
20
  verifyMicrodepositsForPayment: (clientSecret: string, params: VerifyMicrodepositsParams) => Promise<VerifyMicrodepositsForPaymentResult>;
@@ -45,7 +29,7 @@ export declare function useStripe(): {
45
29
  */
46
30
  resetPaymentSheetCustomer: () => Promise<null>;
47
31
  isPlatformPaySupported: (params?: {
48
- googlePay?: GooglePay.IsSupportedParams | undefined;
32
+ googlePay?: PlatformPay.IsGooglePaySupportedParams | undefined;
49
33
  } | undefined) => Promise<boolean>;
50
34
  confirmPlatformPaySetupIntent: (clientSecret: string, params: PlatformPay.ConfirmParams) => Promise<PlatformPay.ConfirmSetupIntentResult>;
51
35
  confirmPlatformPayPayment: (clientSecret: string, params: PlatformPay.ConfirmParams) => Promise<PlatformPay.ConfirmPaymentResult>;
@@ -2,10 +2,7 @@ export { useConfirmPayment } from './hooks/useConfirmPayment';
2
2
  export { useConfirmSetupIntent } from './hooks/useConfirmSetupIntent';
3
3
  export { useStripe } from './hooks/useStripe';
4
4
  export { usePlatformPay } from './hooks/usePlatformPay';
5
- export { useApplePay } from './hooks/useApplePay';
6
- export type { Props as UseApplePayProps } from './hooks/useApplePay';
7
5
  export { usePaymentSheet } from './hooks/usePaymentSheet';
8
- export { useGooglePay } from './hooks/useGooglePay';
9
6
  export { useFinancialConnectionsSheet } from './hooks/useFinancialConnectionsSheet';
10
7
  export { initStripe, StripeProvider } from './components/StripeProvider';
11
8
  export type { Props as StripeProviderProps } from './components/StripeProvider';
@@ -13,14 +10,10 @@ export { CardField } from './components/CardField';
13
10
  export type { Props as CardFieldProps } from './components/CardField';
14
11
  export { CardForm } from './components/CardForm';
15
12
  export type { Props as CardFormProps } from './components/CardForm';
16
- export { ApplePayButton } from './components/ApplePayButton';
17
- export type { Props as ApplePayButtonProps } from './components/ApplePayButton';
18
13
  export { AuBECSDebitForm } from './components/AuBECSDebitForm';
19
14
  export type { Props as AuBECSDebitFormProps } from './components/AuBECSDebitForm';
20
15
  export { StripeContainer } from './components/StripeContainer';
21
16
  export type { Props as StripeContainerProps } from './components/StripeContainer';
22
- export { GooglePayButton } from './components/GooglePayButton';
23
- export type { Props as GooglePayButtonProps } from './components/GooglePayButton';
24
17
  export { AddToWalletButton } from './components/AddToWalletButton';
25
18
  export type { Props as AddToWalletButtonProps } from './components/AddToWalletButton';
26
19
  export { AddressSheet } from './components/AddressSheet';
@@ -1,45 +1,3 @@
1
- export declare type ContactFieldsType = 'emailAddress' | 'name' | 'phoneNumber' | 'phoneticName' | 'postalAddress';
2
- export declare type AddressFields = 'street' | 'city' | 'subAdministrativeArea' | 'state' | 'postalCode' | 'country' | 'countryCode' | 'subLocality';
3
- export interface ShippingMethod {
4
- /** A short, localized description. */
5
- label: string;
6
- /** The cost associated with this shipping option. */
7
- amount: string;
8
- /** When creating items for estimates or charges whose final value is not yet known, set this to true. */
9
- isPending?: boolean;
10
- /** A unique identifier for the shipping method. */
11
- identifier: string;
12
- /** A user-readable description of the shipping method. For example “Ships in 24 hours.” Don't repeat the content of the 'label' property. */
13
- detail?: string;
14
- /** The unix timestamp of the start date of the expected range of delivery or shipping dates for a package, or the time range when an item is available for pickup. Measured in seconds. */
15
- startDate?: number;
16
- /** The unix timestamp of the end date of the expected range of delivery or shipping dates for a package, or the time range when an item is available for pickup. Measured in seconds. */
17
- endDate?: number;
18
- }
19
- interface PostalAddress {
20
- city?: string;
21
- country?: string;
22
- postalCode?: string;
23
- state?: string;
24
- street?: string;
25
- isoCountryCode?: string;
26
- subAdministrativeArea?: string;
27
- subLocality?: string;
28
- }
29
- interface ContactName {
30
- familyName?: string;
31
- namePrefix?: string;
32
- nameSuffix?: string;
33
- givenName?: string;
34
- middleName?: string;
35
- nickname?: string;
36
- }
37
- export interface ShippingContact {
38
- emailAddress?: string;
39
- name: ContactName;
40
- phoneNumber?: string;
41
- postalAddress: PostalAddress;
42
- }
43
1
  export declare type CartSummaryItem = DeferredCartSummaryItem | ImmediateCartSummaryItem | RecurringCartSummaryItem;
44
2
  export declare type CartSummaryItemType = 'Deferred' | 'Immediate' | 'Recurring';
45
3
  /** Use this type for a payment that occurs in the future, such as a pre-order. Only available on iOS 15 and up, otherwise falls back to ImmediateCartSummaryItem. */
@@ -72,13 +30,3 @@ export declare type RecurringCartSummaryItem = {
72
30
  label: string;
73
31
  amount: string;
74
32
  };
75
- export interface PresentParams {
76
- cartItems: CartSummaryItem[];
77
- country: string;
78
- currency: string;
79
- requiredShippingAddressFields?: ContactFieldsType[];
80
- requiredBillingContactFields?: ContactFieldsType[];
81
- shippingMethods?: ShippingMethod[];
82
- jcbEnabled?: boolean;
83
- }
84
- export {};
@@ -20,12 +20,13 @@ export interface Result {
20
20
  /** @deprecated Use paymentMethod.id instead. */
21
21
  paymentMethodId: string;
22
22
  paymentMethod: PaymentMethodResult | null;
23
- captureMethod: 'Automatic' | 'Manual';
24
- confirmationMethod: 'Automatic' | 'Manual';
23
+ captureMethod: CaptureMethod;
24
+ confirmationMethod: CaptureMethod;
25
25
  lastPaymentError: LastPaymentError | null;
26
26
  shipping: ShippingDetails | null;
27
27
  nextAction: NextAction | null;
28
28
  }
29
+ export declare type CaptureMethod = 'Automatic' | 'Manual';
29
30
  export declare type ConfirmParams = CardParams | IdealParams | OxxoParams | P24Params | AlipayParams | GiropayParams | SepaParams | EpsParams | AuBecsDebitParams | SofortParams | GrabPayParams | FPXParams | AfterpayClearpayParams | KlarnaParams | BancontactParams | USBankAccountParams | PayPalParams | AffirmParams | CashAppParams;
30
31
  export declare type ConfirmOptions = PaymentMethod.ConfirmOptions;
31
32
  export declare type LastPaymentError = StripeError<string> & {
@@ -1,7 +1,10 @@
1
1
  import type { BillingDetails, AddressDetails } from './Common';
2
2
  import type { CartSummaryItem } from './ApplePay';
3
3
  import type { ButtonType, RecurringPaymentRequest, AutomaticReloadPaymentRequest, MultiMerchantRequest } from './PlatformPay';
4
- export declare type SetupParams = ClientSecretParams & {
4
+ import type { FutureUsage } from './PaymentIntent';
5
+ import type { Result } from './PaymentMethod';
6
+ import type { StripeError } from './Errors';
7
+ export declare type SetupParams = IntentParams & {
5
8
  /** Your customer-facing business name. On Android, this is required and cannot be an empty string. */
6
9
  merchantDisplayName: string;
7
10
  /** The identifier of the Stripe Customer object. See https://stripe.com/docs/api/customers/object#customer_object-id */
@@ -42,12 +45,18 @@ export declare type SetupParams = ClientSecretParams & {
42
45
  /** The label to use for the primary button. If not set, Payment Sheet will display suitable default labels for payment and setup intents. */
43
46
  primaryButtonLabel?: string;
44
47
  };
45
- export declare type ClientSecretParams = {
48
+ export declare type IntentParams = {
46
49
  paymentIntentClientSecret: string;
47
50
  setupIntentClientSecret?: undefined;
51
+ intentConfiguration?: never;
48
52
  } | {
49
53
  setupIntentClientSecret: string;
50
54
  paymentIntentClientSecret?: undefined;
55
+ intentConfiguration?: never;
56
+ } | {
57
+ setupIntentClientSecret?: never;
58
+ paymentIntentClientSecret?: never;
59
+ intentConfiguration: IntentConfiguration;
51
60
  };
52
61
  export declare type ApplePayParams = {
53
62
  /** The two-letter ISO 3166 code of the country of your business, e.g. "US" */
@@ -264,4 +273,41 @@ export declare enum AddressCollectionMode {
264
273
  /** Collect the full billing address, regardless of the Payment Method's requirements. */
265
274
  FULL = "full"
266
275
  }
276
+ export declare type IntentCreationError = StripeError<'Failed'>;
277
+ export declare type IntentCreationCallbackParams = {
278
+ clientSecret: string;
279
+ error?: never;
280
+ } | {
281
+ clientSecret?: never;
282
+ error: IntentCreationError;
283
+ };
284
+ export declare type IntentConfiguration = {
285
+ confirmHandler: (paymentMethod: Result, shouldSavePaymentMethod: boolean, intentCreationCallback: (result: IntentCreationCallbackParams) => void) => void;
286
+ mode: Mode;
287
+ paymentMethodTypes?: Array<string>;
288
+ };
289
+ export declare type Mode = PaymentMode | SetupMode;
290
+ /**
291
+ * Controls when the funds will be captured. Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method
292
+ */
293
+ export declare enum CaptureMethod {
294
+ /** (Default) Stripe automatically captures funds when the customer authorizes the payment. */
295
+ Automatic = "Automatic",
296
+ /** Place a hold on the funds when the customer authorizes the payment, but don’t capture the funds until later. (Not all payment methods support this.) */
297
+ Manual = "Manual",
298
+ /** Asynchronously capture funds when the customer authorizes the payment.
299
+ - Note: Recommended over `CaptureMethod.Automatic` due to improved latency, but may require additional integration changes.
300
+ - Seealso: https://stripe.com/docs/payments/payment-intents/asynchronous-capture-automatic-async */
301
+ AutomaticAsync = "AutomaticAsync"
302
+ }
303
+ export declare type PaymentMode = {
304
+ amount: number;
305
+ currencyCode: string;
306
+ setupFutureUsage?: FutureUsage;
307
+ captureMethod?: CaptureMethod;
308
+ };
309
+ export declare type SetupMode = {
310
+ currencyCode?: string;
311
+ setupFutureUsage: FutureUsage;
312
+ };
267
313
  export {};
@@ -3,8 +3,6 @@ import type { Result as PaymentMethod } from './PaymentMethod';
3
3
  import type { Result as PaymentIntent } from './PaymentIntent';
4
4
  import type { Result as SetupIntent } from './SetupIntent';
5
5
  import type { StripeError, PlatformPayError } from './Errors';
6
- import type { ShippingContact as ApplePayShippingContact } from './ApplePay';
7
- import type { IsSupportedParams } from './GooglePay';
8
6
  export declare type ApplePaySheetError = {
9
7
  errorType: ApplePaySheetErrorType.InvalidShippingAddress;
10
8
  field: InvalidShippingField;
@@ -45,7 +43,7 @@ export declare type ApplePayBaseParams = {
45
43
  additionalEnabledNetworks?: Array<string>;
46
44
  /** The list of items that describe a purchase. For example: total, tax, discount, and grand total. */
47
45
  cartItems: Array<CartSummaryItem>;
48
- /** The list of fields that you need for a shipping contact in order to process the transaction. If provided, you must implement the PlatformPayButton component's `onShippingContactSelected` callback and call `updatePlatformPaySheet` from there.*/
46
+ /** The list of fields that you need for a shipping contact in order to process the transaction. If you include ContactField.PostalAddress in this array, you must implement the PlatformPayButton component's `onShippingContactSelected` callback and call `updatePlatformPaySheet` from there.*/
49
47
  requiredShippingAddressFields?: Array<ContactField>;
50
48
  /** The list of fields that you need for a billing contact in order to process the transaction. */
51
49
  requiredBillingContactFields?: Array<ContactField>;
@@ -319,10 +317,41 @@ export declare type ShippingMethod = {
319
317
  /** The unix timestamp of the end date of the expected range of delivery or shipping dates for a package, or the time range when an item is available for pickup. Measured in seconds. */
320
318
  endDate?: number;
321
319
  };
320
+ interface PostalAddress {
321
+ city?: string;
322
+ country?: string;
323
+ postalCode?: string;
324
+ state?: string;
325
+ street?: string;
326
+ isoCountryCode?: string;
327
+ subAdministrativeArea?: string;
328
+ subLocality?: string;
329
+ }
330
+ interface ContactName {
331
+ familyName?: string;
332
+ namePrefix?: string;
333
+ nameSuffix?: string;
334
+ givenName?: string;
335
+ middleName?: string;
336
+ nickname?: string;
337
+ }
322
338
  /** iOS only. */
323
- export declare type ShippingContact = ApplePayShippingContact;
339
+ export interface ShippingContact {
340
+ emailAddress?: string;
341
+ name: ContactName;
342
+ phoneNumber?: string;
343
+ postalAddress: PostalAddress;
344
+ }
324
345
  /** Android only. */
325
- export declare type IsGooglePaySupportedParams = IsSupportedParams;
346
+ export declare type IsGooglePaySupportedParams = {
347
+ /** Set to true to run in a test environment with relaxed application / merchant requirements. This environment is suggested for early development and for easily testing SDK. Defaults to false. */
348
+ testEnv?: boolean;
349
+ /**
350
+ * If `true`, Google Pay is considered ready if the customer's Google Pay wallet
351
+ * has an existing payment method. Defaults to false.
352
+ */
353
+ existingPaymentMethodRequired?: boolean;
354
+ };
326
355
  export declare type PaymentMethodResult = {
327
356
  paymentMethod: PaymentMethod;
328
357
  error?: undefined;
@@ -351,3 +380,4 @@ export declare type ConfirmSetupIntentResult = {
351
380
  setupIntent?: undefined;
352
381
  error: StripeError<PlatformPayError>;
353
382
  };
383
+ export {};
@@ -60,6 +60,7 @@ export interface NativeProps {
60
60
  }>): void;
61
61
  cardStyle?: Styles;
62
62
  placeholders?: Placeholders;
63
+ disabled?: boolean;
63
64
  }
64
65
  export interface Methods {
65
66
  focus(): void;
@@ -56,6 +56,7 @@ export interface NativeProps {
56
56
  focusedField: FieldName | null;
57
57
  }>): void;
58
58
  onFormComplete(event: NativeSyntheticEvent<Details>): void;
59
+ disabled?: boolean;
59
60
  }
60
61
  export interface Methods {
61
62
  focus(): void;
@@ -2,5 +2,4 @@ import type { StyleProp, ViewStyle } from 'react-native';
2
2
  export interface NativeProps {
3
3
  style?: StyleProp<ViewStyle>;
4
4
  type?: number;
5
- buttonType?: string;
6
5
  }
@@ -5,16 +5,13 @@ import * as PaymentMethod from './PaymentMethod';
5
5
  import * as PaymentSheet from './PaymentSheet';
6
6
  import * as SetupIntent from './SetupIntent';
7
7
  import * as ThreeDSecure from './ThreeDSecure';
8
- import * as GooglePay from './GooglePay';
9
- import * as ApplePayButtonComponent from './components/ApplePayButtonComponent';
10
- import * as GooglePayButtonComponent from './components/GooglePayButtonComponent';
11
8
  import * as AuBECSDebitFormComponent from './components/AuBECSDebitFormComponent';
12
9
  import * as CardFieldInput from './components/CardFieldInput';
13
10
  import * as CardFormView from './components/CardFormView';
14
11
  import * as Token from './Token';
15
12
  import * as FinancialConnections from './FinancialConnections';
16
13
  import * as PlatformPay from './PlatformPay';
17
- export { ApplePay, PaymentIntent, PaymentMethod, PaymentSheet, SetupIntent, ThreeDSecure, GooglePay, ApplePayButtonComponent, GooglePayButtonComponent, AuBECSDebitFormComponent, CardFieldInput, CardFormView, Token, FinancialConnections, PlatformPay, };
14
+ export { ApplePay, PaymentIntent, PaymentMethod, PaymentSheet, SetupIntent, ThreeDSecure, AuBECSDebitFormComponent, CardFieldInput, CardFormView, Token, FinancialConnections, PlatformPay, };
18
15
  export * from './PushProvisioning';
19
16
  export * from './Errors';
20
17
  export type { Address, BillingDetails, AddressDetails } from './Common';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-react-native",
3
- "version": "0.27.2",
3
+ "version": "0.29.0",
4
4
  "author": "Stripe",
5
5
  "description": "Stripe SDK for React Native",
6
6
  "main": "lib/commonjs/index",
@@ -2,7 +2,6 @@ import { NativeModules } from 'react-native';
2
2
  import type {
3
3
  PaymentMethod,
4
4
  PaymentIntent,
5
- ApplePay,
6
5
  PlatformPay,
7
6
  PaymentSheet,
8
7
  SetupIntent,
@@ -17,12 +16,7 @@ import type {
17
16
  InitPaymentSheetResult,
18
17
  PresentPaymentSheetResult,
19
18
  ConfirmPaymentSheetPaymentResult,
20
- ApplePayResult,
21
19
  CreateTokenResult,
22
- GooglePayInitResult,
23
- PayWithGooglePayResult,
24
- CreateGooglePayPaymentMethodResult,
25
- GooglePay,
26
20
  OpenApplePaySetupResult,
27
21
  Token,
28
22
  VerifyMicrodepositsParams,
@@ -47,16 +41,6 @@ type NativeStripeSdkType = {
47
41
  params?: PaymentIntent.ConfirmParams,
48
42
  options?: PaymentIntent.ConfirmOptions
49
43
  ): Promise<ConfirmPaymentResult>;
50
- isApplePaySupported(): Promise<boolean>;
51
- presentApplePay(params: ApplePay.PresentParams): Promise<ApplePayResult>;
52
- confirmApplePayPayment(clientSecret: string): Promise<void>;
53
- updateApplePaySummaryItems(
54
- summaryItems: ApplePay.CartSummaryItem[],
55
- errorAddressFields: Array<{
56
- field: ApplePay.AddressFields;
57
- message?: string;
58
- }>
59
- ): Promise<void>;
60
44
  confirmSetupIntent(
61
45
  paymentIntentClientSecret: string,
62
46
  params: SetupIntent.ConfirmParams,
@@ -69,10 +53,9 @@ type NativeStripeSdkType = {
69
53
  initPaymentSheet(
70
54
  params: PaymentSheet.SetupParams
71
55
  ): Promise<InitPaymentSheetResult>;
72
- initPaymentSheetWithOrderTracking(
73
- params: PaymentSheet.SetupParams,
74
- callback?: () => void
75
- ): Promise<InitPaymentSheetResult>;
56
+ intentCreationCallback(
57
+ result: PaymentSheet.IntentCreationCallbackParams
58
+ ): void;
76
59
  presentPaymentSheet(
77
60
  options: PaymentSheet.PresentOptions
78
61
  ): Promise<PresentPaymentSheetResult>;
@@ -80,14 +63,6 @@ type NativeStripeSdkType = {
80
63
  createTokenForCVCUpdate(cvc: string): Promise<CreateTokenForCVCUpdateResult>;
81
64
  handleURLCallback(url: string): Promise<boolean>;
82
65
  createToken(params: Token.CreateParams): Promise<CreateTokenResult>;
83
- isGooglePaySupported(params: GooglePay.IsSupportedParams): Promise<boolean>;
84
- initGooglePay(params: GooglePay.InitParams): Promise<GooglePayInitResult>;
85
- presentGooglePay(
86
- params: GooglePay.PresentParams
87
- ): Promise<PayWithGooglePayResult>;
88
- createGooglePayPaymentMethod(
89
- params: GooglePay.CreatePaymentMethodParams
90
- ): Promise<CreateGooglePayPaymentMethodResult>;
91
66
  openApplePaySetup(): Promise<OpenApplePaySetupResult>;
92
67
  verifyMicrodeposits(
93
68
  isPaymentIntent: boolean,
@@ -114,7 +89,7 @@ type NativeStripeSdkType = {
114
89
  ): Promise<FinancialConnections.SessionResult>;
115
90
  resetPaymentSheetCustomer(): Promise<null>;
116
91
  isPlatformPaySupported(params: {
117
- googlePay?: GooglePay.IsSupportedParams;
92
+ googlePay?: PlatformPay.IsGooglePaySupportedParams;
118
93
  }): Promise<boolean>;
119
94
  createPlatformPayPaymentMethod(
120
95
  params: PlatformPay.PaymentMethodParams,
@@ -122,8 +97,8 @@ type NativeStripeSdkType = {
122
97
  ): Promise<PlatformPay.PaymentMethodResult | PlatformPay.TokenResult>;
123
98
  dismissPlatformPay(): Promise<boolean>;
124
99
  updatePlatformPaySheet(
125
- summaryItems: Array<ApplePay.CartSummaryItem>,
126
- shippingMethods: Array<ApplePay.ShippingMethod>,
100
+ summaryItems: Array<PlatformPay.CartSummaryItem>,
101
+ shippingMethods: Array<PlatformPay.ShippingMethod>,
127
102
  errors: Array<PlatformPay.ApplePaySheetError>
128
103
  ): Promise<void>;
129
104
  confirmPlatformPay(
@@ -1,5 +1,5 @@
1
1
  import { requireNativeComponent } from 'react-native';
2
- import type { ApplePayButtonComponent } from '../types';
2
+ import type * as ApplePayButtonComponent from '../types/components/ApplePayButtonComponent';
3
3
  const ApplePayButtonNative =
4
4
  requireNativeComponent<ApplePayButtonComponent.NativeProps>('ApplePayButton');
5
5
  export default ApplePayButtonNative;
@@ -34,6 +34,8 @@ export interface Props extends AccessibilityProps {
34
34
  postalCodeEnabled?: boolean;
35
35
  /** Controls the postal code entry shown (if the postalCodeEnabled prop is set to true). Defaults to the device's default locale. */
36
36
  countryCode?: string;
37
+ /** Applies a disabled state such that user input is not accepted. Defaults to false. */
38
+ disabled?: boolean;
37
39
  cardStyle?: CardFieldInput.Styles;
38
40
  placeholders?: CardFieldInput.Placeholders;
39
41
  autofocus?: boolean;
@@ -32,10 +32,10 @@ export interface Props extends AccessibilityProps {
32
32
  style?: StyleProp<ViewStyle>;
33
33
  autofocus?: boolean;
34
34
  testID?: string;
35
-
35
+ /** Applies a disabled state such that user input is not accepted. Defaults to false. */
36
+ disabled?: boolean;
36
37
  /** All styles except backgroundColor, cursorColor, borderColor, and borderRadius are Android only */
37
38
  cardStyle?: CardFormView.Styles;
38
- // isUserInteractionEnabled?: boolean;
39
39
 
40
40
  // TODO: will make it public when iOS SDK allows for this
41
41
  // postalCodeEnabled?: boolean;
@@ -78,7 +78,6 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
78
78
  {
79
79
  onFormComplete,
80
80
  cardStyle,
81
- // isUserInteractionEnabled = true,
82
81
  // postalCodeEnabled = true,
83
82
  // onFocus,
84
83
  // onBlur,
@@ -181,7 +180,6 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
181
180
  // disabledBackgroundColor: cardStyle?.disabledBackgroundColor,
182
181
  // type: cardStyle?.type,
183
182
  }}
184
- // isUserInteractionEnabledValue={isUserInteractionEnabled}
185
183
  placeholders={{
186
184
  number: placeholders?.number,
187
185
  expiration: placeholders?.expiration,
@@ -1,5 +1,5 @@
1
1
  import { requireNativeComponent } from 'react-native';
2
- import type { GooglePayButtonComponent } from '../types';
2
+ import type * as GooglePayButtonComponent from '../types/components/GooglePayButtonComponent';
3
3
  const GooglePayButtonNative =
4
4
  requireNativeComponent<GooglePayButtonComponent.NativeProps>(
5
5
  'GooglePayButton'
@@ -42,7 +42,8 @@ export interface Props extends AccessibilityProps {
42
42
  shippingMethod: ShippingMethod;
43
43
  }) => void;
44
44
  /**
45
- * This callback is triggered whenever the user selects a shipping contact in the Apple Pay sheet.
45
+ * This callback is triggered whenever the user selects a shipping contact in the Apple Pay sheet IF
46
+ * ContactField.PostalAddress was included in the requiredShippingAddressFields array.
46
47
  * It receives one parameter: an `event` object with a `shippingContact` field. You MUST
47
48
  * update the Apple Pay sheet in your callback using the updatePlatformPaySheet function, otherwise the
48
49
  * Apple Pay sheet will hang and the payment flow will automatically cancel.