@stripe/stripe-react-native 0.41.0 → 0.43.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.
- package/.husky/pre-commit +0 -3
- package/CHANGELOG.md +27 -0
- package/README.md +3 -0
- package/android/.gradle/8.11.1/checksums/checksums.lock +0 -0
- package/android/.gradle/8.11.1/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.11.1/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.11.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.11.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.11.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.11.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +7 -1
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/gradle.properties +4 -1
- package/android/gradlew +249 -0
- package/android/gradlew.bat +92 -0
- package/android/spotless.gradle +19 -0
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +30 -34
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormViewManager.kt +20 -10
- package/android/src/main/java/com/reactnativestripesdk/CardChangedEvent.kt +12 -13
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +242 -105
- package/android/src/main/java/com/reactnativestripesdk/CardFieldViewManager.kt +58 -20
- package/android/src/main/java/com/reactnativestripesdk/CardFocusEvent.kt +8 -11
- package/android/src/main/java/com/reactnativestripesdk/CardFormCompleteEvent.kt +10 -12
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +135 -87
- package/android/src/main/java/com/reactnativestripesdk/CardFormViewManager.kt +57 -22
- package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +53 -23
- package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +125 -83
- package/android/src/main/java/com/reactnativestripesdk/FormCompleteEvent.kt +9 -11
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt +16 -9
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +36 -28
- package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherFragment.kt +67 -43
- package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherFragment.kt +21 -16
- package/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt +101 -56
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +244 -166
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +183 -123
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +181 -57
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +402 -258
- package/android/src/main/java/com/reactnativestripesdk/StripeContainerManager.kt +11 -4
- package/android/src/main/java/com/reactnativestripesdk/StripeContainerView.kt +5 -1
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +654 -299
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +12 -14
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherFragment.kt +42 -37
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetEvent.kt +12 -11
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +29 -29
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +50 -18
- package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetFragment.kt +227 -147
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerAdapter.kt +15 -18
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +33 -15
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +63 -37
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletCompleteEvent.kt +9 -13
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/EphemeralKeyProvider.kt +15 -17
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxy.kt +76 -60
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +71 -47
- package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +117 -51
- package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +4 -3
- package/android/src/main/java/com/reactnativestripesdk/utils/KeepJsAwakeTask.kt +39 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +337 -250
- package/android/src/main/java/com/reactnativestripesdk/utils/PostalCodeUtilities.kt +2 -11
- package/ios/CustomerSheet/CustomerSheetUtils.swift +3 -1
- package/ios/FinancialConnections.swift +18 -2
- package/ios/Mappers.swift +23 -0
- package/ios/PaymentMethodFactory.swift +31 -29
- package/ios/StripeSdk+CustomerSheet.swift +2 -1
- package/ios/StripeSdk+PaymentSheet.swift +42 -0
- package/ios/StripeSdk.m +2 -0
- package/ios/StripeSdk.swift +116 -24
- package/lib/commonjs/NativeStripeSdk.js +1 -1
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/components/AddToWalletButton.js +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/components/AddressSheet.js +1 -1
- package/lib/commonjs/components/AddressSheet.js.map +1 -1
- package/lib/commonjs/components/ApplePayButtonNative.js +1 -1
- package/lib/commonjs/components/ApplePayButtonNative.js.map +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/components/CardField.js +1 -1
- package/lib/commonjs/components/CardField.js.map +1 -1
- package/lib/commonjs/components/CardForm.js +1 -1
- package/lib/commonjs/components/CardForm.js.map +1 -1
- package/lib/commonjs/components/CustomerSheet.js +1 -1
- package/lib/commonjs/components/CustomerSheet.js.map +1 -1
- package/lib/commonjs/components/GooglePayButtonNative.js +1 -1
- package/lib/commonjs/components/GooglePayButtonNative.js.map +1 -1
- package/lib/commonjs/components/PlatformPayButton.js +1 -1
- package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
- package/lib/commonjs/components/StripeContainer.js +1 -1
- package/lib/commonjs/components/StripeContainer.js.map +1 -1
- package/lib/commonjs/components/StripeProvider.js +1 -1
- package/lib/commonjs/components/StripeProvider.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/helpers.js +1 -1
- package/lib/commonjs/helpers.js.map +1 -1
- package/lib/commonjs/hooks/useConfirmPayment.js.map +1 -1
- package/lib/commonjs/hooks/useConfirmSetupIntent.js.map +1 -1
- package/lib/commonjs/hooks/useFinancialConnectionsSheet.js +1 -1
- package/lib/commonjs/hooks/useFinancialConnectionsSheet.js.map +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js.map +1 -1
- package/lib/commonjs/hooks/usePlatformPay.js.map +1 -1
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/plugin/withStripe.js +1 -1
- package/lib/commonjs/plugin/withStripe.js.map +1 -1
- package/lib/commonjs/types/ApplePay.js.map +1 -1
- package/lib/commonjs/types/Common.js +1 -1
- package/lib/commonjs/types/Common.js.map +1 -1
- package/lib/commonjs/types/CustomerSheet.js.map +1 -1
- package/lib/commonjs/types/Errors.js +1 -1
- package/lib/commonjs/types/Errors.js.map +1 -1
- package/lib/commonjs/types/FinancialConnections.js +1 -1
- package/lib/commonjs/types/FinancialConnections.js.map +1 -1
- package/lib/commonjs/types/NextAction.js.map +1 -1
- package/lib/commonjs/types/PaymentIntent.js +1 -1
- package/lib/commonjs/types/PaymentIntent.js.map +1 -1
- package/lib/commonjs/types/PaymentMethod.js.map +1 -1
- package/lib/commonjs/types/PaymentSheet.js +1 -1
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/PlatformPay.js +1 -1
- package/lib/commonjs/types/PlatformPay.js.map +1 -1
- package/lib/commonjs/types/PushProvisioning.js +1 -1
- package/lib/commonjs/types/PushProvisioning.js.map +1 -1
- package/lib/commonjs/types/SetupIntent.js +1 -1
- package/lib/commonjs/types/SetupIntent.js.map +1 -1
- package/lib/commonjs/types/ThreeDSecure.js +1 -1
- package/lib/commonjs/types/ThreeDSecure.js.map +1 -1
- package/lib/commonjs/types/Token.js.map +1 -1
- package/lib/commonjs/types/components/ApplePayButtonComponent.js.map +1 -1
- package/lib/commonjs/types/components/AuBECSDebitFormComponent.js.map +1 -1
- package/lib/commonjs/types/components/CardFieldInput.js +1 -1
- package/lib/commonjs/types/components/CardFieldInput.js.map +1 -1
- package/lib/commonjs/types/components/CardFormView.js.map +1 -1
- package/lib/commonjs/types/components/GooglePayButtonComponent.js.map +1 -1
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/NativeStripeSdk.js +1 -1
- package/lib/module/NativeStripeSdk.js.map +1 -1
- package/lib/module/components/AddToWalletButton.js +1 -1
- package/lib/module/components/AddToWalletButton.js.map +1 -1
- package/lib/module/components/AddressSheet.js +1 -1
- package/lib/module/components/AddressSheet.js.map +1 -1
- package/lib/module/components/ApplePayButtonNative.js +1 -1
- package/lib/module/components/ApplePayButtonNative.js.map +1 -1
- package/lib/module/components/AuBECSDebitForm.js +1 -1
- package/lib/module/components/AuBECSDebitForm.js.map +1 -1
- package/lib/module/components/CardField.js +1 -1
- package/lib/module/components/CardField.js.map +1 -1
- package/lib/module/components/CardForm.js +1 -1
- package/lib/module/components/CardForm.js.map +1 -1
- package/lib/module/components/CustomerSheet.js +1 -1
- package/lib/module/components/CustomerSheet.js.map +1 -1
- package/lib/module/components/GooglePayButtonNative.js +1 -1
- package/lib/module/components/GooglePayButtonNative.js.map +1 -1
- package/lib/module/components/PlatformPayButton.js +1 -1
- package/lib/module/components/PlatformPayButton.js.map +1 -1
- package/lib/module/components/StripeContainer.js +1 -1
- package/lib/module/components/StripeContainer.js.map +1 -1
- package/lib/module/components/StripeProvider.js +1 -1
- package/lib/module/components/StripeProvider.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/helpers.js +1 -1
- package/lib/module/helpers.js.map +1 -1
- package/lib/module/hooks/useConfirmPayment.js.map +1 -1
- package/lib/module/hooks/useConfirmSetupIntent.js.map +1 -1
- package/lib/module/hooks/useFinancialConnectionsSheet.js +1 -1
- package/lib/module/hooks/useFinancialConnectionsSheet.js.map +1 -1
- package/lib/module/hooks/usePaymentSheet.js.map +1 -1
- package/lib/module/hooks/usePlatformPay.js.map +1 -1
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/plugin/withStripe.js +1 -1
- package/lib/module/plugin/withStripe.js.map +1 -1
- package/lib/module/types/ApplePay.js.map +1 -1
- package/lib/module/types/Common.js +1 -1
- package/lib/module/types/Common.js.map +1 -1
- package/lib/module/types/CustomerSheet.js.map +1 -1
- package/lib/module/types/Errors.js +1 -1
- package/lib/module/types/Errors.js.map +1 -1
- package/lib/module/types/FinancialConnections.js +1 -1
- package/lib/module/types/FinancialConnections.js.map +1 -1
- package/lib/module/types/NextAction.js.map +1 -1
- package/lib/module/types/PaymentIntent.js +1 -1
- package/lib/module/types/PaymentIntent.js.map +1 -1
- package/lib/module/types/PaymentMethod.js.map +1 -1
- package/lib/module/types/PaymentSheet.js +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/module/types/PlatformPay.js +1 -1
- package/lib/module/types/PlatformPay.js.map +1 -1
- package/lib/module/types/PushProvisioning.js +1 -1
- package/lib/module/types/PushProvisioning.js.map +1 -1
- package/lib/module/types/SetupIntent.js +1 -1
- package/lib/module/types/SetupIntent.js.map +1 -1
- package/lib/module/types/ThreeDSecure.js +1 -1
- package/lib/module/types/ThreeDSecure.js.map +1 -1
- package/lib/module/types/Token.js.map +1 -1
- package/lib/module/types/components/ApplePayButtonComponent.js.map +1 -1
- package/lib/module/types/components/AuBECSDebitFormComponent.js.map +1 -1
- package/lib/module/types/components/CardFieldInput.js +1 -1
- package/lib/module/types/components/CardFieldInput.js.map +1 -1
- package/lib/module/types/components/CardFormView.js.map +1 -1
- package/lib/module/types/components/GooglePayButtonComponent.js.map +1 -1
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/src/NativeStripeSdk.d.ts +5 -4
- package/lib/typescript/src/NativeStripeSdk.d.ts.map +1 -0
- package/lib/typescript/src/components/AddToWalletButton.d.ts +3 -1
- package/lib/typescript/src/components/AddToWalletButton.d.ts.map +1 -0
- package/lib/typescript/src/components/AddressSheet.d.ts +4 -2
- package/lib/typescript/src/components/AddressSheet.d.ts.map +1 -0
- package/lib/typescript/src/components/ApplePayButtonNative.d.ts +1 -0
- package/lib/typescript/src/components/ApplePayButtonNative.d.ts.map +1 -0
- package/lib/typescript/src/components/AuBECSDebitForm.d.ts +3 -1
- package/lib/typescript/src/components/AuBECSDebitForm.d.ts.map +1 -0
- package/lib/typescript/src/components/CardField.d.ts +1 -0
- package/lib/typescript/src/components/CardField.d.ts.map +1 -0
- package/lib/typescript/src/components/CardForm.d.ts +1 -0
- package/lib/typescript/src/components/CardForm.d.ts.map +1 -0
- package/lib/typescript/src/components/CustomerSheet.d.ts +2 -1
- package/lib/typescript/src/components/CustomerSheet.d.ts.map +1 -0
- package/lib/typescript/src/components/GooglePayButtonNative.d.ts +1 -0
- package/lib/typescript/src/components/GooglePayButtonNative.d.ts.map +1 -0
- package/lib/typescript/src/components/PlatformPayButton.d.ts +3 -1
- package/lib/typescript/src/components/PlatformPayButton.d.ts.map +1 -0
- package/lib/typescript/src/components/StripeContainer.d.ts +2 -1
- package/lib/typescript/src/components/StripeContainer.d.ts.map +1 -0
- package/lib/typescript/src/components/StripeProvider.d.ts +3 -2
- package/lib/typescript/src/components/StripeProvider.d.ts.map +1 -0
- package/lib/typescript/src/functions.d.ts +12 -7
- package/lib/typescript/src/functions.d.ts.map +1 -0
- package/lib/typescript/src/helpers.d.ts +1 -0
- package/lib/typescript/src/helpers.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useConfirmPayment.d.ts +2 -1
- package/lib/typescript/src/hooks/useConfirmPayment.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useConfirmSetupIntent.d.ts +1 -0
- package/lib/typescript/src/hooks/useConfirmSetupIntent.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts +5 -2
- package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts.map +1 -0
- package/lib/typescript/src/hooks/usePaymentSheet.d.ts +2 -1
- package/lib/typescript/src/hooks/usePaymentSheet.d.ts.map +1 -0
- package/lib/typescript/src/hooks/usePlatformPay.d.ts +4 -3
- package/lib/typescript/src/hooks/usePlatformPay.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useStripe.d.ts +11 -8
- package/lib/typescript/src/hooks/useStripe.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/plugin/withStripe.d.ts +2 -1
- package/lib/typescript/src/plugin/withStripe.d.ts.map +1 -0
- package/lib/typescript/src/types/ApplePay.d.ts +6 -5
- package/lib/typescript/src/types/ApplePay.d.ts.map +1 -0
- package/lib/typescript/src/types/Common.d.ts +4 -1
- package/lib/typescript/src/types/Common.d.ts.map +1 -0
- package/lib/typescript/src/types/CustomerSheet.d.ts +12 -4
- package/lib/typescript/src/types/CustomerSheet.d.ts.map +1 -0
- package/lib/typescript/src/types/Errors.d.ts +2 -1
- package/lib/typescript/src/types/Errors.d.ts.map +1 -0
- package/lib/typescript/src/types/FinancialConnections.d.ts +82 -14
- package/lib/typescript/src/types/FinancialConnections.d.ts.map +1 -0
- package/lib/typescript/src/types/NextAction.d.ts +9 -8
- package/lib/typescript/src/types/NextAction.d.ts.map +1 -0
- package/lib/typescript/src/types/PaymentIntent.d.ts +41 -14
- package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -0
- package/lib/typescript/src/types/PaymentMethod.d.ts +27 -15
- package/lib/typescript/src/types/PaymentMethod.d.ts.map +1 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts +72 -22
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -0
- package/lib/typescript/src/types/PlatformPay.d.ts +22 -21
- package/lib/typescript/src/types/PlatformPay.d.ts.map +1 -0
- package/lib/typescript/src/types/PushProvisioning.d.ts +5 -4
- package/lib/typescript/src/types/PushProvisioning.d.ts.map +1 -0
- package/lib/typescript/src/types/SetupIntent.d.ts +4 -3
- package/lib/typescript/src/types/SetupIntent.d.ts.map +1 -0
- package/lib/typescript/src/types/ThreeDSecure.d.ts +1 -0
- package/lib/typescript/src/types/ThreeDSecure.d.ts.map +1 -0
- package/lib/typescript/src/types/Token.d.ts +10 -9
- package/lib/typescript/src/types/Token.d.ts.map +1 -0
- package/lib/typescript/src/types/components/ApplePayButtonComponent.d.ts +3 -2
- package/lib/typescript/src/types/components/ApplePayButtonComponent.d.ts.map +1 -0
- package/lib/typescript/src/types/components/AuBECSDebitFormComponent.d.ts +1 -0
- package/lib/typescript/src/types/components/AuBECSDebitFormComponent.d.ts.map +1 -0
- package/lib/typescript/src/types/components/CardFieldInput.d.ts +8 -5
- package/lib/typescript/src/types/components/CardFieldInput.d.ts.map +1 -0
- package/lib/typescript/src/types/components/CardFormView.d.ts +9 -6
- package/lib/typescript/src/types/components/CardFormView.d.ts.map +1 -0
- package/lib/typescript/src/types/components/GooglePayButtonComponent.d.ts +1 -0
- package/lib/typescript/src/types/components/GooglePayButtonComponent.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +24 -23
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/package.json +33 -42
- package/src/NativeStripeSdk.tsx +5 -3
- package/src/components/CardField.tsx +1 -1
- package/src/components/CardForm.tsx +12 -9
- package/src/components/CustomerSheet.tsx +4 -6
- package/src/components/StripeProvider.tsx +17 -0
- package/src/functions.ts +70 -16
- package/src/hooks/useFinancialConnectionsSheet.tsx +12 -4
- package/src/hooks/useStripe.tsx +10 -4
- package/src/types/Common.ts +3 -0
- package/src/types/CustomerSheet.ts +7 -0
- package/src/types/FinancialConnections.ts +72 -0
- package/src/types/PaymentIntent.ts +30 -1
- package/src/types/PaymentMethod.ts +13 -1
- package/src/types/PaymentSheet.ts +65 -5
- package/src/types/components/CardFieldInput.ts +8 -4
- package/src/types/components/CardFormView.ts +8 -4
- package/stripe-react-native.podspec +2 -1
package/src/functions.ts
CHANGED
|
@@ -38,6 +38,8 @@ import {
|
|
|
38
38
|
NativeModules,
|
|
39
39
|
EmitterSubscription,
|
|
40
40
|
} from 'react-native';
|
|
41
|
+
import type { CollectFinancialConnectionsAccountsParams } from './types/FinancialConnections';
|
|
42
|
+
import type { CollectBankAccountTokenParams } from './types/PaymentMethod';
|
|
41
43
|
|
|
42
44
|
export const createPaymentMethod = async (
|
|
43
45
|
params: PaymentMethod.CreateParams,
|
|
@@ -119,9 +121,8 @@ export const retrieveSetupIntent = async (
|
|
|
119
121
|
clientSecret: string
|
|
120
122
|
): Promise<RetrieveSetupIntentResult> => {
|
|
121
123
|
try {
|
|
122
|
-
const { setupIntent, error } =
|
|
123
|
-
clientSecret
|
|
124
|
-
);
|
|
124
|
+
const { setupIntent, error } =
|
|
125
|
+
await NativeStripeSdk.retrieveSetupIntent(clientSecret);
|
|
125
126
|
if (error) {
|
|
126
127
|
return {
|
|
127
128
|
error,
|
|
@@ -269,9 +270,8 @@ export const createTokenForCVCUpdate = async (
|
|
|
269
270
|
cvc: string
|
|
270
271
|
): Promise<CreateTokenForCVCUpdateResult> => {
|
|
271
272
|
try {
|
|
272
|
-
const { tokenId, error } =
|
|
273
|
-
cvc
|
|
274
|
-
);
|
|
273
|
+
const { tokenId, error } =
|
|
274
|
+
await NativeStripeSdk.createTokenForCVCUpdate(cvc);
|
|
275
275
|
if (error) {
|
|
276
276
|
return {
|
|
277
277
|
error,
|
|
@@ -356,6 +356,7 @@ export const verifyMicrodepositsForSetup = async (
|
|
|
356
356
|
const eventEmitter = new NativeEventEmitter(NativeModules.StripeSdk);
|
|
357
357
|
let confirmHandlerCallback: EmitterSubscription | null = null;
|
|
358
358
|
let orderTrackingCallbackListener: EmitterSubscription | null = null;
|
|
359
|
+
let financialConnectionsEventListener: EmitterSubscription | null = null;
|
|
359
360
|
|
|
360
361
|
export const initPaymentSheet = async (
|
|
361
362
|
params: PaymentSheet.SetupParams
|
|
@@ -420,9 +421,8 @@ export const presentPaymentSheet = async (
|
|
|
420
421
|
options: PaymentSheet.PresentOptions = {}
|
|
421
422
|
): Promise<PresentPaymentSheetResult> => {
|
|
422
423
|
try {
|
|
423
|
-
const { paymentOption, error } =
|
|
424
|
-
options
|
|
425
|
-
);
|
|
424
|
+
const { paymentOption, error } =
|
|
425
|
+
await NativeStripeSdk.presentPaymentSheet(options);
|
|
426
426
|
if (error) {
|
|
427
427
|
return {
|
|
428
428
|
error,
|
|
@@ -468,6 +468,15 @@ export const collectBankAccountForPayment = async (
|
|
|
468
468
|
clientSecret: string,
|
|
469
469
|
params: PaymentMethod.CollectBankAccountParams
|
|
470
470
|
): Promise<CollectBankAccountForPaymentResult> => {
|
|
471
|
+
financialConnectionsEventListener?.remove();
|
|
472
|
+
|
|
473
|
+
if (params.onEvent) {
|
|
474
|
+
financialConnectionsEventListener = eventEmitter.addListener(
|
|
475
|
+
'onFinancialConnectionsEvent',
|
|
476
|
+
params.onEvent
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
|
|
471
480
|
try {
|
|
472
481
|
const { paymentIntent, error } = (await NativeStripeSdk.collectBankAccount(
|
|
473
482
|
true,
|
|
@@ -475,6 +484,8 @@ export const collectBankAccountForPayment = async (
|
|
|
475
484
|
params
|
|
476
485
|
)) as CollectBankAccountForPaymentResult;
|
|
477
486
|
|
|
487
|
+
financialConnectionsEventListener?.remove();
|
|
488
|
+
|
|
478
489
|
if (error) {
|
|
479
490
|
return {
|
|
480
491
|
error,
|
|
@@ -484,6 +495,7 @@ export const collectBankAccountForPayment = async (
|
|
|
484
495
|
paymentIntent: paymentIntent!,
|
|
485
496
|
};
|
|
486
497
|
} catch (error: any) {
|
|
498
|
+
financialConnectionsEventListener?.remove();
|
|
487
499
|
return {
|
|
488
500
|
error: createError(error),
|
|
489
501
|
};
|
|
@@ -494,6 +506,15 @@ export const collectBankAccountForSetup = async (
|
|
|
494
506
|
clientSecret: string,
|
|
495
507
|
params: PaymentMethod.CollectBankAccountParams
|
|
496
508
|
): Promise<CollectBankAccountForSetupResult> => {
|
|
509
|
+
financialConnectionsEventListener?.remove();
|
|
510
|
+
|
|
511
|
+
if (params.onEvent) {
|
|
512
|
+
financialConnectionsEventListener = eventEmitter.addListener(
|
|
513
|
+
'onFinancialConnectionsEvent',
|
|
514
|
+
params.onEvent
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
|
|
497
518
|
try {
|
|
498
519
|
const { setupIntent, error } = (await NativeStripeSdk.collectBankAccount(
|
|
499
520
|
false,
|
|
@@ -501,6 +522,8 @@ export const collectBankAccountForSetup = async (
|
|
|
501
522
|
params
|
|
502
523
|
)) as CollectBankAccountForSetupResult;
|
|
503
524
|
|
|
525
|
+
financialConnectionsEventListener?.remove();
|
|
526
|
+
|
|
504
527
|
if (error) {
|
|
505
528
|
return {
|
|
506
529
|
error,
|
|
@@ -510,6 +533,7 @@ export const collectBankAccountForSetup = async (
|
|
|
510
533
|
setupIntent: setupIntent!,
|
|
511
534
|
};
|
|
512
535
|
} catch (error: any) {
|
|
536
|
+
financialConnectionsEventListener?.remove();
|
|
513
537
|
return {
|
|
514
538
|
error: createError(error),
|
|
515
539
|
};
|
|
@@ -520,14 +544,27 @@ export const collectBankAccountForSetup = async (
|
|
|
520
544
|
* Use collectBankAccountToken in the [Add a Financial Connections Account to a US Custom Connect](https://stripe.com/docs/financial-connections/connect-payouts) account flow.
|
|
521
545
|
* When called, it will load the Authentication Flow, an on-page modal UI which allows your user to securely link their external financial account for payouts.
|
|
522
546
|
* @param {string} clientSecret The client_secret of the [Financial Connections Session](https://stripe.com/docs/api/financial_connections/session).
|
|
547
|
+
* @param {CollectBankAccountTokenParams} params Optional parameters.
|
|
523
548
|
* @returns A promise that resolves to an object containing either `session` and `token` fields, or an error field.
|
|
524
549
|
*/
|
|
525
550
|
export const collectBankAccountToken = async (
|
|
526
|
-
clientSecret: string
|
|
551
|
+
clientSecret: string,
|
|
552
|
+
params: CollectBankAccountTokenParams = {}
|
|
527
553
|
): Promise<FinancialConnections.TokenResult> => {
|
|
554
|
+
financialConnectionsEventListener?.remove();
|
|
555
|
+
|
|
556
|
+
if (params.onEvent) {
|
|
557
|
+
financialConnectionsEventListener = eventEmitter.addListener(
|
|
558
|
+
'onFinancialConnectionsEvent',
|
|
559
|
+
params.onEvent
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
|
|
528
563
|
try {
|
|
529
564
|
const { session, token, error } =
|
|
530
|
-
await NativeStripeSdk.collectBankAccountToken(clientSecret);
|
|
565
|
+
await NativeStripeSdk.collectBankAccountToken(clientSecret, params);
|
|
566
|
+
|
|
567
|
+
financialConnectionsEventListener?.remove();
|
|
531
568
|
|
|
532
569
|
if (error) {
|
|
533
570
|
return {
|
|
@@ -539,6 +576,7 @@ export const collectBankAccountToken = async (
|
|
|
539
576
|
token: token!,
|
|
540
577
|
};
|
|
541
578
|
} catch (error: any) {
|
|
579
|
+
financialConnectionsEventListener?.remove();
|
|
542
580
|
return {
|
|
543
581
|
error: createError(error),
|
|
544
582
|
};
|
|
@@ -549,14 +587,30 @@ export const collectBankAccountToken = async (
|
|
|
549
587
|
* Use collectFinancialConnectionsAccounts in the [Collect an account to build data-powered products](https://stripe.com/docs/financial-connections/other-data-powered-products) flow.
|
|
550
588
|
* When called, it will load the Authentication Flow, an on-page modal UI which allows your user to securely link their external financial account.
|
|
551
589
|
* @param {string} clientSecret The client_secret of the [Financial Connections Session](https://stripe.com/docs/api/financial_connections/session).
|
|
590
|
+
* @param {CollectFinancialConnectionsAccountsParams} params Optional parameters.
|
|
552
591
|
* @returns A promise that resolves to an object containing either a `session` field, or an error field.
|
|
553
592
|
*/
|
|
554
593
|
export const collectFinancialConnectionsAccounts = async (
|
|
555
|
-
clientSecret: string
|
|
594
|
+
clientSecret: string,
|
|
595
|
+
params: CollectFinancialConnectionsAccountsParams = {}
|
|
556
596
|
): Promise<FinancialConnections.SessionResult> => {
|
|
597
|
+
financialConnectionsEventListener?.remove();
|
|
598
|
+
|
|
599
|
+
if (params.onEvent) {
|
|
600
|
+
financialConnectionsEventListener = eventEmitter.addListener(
|
|
601
|
+
'onFinancialConnectionsEvent',
|
|
602
|
+
params.onEvent
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
|
|
557
606
|
try {
|
|
558
607
|
const { session, error } =
|
|
559
|
-
await NativeStripeSdk.collectFinancialConnectionsAccounts(
|
|
608
|
+
await NativeStripeSdk.collectFinancialConnectionsAccounts(
|
|
609
|
+
clientSecret,
|
|
610
|
+
params
|
|
611
|
+
);
|
|
612
|
+
|
|
613
|
+
financialConnectionsEventListener?.remove();
|
|
560
614
|
|
|
561
615
|
if (error) {
|
|
562
616
|
return {
|
|
@@ -567,6 +621,7 @@ export const collectFinancialConnectionsAccounts = async (
|
|
|
567
621
|
session: session!,
|
|
568
622
|
};
|
|
569
623
|
} catch (error: any) {
|
|
624
|
+
financialConnectionsEventListener?.remove();
|
|
570
625
|
return {
|
|
571
626
|
error: createError(error),
|
|
572
627
|
};
|
|
@@ -607,9 +662,8 @@ export const isCardInWallet = async (params: {
|
|
|
607
662
|
cardLastFour: string;
|
|
608
663
|
}): Promise<IsCardInWalletResult> => {
|
|
609
664
|
try {
|
|
610
|
-
const { isInWallet, token, error } =
|
|
611
|
-
params
|
|
612
|
-
);
|
|
665
|
+
const { isInWallet, token, error } =
|
|
666
|
+
await NativeStripeSdk.isCardInWallet(params);
|
|
613
667
|
|
|
614
668
|
if (error) {
|
|
615
669
|
return {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useState, useCallback } from 'react';
|
|
2
2
|
import { useStripe } from './useStripe';
|
|
3
|
+
import type { CollectFinancialConnectionsAccountsParams } from 'src/types/FinancialConnections';
|
|
4
|
+
import type { CollectBankAccountTokenParams } from 'src/types/PaymentMethod';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* React hook for accessing functions on the Financial Connections sheet.
|
|
@@ -13,9 +15,9 @@ export function useFinancialConnectionsSheet() {
|
|
|
13
15
|
useStripe();
|
|
14
16
|
|
|
15
17
|
const _collectBankAccountToken = useCallback(
|
|
16
|
-
async (clientSecret: string) => {
|
|
18
|
+
async (clientSecret: string, params?: CollectBankAccountTokenParams) => {
|
|
17
19
|
setLoading(true);
|
|
18
|
-
const result = await collectBankAccountToken(clientSecret);
|
|
20
|
+
const result = await collectBankAccountToken(clientSecret, params);
|
|
19
21
|
setLoading(false);
|
|
20
22
|
return result;
|
|
21
23
|
},
|
|
@@ -23,9 +25,15 @@ export function useFinancialConnectionsSheet() {
|
|
|
23
25
|
);
|
|
24
26
|
|
|
25
27
|
const _collectFinancialConnectionsAccounts = useCallback(
|
|
26
|
-
async (
|
|
28
|
+
async (
|
|
29
|
+
clientSecret: string,
|
|
30
|
+
params?: CollectFinancialConnectionsAccountsParams
|
|
31
|
+
) => {
|
|
27
32
|
setLoading(true);
|
|
28
|
-
const result = await collectFinancialConnectionsAccounts(
|
|
33
|
+
const result = await collectFinancialConnectionsAccounts(
|
|
34
|
+
clientSecret,
|
|
35
|
+
params
|
|
36
|
+
);
|
|
29
37
|
setLoading(false);
|
|
30
38
|
return result;
|
|
31
39
|
},
|
package/src/hooks/useStripe.tsx
CHANGED
|
@@ -60,6 +60,8 @@ import {
|
|
|
60
60
|
updatePlatformPaySheet,
|
|
61
61
|
openPlatformPaySetup,
|
|
62
62
|
} from '../functions';
|
|
63
|
+
import type { CollectBankAccountTokenParams } from 'src/types/PaymentMethod';
|
|
64
|
+
import type { CollectFinancialConnectionsAccountsParams } from 'src/types/FinancialConnections';
|
|
63
65
|
|
|
64
66
|
/**
|
|
65
67
|
* useStripe hook
|
|
@@ -225,17 +227,21 @@ export function useStripe() {
|
|
|
225
227
|
);
|
|
226
228
|
|
|
227
229
|
const _collectBankAccountToken = useCallback(
|
|
228
|
-
async (
|
|
229
|
-
|
|
230
|
+
async (
|
|
231
|
+
clientSecret: string,
|
|
232
|
+
params?: CollectBankAccountTokenParams
|
|
233
|
+
): Promise<FinancialConnections.TokenResult> => {
|
|
234
|
+
return collectBankAccountToken(clientSecret, params);
|
|
230
235
|
},
|
|
231
236
|
[]
|
|
232
237
|
);
|
|
233
238
|
|
|
234
239
|
const _collectFinancialConnectionsAccounts = useCallback(
|
|
235
240
|
async (
|
|
236
|
-
clientSecret: string
|
|
241
|
+
clientSecret: string,
|
|
242
|
+
params?: CollectFinancialConnectionsAccountsParams
|
|
237
243
|
): Promise<FinancialConnections.SessionResult> => {
|
|
238
|
-
return collectFinancialConnectionsAccounts(clientSecret);
|
|
244
|
+
return collectFinancialConnectionsAccounts(clientSecret, params);
|
|
239
245
|
},
|
|
240
246
|
[]
|
|
241
247
|
);
|
package/src/types/Common.ts
CHANGED
|
@@ -47,6 +47,13 @@ export type CustomerSheetInitParams = {
|
|
|
47
47
|
* If false, the customer can't delete if they only have one saved payment method remaining.
|
|
48
48
|
*/
|
|
49
49
|
allowsRemovalOfLastSavedPaymentMethod?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* By default, CustomerSheet will accept all supported cards by Stripe.
|
|
52
|
+
* You can specify card brands CustomerSheet should block or allow payment for by providing an array of those card brands.
|
|
53
|
+
* Note: This is only a client-side solution.
|
|
54
|
+
* Note: Card brand filtering is not currently supported in Link.
|
|
55
|
+
*/
|
|
56
|
+
cardBrandAcceptance?: PaymentSheet.CardBrandAcceptance;
|
|
50
57
|
};
|
|
51
58
|
|
|
52
59
|
export type CustomerSheetPresentParams = {
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
import type { UserInterfaceStyle } from './Common';
|
|
1
2
|
import type { BankAccount } from './Token';
|
|
2
3
|
import type { StripeError } from './Errors';
|
|
3
4
|
|
|
5
|
+
export type CollectFinancialConnectionsAccountsParams = {
|
|
6
|
+
/** iOS Only. Style options for colors in Financial Connections. By default, the bank account collector will automatically switch between light and dark mode compatible colors based on device settings. */
|
|
7
|
+
style?: UserInterfaceStyle;
|
|
8
|
+
/** An optional event listener to receive @type {FinancialConnectionEvent} for specific events during the process of a user connecting their financial accounts. */
|
|
9
|
+
onEvent?: (event: FinancialConnectionsEvent) => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
4
12
|
export type SessionResult =
|
|
5
13
|
| {
|
|
6
14
|
/** The updated Financial Connections Session object. */
|
|
@@ -124,3 +132,67 @@ export enum FinancialConnectionsSheetError {
|
|
|
124
132
|
Failed = 'Failed',
|
|
125
133
|
Canceled = 'Canceled',
|
|
126
134
|
}
|
|
135
|
+
|
|
136
|
+
export type FinancialConnectionsEvent = {
|
|
137
|
+
/** The event's name. Represents the type of event that has occurred during the Financial Connections process. */
|
|
138
|
+
name: FinancialConnectionsEventName;
|
|
139
|
+
/** Event-associated metadata. Provides further detail related to the occurred event. */
|
|
140
|
+
metadata: FinancialConnectionsEventMetadata;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export enum FinancialConnectionsEventName {
|
|
144
|
+
/** Invoked when the sheet successfully opens. */
|
|
145
|
+
Open = 'open',
|
|
146
|
+
/** Invoked when the manual entry flow is initiated. */
|
|
147
|
+
ManualEntryInitiated = 'manual_entry_initiated',
|
|
148
|
+
/** Invoked when "Agree and continue" is selected on the consent pane. */
|
|
149
|
+
ConsentAcquired = 'consent_acquired',
|
|
150
|
+
/** Invoked when the search bar is selected, the user inputs search terms, and receives an API response. */
|
|
151
|
+
SearchInitiated = 'search_initiated',
|
|
152
|
+
/** Invoked when an institution is selected, either from featured institutions or search results. */
|
|
153
|
+
InstitutionSelected = 'institution_selected',
|
|
154
|
+
/** Invoked when the authorization is successfully completed. */
|
|
155
|
+
InstitutionAuthorized = 'institution_authorized',
|
|
156
|
+
/** Invoked when accounts are selected and "confirm" is selected. */
|
|
157
|
+
AccountsSelected = 'accounts_selected',
|
|
158
|
+
/** Invoked when the flow is completed and selected accounts are correctly connected to the payment instrument. */
|
|
159
|
+
Success = 'success',
|
|
160
|
+
/** Invoked when an error is encountered. Refer to error codes for more details. */
|
|
161
|
+
Error = 'error',
|
|
162
|
+
/** Invoked when the flow is cancelled, typically by the user pressing the "X" button. */
|
|
163
|
+
Cancel = 'cancel',
|
|
164
|
+
/** Invoked when the modal is launched in an external browser. After this event, no other events will be sent until the completion of the browser session. */
|
|
165
|
+
FlowLaunchedInBrowser = 'flow_launched_in_browser',
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export type FinancialConnectionsEventMetadata = {
|
|
169
|
+
/** A Boolean value that indicates if the user completed the process through the manual entry flow. */
|
|
170
|
+
manualEntry?: boolean;
|
|
171
|
+
/** A String value containing the name of the institution that the user selected. */
|
|
172
|
+
institutionName?: string;
|
|
173
|
+
/** An ErrorCode value representing the type of error that occurred. */
|
|
174
|
+
errorCode?: FinancialConnectionsEventErrorCode;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export enum FinancialConnectionsEventErrorCode {
|
|
178
|
+
/** The system could not retrieve account numbers for selected accounts. */
|
|
179
|
+
AccountNumbersUnavailable = 'account_numbers_unavailable',
|
|
180
|
+
/** The system could not retrieve accounts for the selected institution. */
|
|
181
|
+
AccountsUnavailable = 'accounts_unavailable',
|
|
182
|
+
/** For payment flows, no debitable account was available at the selected institution. */
|
|
183
|
+
NoDebitableAccount = 'no_debitable_account',
|
|
184
|
+
/** Authorization with the selected institution has failed. */
|
|
185
|
+
AuthorizationFailed = 'authorization_failed',
|
|
186
|
+
/** The selected institution is down for expected maintenance. */
|
|
187
|
+
InstitutionUnavailablePlanned = 'institution_unavailable_planned',
|
|
188
|
+
/** The selected institution is unexpectedly down. */
|
|
189
|
+
InstitutionUnavailableUnplanned = 'institution_unavailable_unplanned',
|
|
190
|
+
/** A timeout occurred while communicating with our partner or downstream institutions. */
|
|
191
|
+
InstitutionTimeout = 'institution_timeout',
|
|
192
|
+
/** An unexpected error occurred, either in an API call or on the client-side. */
|
|
193
|
+
UnexpectedError = 'unexpected_error',
|
|
194
|
+
/** The client secret that powers the session has expired. */
|
|
195
|
+
SessionExpired = 'session_expired',
|
|
196
|
+
/** The hCaptcha challenge failed. */
|
|
197
|
+
FailedBotDetection = 'failed_bot_detection',
|
|
198
|
+
}
|
|
@@ -88,6 +88,10 @@ export type MandateData = {
|
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
+
type MetaData = {
|
|
92
|
+
[key: string]: string;
|
|
93
|
+
};
|
|
94
|
+
|
|
91
95
|
export type CardParams =
|
|
92
96
|
| {
|
|
93
97
|
paymentMethodType: 'Card';
|
|
@@ -95,6 +99,7 @@ export type CardParams =
|
|
|
95
99
|
token?: string;
|
|
96
100
|
billingDetails?: BillingDetails;
|
|
97
101
|
mandateData?: MandateData;
|
|
102
|
+
metadata?: MetaData;
|
|
98
103
|
};
|
|
99
104
|
}
|
|
100
105
|
| {
|
|
@@ -104,6 +109,7 @@ export type CardParams =
|
|
|
104
109
|
cvc?: string;
|
|
105
110
|
billingDetails?: BillingDetails;
|
|
106
111
|
mandateData?: MandateData;
|
|
112
|
+
metadata?: MetaData;
|
|
107
113
|
};
|
|
108
114
|
};
|
|
109
115
|
|
|
@@ -113,18 +119,24 @@ export interface IdealParams {
|
|
|
113
119
|
bankName?: string;
|
|
114
120
|
billingDetails?: BillingDetails;
|
|
115
121
|
mandateData?: MandateData;
|
|
122
|
+
metadata?: MetaData;
|
|
116
123
|
};
|
|
117
124
|
}
|
|
118
125
|
|
|
119
126
|
export interface FPXParams {
|
|
120
127
|
paymentMethodType: 'Fpx';
|
|
121
|
-
paymentMethodData?: {
|
|
128
|
+
paymentMethodData?: {
|
|
129
|
+
testOfflineBank?: boolean;
|
|
130
|
+
mandateData?: MandateData;
|
|
131
|
+
metadata?: MetaData;
|
|
132
|
+
};
|
|
122
133
|
}
|
|
123
134
|
|
|
124
135
|
export interface AlipayParams {
|
|
125
136
|
paymentMethodType: 'Alipay';
|
|
126
137
|
paymentMethodData?: {
|
|
127
138
|
mandateData?: MandateData;
|
|
139
|
+
metadata?: MetaData;
|
|
128
140
|
};
|
|
129
141
|
}
|
|
130
142
|
|
|
@@ -133,6 +145,7 @@ export interface OxxoParams {
|
|
|
133
145
|
paymentMethodData: {
|
|
134
146
|
billingDetails: BillingDetails;
|
|
135
147
|
mandateData?: MandateData;
|
|
148
|
+
metadata?: MetaData;
|
|
136
149
|
};
|
|
137
150
|
}
|
|
138
151
|
|
|
@@ -142,6 +155,7 @@ export interface SofortParams {
|
|
|
142
155
|
country: string;
|
|
143
156
|
billingDetails: BillingDetails;
|
|
144
157
|
mandateData?: MandateData;
|
|
158
|
+
metadata?: MetaData;
|
|
145
159
|
};
|
|
146
160
|
}
|
|
147
161
|
export interface GrabPayParams {
|
|
@@ -149,6 +163,7 @@ export interface GrabPayParams {
|
|
|
149
163
|
paymentMethodData?: {
|
|
150
164
|
billingDetails?: BillingDetails;
|
|
151
165
|
mandateData?: MandateData;
|
|
166
|
+
metadata?: MetaData;
|
|
152
167
|
};
|
|
153
168
|
}
|
|
154
169
|
|
|
@@ -157,6 +172,7 @@ export interface BancontactParams {
|
|
|
157
172
|
paymentMethodData: {
|
|
158
173
|
billingDetails: BillingDetails;
|
|
159
174
|
mandateData?: MandateData;
|
|
175
|
+
metadata?: MetaData;
|
|
160
176
|
};
|
|
161
177
|
}
|
|
162
178
|
|
|
@@ -166,6 +182,7 @@ export interface SepaParams {
|
|
|
166
182
|
iban: string;
|
|
167
183
|
billingDetails: BillingDetails;
|
|
168
184
|
mandateData?: MandateData;
|
|
185
|
+
metadata?: MetaData;
|
|
169
186
|
};
|
|
170
187
|
}
|
|
171
188
|
|
|
@@ -174,6 +191,7 @@ export interface GiropayParams {
|
|
|
174
191
|
paymentMethodData: {
|
|
175
192
|
billingDetails: BillingDetails;
|
|
176
193
|
mandateData?: MandateData;
|
|
194
|
+
metadata?: MetaData;
|
|
177
195
|
};
|
|
178
196
|
}
|
|
179
197
|
|
|
@@ -183,6 +201,7 @@ export interface AfterpayClearpayParams {
|
|
|
183
201
|
shippingDetails: BillingDetails;
|
|
184
202
|
billingDetails: BillingDetails;
|
|
185
203
|
mandateData?: MandateData;
|
|
204
|
+
metadata?: MetaData;
|
|
186
205
|
};
|
|
187
206
|
}
|
|
188
207
|
|
|
@@ -194,6 +213,7 @@ export type KlarnaParams = {
|
|
|
194
213
|
} & BillingDetails;
|
|
195
214
|
shippingDetails?: BillingDetails;
|
|
196
215
|
mandateData?: MandateData;
|
|
216
|
+
metadata?: MetaData;
|
|
197
217
|
};
|
|
198
218
|
};
|
|
199
219
|
|
|
@@ -202,6 +222,7 @@ export interface EpsParams {
|
|
|
202
222
|
paymentMethodData: {
|
|
203
223
|
billingDetails: BillingDetails;
|
|
204
224
|
mandateData?: MandateData;
|
|
225
|
+
metadata?: MetaData;
|
|
205
226
|
};
|
|
206
227
|
}
|
|
207
228
|
|
|
@@ -210,6 +231,7 @@ export interface P24Params {
|
|
|
210
231
|
paymentMethodData: {
|
|
211
232
|
billingDetails: BillingDetails;
|
|
212
233
|
mandateData?: MandateData;
|
|
234
|
+
metadata?: MetaData;
|
|
213
235
|
};
|
|
214
236
|
}
|
|
215
237
|
|
|
@@ -219,6 +241,7 @@ export interface WeChatPayParams {
|
|
|
219
241
|
appId: string;
|
|
220
242
|
billingDetails?: BillingDetails;
|
|
221
243
|
mandateData?: MandateData;
|
|
244
|
+
metadata?: MetaData;
|
|
222
245
|
};
|
|
223
246
|
}
|
|
224
247
|
|
|
@@ -234,6 +257,7 @@ export type AffirmParams = {
|
|
|
234
257
|
shippingDetails?: BillingDetails;
|
|
235
258
|
billingDetails?: BillingDetails;
|
|
236
259
|
mandateData?: MandateData;
|
|
260
|
+
metadata?: MetaData;
|
|
237
261
|
};
|
|
238
262
|
};
|
|
239
263
|
|
|
@@ -252,6 +276,7 @@ export type USBankAccountParams = {
|
|
|
252
276
|
/** Defaults to Checking */
|
|
253
277
|
accountType?: BankAcccountType;
|
|
254
278
|
mandateData?: MandateData;
|
|
279
|
+
metadata?: MetaData;
|
|
255
280
|
};
|
|
256
281
|
};
|
|
257
282
|
|
|
@@ -260,6 +285,7 @@ export type PayPalParams = {
|
|
|
260
285
|
paymentMethodData?: {
|
|
261
286
|
billingDetails?: BillingDetails;
|
|
262
287
|
mandateData?: MandateData;
|
|
288
|
+
metadata?: MetaData;
|
|
263
289
|
};
|
|
264
290
|
};
|
|
265
291
|
|
|
@@ -268,6 +294,7 @@ export type CashAppParams = {
|
|
|
268
294
|
paymentMethodData?: {
|
|
269
295
|
billingDetails?: BillingDetails;
|
|
270
296
|
mandateData?: MandateData;
|
|
297
|
+
metadata?: MetaData;
|
|
271
298
|
};
|
|
272
299
|
};
|
|
273
300
|
|
|
@@ -276,6 +303,7 @@ export type RevolutPayParams = {
|
|
|
276
303
|
paymentMethodData?: {
|
|
277
304
|
billingDetails?: BillingDetails;
|
|
278
305
|
mandateData?: MandateData;
|
|
306
|
+
metadata?: MetaData;
|
|
279
307
|
};
|
|
280
308
|
};
|
|
281
309
|
|
|
@@ -287,5 +315,6 @@ export type CollectBankAccountParams = {
|
|
|
287
315
|
email?: string;
|
|
288
316
|
};
|
|
289
317
|
mandateData?: MandateData;
|
|
318
|
+
metadata?: MetaData;
|
|
290
319
|
};
|
|
291
320
|
};
|
|
@@ -5,7 +5,8 @@ import type {
|
|
|
5
5
|
BankAcccountType,
|
|
6
6
|
} from './Token';
|
|
7
7
|
import type { FutureUsage } from './PaymentIntent';
|
|
8
|
-
import type { Address, BillingDetails } from './Common';
|
|
8
|
+
import type { Address, BillingDetails, UserInterfaceStyle } from './Common';
|
|
9
|
+
import type { FinancialConnectionsEvent } from './FinancialConnections';
|
|
9
10
|
|
|
10
11
|
export interface Result {
|
|
11
12
|
id: string;
|
|
@@ -313,4 +314,15 @@ export type CollectBankAccountParams = {
|
|
|
313
314
|
email?: string;
|
|
314
315
|
};
|
|
315
316
|
};
|
|
317
|
+
/** iOS only. Style options for colors in Financial Connections. By default, the bank account collector will automatically switch between light and dark mode compatible colors based on device settings. */
|
|
318
|
+
style?: UserInterfaceStyle;
|
|
319
|
+
/** An optional event listener to receive @type {FinancialConnectionEvent} for specific events during the process of a user connecting their financial accounts. */
|
|
320
|
+
onEvent?: (event: FinancialConnectionsEvent) => void;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
export type CollectBankAccountTokenParams = {
|
|
324
|
+
/** iOS only. Style options for colors in Financial Connections. By default, the bank account collector will automatically switch between light and dark mode compatible colors based on device settings. */
|
|
325
|
+
style?: UserInterfaceStyle;
|
|
326
|
+
/** An optional event listener to receive @type {FinancialConnectionEvent} for specific events during the process of a user connecting their financial accounts. */
|
|
327
|
+
onEvent?: (event: FinancialConnectionsEvent) => void;
|
|
316
328
|
};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
BillingDetails,
|
|
3
|
+
AddressDetails,
|
|
4
|
+
CardBrand,
|
|
5
|
+
UserInterfaceStyle,
|
|
6
|
+
} from './Common';
|
|
2
7
|
import type { CartSummaryItem } from './ApplePay';
|
|
3
8
|
import type {
|
|
4
9
|
ButtonType,
|
|
@@ -10,7 +15,7 @@ import type { FutureUsage } from './PaymentIntent';
|
|
|
10
15
|
import type { Result } from './PaymentMethod';
|
|
11
16
|
import type { StripeError } from './Errors';
|
|
12
17
|
|
|
13
|
-
type SetupParamsBase = IntentParams & {
|
|
18
|
+
export type SetupParamsBase = IntentParams & {
|
|
14
19
|
/** Your customer-facing business name. On Android, this is required and cannot be an empty string. */
|
|
15
20
|
merchantDisplayName: string;
|
|
16
21
|
/** The identifier of the Stripe Customer object. See https://stripe.com/docs/api/customers/object#customer_object-id */
|
|
@@ -23,7 +28,7 @@ type SetupParamsBase = IntentParams & {
|
|
|
23
28
|
/** Android only. Enable Google Pay in the Payment Sheet by passing a GooglePayParams object. */
|
|
24
29
|
googlePay?: GooglePayParams;
|
|
25
30
|
/** The color styling to use for PaymentSheet UI. Defaults to 'automatic'. */
|
|
26
|
-
style?:
|
|
31
|
+
style?: UserInterfaceStyle;
|
|
27
32
|
/** A URL that redirects back to your app that PaymentSheet can use to auto-dismiss web views used for additional authentication, e.g. 3DS2 */
|
|
28
33
|
returnURL?: string;
|
|
29
34
|
/** Configuration for how billing details are collected during checkout. */
|
|
@@ -70,6 +75,13 @@ type SetupParamsBase = IntentParams & {
|
|
|
70
75
|
* - Note: Defaults to `Automatic` if not set
|
|
71
76
|
*/
|
|
72
77
|
paymentMethodLayout?: PaymentMethodLayout;
|
|
78
|
+
/**
|
|
79
|
+
* By default, PaymentSheet will accept all supported cards by Stripe.
|
|
80
|
+
* You can specify card brands PaymentSheet should block or allow payment for by providing an array of those card brands.
|
|
81
|
+
* Note: This is only a client-side solution.
|
|
82
|
+
* Note: Card brand filtering is not currently supported in Link.
|
|
83
|
+
*/
|
|
84
|
+
cardBrandAcceptance?: CardBrandAcceptance;
|
|
73
85
|
};
|
|
74
86
|
|
|
75
87
|
export type SetupParams =
|
|
@@ -303,8 +315,8 @@ type RecursivePartial<T> = {
|
|
|
303
315
|
[P in keyof T]?: T[P] extends (infer U)[]
|
|
304
316
|
? RecursivePartial<U>[]
|
|
305
317
|
: T[P] extends object
|
|
306
|
-
|
|
307
|
-
|
|
318
|
+
? RecursivePartial<T[P]>
|
|
319
|
+
: T[P];
|
|
308
320
|
};
|
|
309
321
|
export interface PaymentOption {
|
|
310
322
|
label: string;
|
|
@@ -441,3 +453,51 @@ export enum PaymentMethodLayout {
|
|
|
441
453
|
*/
|
|
442
454
|
Automatic = 'Automatic',
|
|
443
455
|
}
|
|
456
|
+
|
|
457
|
+
/** Card brand categories that can be allowed or disallowed */
|
|
458
|
+
export enum CardBrandCategory {
|
|
459
|
+
/** Visa branded cards */
|
|
460
|
+
Visa = 'visa',
|
|
461
|
+
/** Mastercard branded cards */
|
|
462
|
+
Mastercard = 'mastercard',
|
|
463
|
+
/** American Express branded cards */
|
|
464
|
+
Amex = 'amex',
|
|
465
|
+
/**
|
|
466
|
+
* Discover branded cards
|
|
467
|
+
* Note: Encompasses all of Discover Global Network (Discover, Diners, JCB, UnionPay, Elo)
|
|
468
|
+
*/
|
|
469
|
+
Discover = 'discover',
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/** Filter types for card brand acceptance */
|
|
473
|
+
export enum CardBrandAcceptanceFilter {
|
|
474
|
+
/** Accept all card brands supported by Stripe */
|
|
475
|
+
All = 'all',
|
|
476
|
+
/** Accept only the specified card brands */
|
|
477
|
+
Allowed = 'allowed',
|
|
478
|
+
/** Accept all card brands except the specified ones */
|
|
479
|
+
Disallowed = 'disallowed',
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/** Options to block certain card brands on the client */
|
|
483
|
+
export type CardBrandAcceptance =
|
|
484
|
+
| {
|
|
485
|
+
/** Accept all card brands supported by Stripe */
|
|
486
|
+
filter: CardBrandAcceptanceFilter.All;
|
|
487
|
+
}
|
|
488
|
+
| {
|
|
489
|
+
/** Accept only the specified card brands */
|
|
490
|
+
filter: CardBrandAcceptanceFilter.Allowed;
|
|
491
|
+
/** List of card brands to accept
|
|
492
|
+
* Note: Any card brands that do not map to a CardBrandCategory will be blocked when using an allow list
|
|
493
|
+
*/
|
|
494
|
+
brands: CardBrandCategory[];
|
|
495
|
+
}
|
|
496
|
+
| {
|
|
497
|
+
/** Accept all card brands except the specified ones */
|
|
498
|
+
filter: CardBrandAcceptanceFilter.Disallowed;
|
|
499
|
+
/** List of card brands to block
|
|
500
|
+
* Note: Any card brands that do not map to a CardBrandCategory will be accepted when using a disallow list
|
|
501
|
+
*/
|
|
502
|
+
brands: CardBrandCategory[];
|
|
503
|
+
};
|