@stripe/stripe-react-native 0.12.0 → 0.14.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/CHANGELOG.md +51 -9
- package/README.md +2 -2
- package/android/.DS_Store +0 -0
- package/android/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.1/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/.gitignore +3 -0
- package/android/.idea/gradle.xml +13 -0
- package/android/.idea/misc.xml +9 -0
- package/android/.idea/modules/android.iml +18 -0
- package/android/.idea/modules.xml +8 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/.idea/workspace.xml +52 -0
- package/android/build.gradle +11 -0
- package/android/local.properties +8 -0
- package/android/src/.DS_Store +0 -0
- package/android/src/androidTest/.DS_Store +0 -0
- package/android/src/androidTest/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxyTest.kt +35 -0
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +21 -6
- package/android/src/main/java/com/reactnativestripesdk/CardFieldViewManager.kt +5 -0
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +8 -0
- package/android/src/main/java/com/reactnativestripesdk/CardFormViewManager.kt +5 -0
- package/android/src/main/java/com/reactnativestripesdk/Mappers.kt +21 -7
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +9 -3
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +59 -2
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +0 -1
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxy.kt +19 -7
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +45 -38
- package/ios/.DS_Store +0 -0
- package/ios/CardFieldManager.m +1 -0
- package/ios/CardFieldView.swift +17 -8
- package/ios/Mappers.swift +8 -9
- package/ios/StripeSdk.m +5 -0
- package/ios/StripeSdk.swift +151 -119
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcuserdata/charliecruzan.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/StripeSdk.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme +52 -0
- package/ios/StripeSdk.xcodeproj/xcuserdata/charliecruzan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +22 -0
- package/ios/StripeSdk.xcodeproj/xcuserdata/charliecruzan.xcuserdatad/xcschemes/xcschememanagement.plist +27 -0
- package/ios/Tests/PushProvisioningTests.swift +49 -0
- package/ios/pushprovisioning/AddToWalletButtonView.swift +1 -5
- package/ios/pushprovisioning/PushProvisioningUtils.swift +64 -0
- 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/ApplePayButton.js +1 -1
- package/lib/commonjs/components/ApplePayButton.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/GooglePayButton.js +1 -1
- package/lib/commonjs/components/GooglePayButton.js.map +1 -1
- package/lib/commonjs/components/StripeContainer.js +1 -1
- package/lib/commonjs/components/StripeContainer.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- package/lib/commonjs/types/components/CardFieldInput.js.map +1 -1
- package/lib/commonjs/types/index.js.map +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/ApplePayButton.js +1 -1
- package/lib/module/components/ApplePayButton.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/GooglePayButton.js +1 -1
- package/lib/module/components/GooglePayButton.js.map +1 -1
- package/lib/module/components/StripeContainer.js +1 -1
- package/lib/module/components/StripeContainer.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- package/lib/module/types/components/CardFieldInput.js.map +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/e2e/screenObject/BasicPaymentScreen.d.ts +1 -2
- package/lib/typescript/src/NativeStripeSdk.d.ts +2 -1
- package/lib/typescript/src/components/AddToWalletButton.d.ts +1 -1
- package/lib/typescript/src/components/CardField.d.ts +3 -0
- package/lib/typescript/src/components/CardForm.d.ts +2 -0
- package/lib/typescript/src/functions.d.ts +2 -1
- package/lib/typescript/src/hooks/useStripe.d.ts +2 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +2 -1
- package/lib/typescript/src/types/Token.d.ts +9 -1
- package/lib/typescript/src/types/components/CardFieldInput.d.ts +1 -0
- package/lib/typescript/src/types/components/CardFormView.d.ts +6 -0
- package/lib/typescript/src/types/index.d.ts +21 -4
- package/package.json +6 -4
- package/src/NativeStripeSdk.tsx +5 -0
- package/src/components/AddToWalletButton.tsx +1 -1
- package/src/components/CardField.tsx +5 -0
- package/src/components/CardForm.tsx +6 -0
- package/src/functions.ts +26 -1
- package/src/hooks/useStripe.tsx +13 -0
- package/src/types/PaymentSheet.ts +2 -1
- package/src/types/Token.ts +13 -1
- package/src/types/components/CardFieldInput.ts +1 -0
- package/src/types/components/CardFormView.ts +7 -0
- package/src/types/index.ts +28 -5
- package/stripe-react-native.podspec +6 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":"m0BAeA,4D,0BACA,sE,oCACA,sE,oCACA,oE,kCACA,kE,gCACA,oE,kCACA,8D,4BACA,qG,wDACA,uG,0DACA,mF,sCACA,+E,kCACA,sD,oBAiBA,iVACA,gC","sourcesContent":["import type {\n ApplePayError,\n CardActionError,\n ConfirmPaymentError,\n ConfirmSetupIntentError,\n CreatePaymentMethodError,\n CreateTokenError,\n GooglePayError,\n PaymentSheetError,\n RetrievePaymentIntentError,\n RetrieveSetupIntentError,\n StripeError,\n VerifyMicrodepositsError,\n CollectBankAccountError,\n} from './Errors';\nimport * as ApplePay from './ApplePay';\nimport * as PaymentIntent from './PaymentIntent';\nimport * as PaymentMethod from './PaymentMethod';\nimport * as PaymentSheet from './PaymentSheet';\nimport * as SetupIntent from './SetupIntent';\nimport * as ThreeDSecure from './ThreeDSecure';\nimport * as GooglePay from './GooglePay';\nimport * as ApplePayButtonComponent from './components/ApplePayButtonComponent';\nimport * as AuBECSDebitFormComponent from './components/AuBECSDebitFormComponent';\nimport * as CardFieldInput from './components/CardFieldInput';\nimport * as CardFormView from './components/CardFormView';\nimport * as Token from './Token';\n\nexport {\n ApplePay,\n PaymentIntent,\n PaymentMethod,\n PaymentSheet,\n SetupIntent,\n ThreeDSecure,\n GooglePay,\n ApplePayButtonComponent,\n AuBECSDebitFormComponent,\n CardFieldInput,\n CardFormView,\n Token,\n};\n\nexport * from './Errors';\nexport { Address, BillingDetails } from './Common';\n\n/**\n * @ignore\n */\nexport type Dictionary<T> = {\n [key: string]: T;\n};\n\nexport interface AppInfo {\n name?: string;\n partnerId?: string;\n url?: string;\n version?: string;\n}\n\nexport type CreatePaymentMethodResult =\n | {\n paymentMethod: PaymentMethod.Result;\n error?: undefined;\n }\n | {\n paymentMethod?: undefined;\n error: StripeError<CreatePaymentMethodError>;\n };\n\nexport type RetrievePaymentIntentResult =\n | {\n paymentIntent: PaymentIntent.Result;\n error?: undefined;\n }\n | {\n paymentIntent?: undefined;\n error: StripeError<RetrievePaymentIntentError>;\n };\n\nexport type RetrieveSetupIntentResult =\n | {\n setupIntent: SetupIntent.Result;\n error?: undefined;\n }\n | {\n setupIntent?: undefined;\n error: StripeError<RetrieveSetupIntentError>;\n };\n\nexport type ConfirmPaymentResult =\n | {\n paymentIntent: PaymentIntent.Result;\n error?: undefined;\n }\n | {\n paymentIntent?: undefined;\n error: StripeError<ConfirmPaymentError>;\n };\n\nexport type HandleNextActionResult =\n | {\n paymentIntent: PaymentIntent.Result;\n error?: undefined;\n }\n | {\n paymentIntent?: undefined;\n error: StripeError<CardActionError>;\n };\n\nexport type ConfirmSetupIntentResult =\n | {\n setupIntent: SetupIntent.Result;\n error?: undefined;\n }\n | {\n setupIntent?: undefined;\n error: StripeError<ConfirmSetupIntentError>;\n };\n\nexport type CreateTokenForCVCUpdateResult =\n | {\n tokenId: string;\n error?: undefined;\n }\n | {\n tokenId?: undefined;\n error: StripeError<ConfirmSetupIntentError>;\n };\n\nexport type InitPaymentSheetResult =\n | {\n paymentOption?: PaymentSheet.PaymentOption;\n error?: undefined;\n }\n | {\n paymentOption?: undefined;\n error: StripeError<PaymentSheetError>;\n };\n\nexport type PresentPaymentSheetResult =\n | {\n paymentOption
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":"m0BAeA,4D,0BACA,sE,oCACA,sE,oCACA,oE,kCACA,kE,gCACA,oE,kCACA,8D,4BACA,qG,wDACA,uG,0DACA,mF,sCACA,+E,kCACA,sD,oBAiBA,iVACA,gC","sourcesContent":["import type {\n ApplePayError,\n CardActionError,\n ConfirmPaymentError,\n ConfirmSetupIntentError,\n CreatePaymentMethodError,\n CreateTokenError,\n GooglePayError,\n PaymentSheetError,\n RetrievePaymentIntentError,\n RetrieveSetupIntentError,\n StripeError,\n VerifyMicrodepositsError,\n CollectBankAccountError,\n} from './Errors';\nimport * as ApplePay from './ApplePay';\nimport * as PaymentIntent from './PaymentIntent';\nimport * as PaymentMethod from './PaymentMethod';\nimport * as PaymentSheet from './PaymentSheet';\nimport * as SetupIntent from './SetupIntent';\nimport * as ThreeDSecure from './ThreeDSecure';\nimport * as GooglePay from './GooglePay';\nimport * as ApplePayButtonComponent from './components/ApplePayButtonComponent';\nimport * as AuBECSDebitFormComponent from './components/AuBECSDebitFormComponent';\nimport * as CardFieldInput from './components/CardFieldInput';\nimport * as CardFormView from './components/CardFormView';\nimport * as Token from './Token';\n\nexport {\n ApplePay,\n PaymentIntent,\n PaymentMethod,\n PaymentSheet,\n SetupIntent,\n ThreeDSecure,\n GooglePay,\n ApplePayButtonComponent,\n AuBECSDebitFormComponent,\n CardFieldInput,\n CardFormView,\n Token,\n};\n\nexport * from './Errors';\nexport { Address, BillingDetails } from './Common';\n\n/**\n * @ignore\n */\nexport type Dictionary<T> = {\n [key: string]: T;\n};\n\nexport interface AppInfo {\n name?: string;\n partnerId?: string;\n url?: string;\n version?: string;\n}\n\nexport type CreatePaymentMethodResult =\n | {\n paymentMethod: PaymentMethod.Result;\n error?: undefined;\n }\n | {\n paymentMethod?: undefined;\n error: StripeError<CreatePaymentMethodError>;\n };\n\nexport type RetrievePaymentIntentResult =\n | {\n paymentIntent: PaymentIntent.Result;\n error?: undefined;\n }\n | {\n paymentIntent?: undefined;\n error: StripeError<RetrievePaymentIntentError>;\n };\n\nexport type RetrieveSetupIntentResult =\n | {\n setupIntent: SetupIntent.Result;\n error?: undefined;\n }\n | {\n setupIntent?: undefined;\n error: StripeError<RetrieveSetupIntentError>;\n };\n\nexport type ConfirmPaymentResult =\n | {\n paymentIntent: PaymentIntent.Result;\n error?: undefined;\n }\n | {\n paymentIntent?: undefined;\n error: StripeError<ConfirmPaymentError>;\n };\n\nexport type HandleNextActionResult =\n | {\n paymentIntent: PaymentIntent.Result;\n error?: undefined;\n }\n | {\n paymentIntent?: undefined;\n error: StripeError<CardActionError>;\n };\n\nexport type ConfirmSetupIntentResult =\n | {\n setupIntent: SetupIntent.Result;\n error?: undefined;\n }\n | {\n setupIntent?: undefined;\n error: StripeError<ConfirmSetupIntentError>;\n };\n\nexport type CreateTokenForCVCUpdateResult =\n | {\n tokenId: string;\n error?: undefined;\n }\n | {\n tokenId?: undefined;\n error: StripeError<ConfirmSetupIntentError>;\n };\n\nexport type InitPaymentSheetResult =\n | {\n paymentOption?: PaymentSheet.PaymentOption;\n error?: undefined;\n }\n | {\n paymentOption?: undefined;\n error: StripeError<PaymentSheetError>;\n };\n\nexport type PresentPaymentSheetResult =\n | {\n paymentOption: PaymentSheet.PaymentOption;\n error?: undefined;\n }\n | {\n paymentOption?: undefined;\n error: StripeError<PaymentSheetError>;\n };\n\nexport type CreateTokenResult =\n | {\n token: Token.Result;\n error?: undefined;\n }\n | {\n token?: undefined;\n error: StripeError<CreateTokenError>;\n };\n\nexport type ConfirmPaymentSheetPaymentResult = {\n error?: StripeError<PaymentSheetError>;\n};\n\nexport type ApplePayResult =\n | {\n paymentMethod: PaymentMethod.Result;\n error?: undefined;\n }\n | {\n paymentMethod?: undefined;\n error: StripeError<ApplePayError>;\n };\n\nexport interface InitStripeParams {\n publishableKey: string;\n stripeAccountId?: string;\n threeDSecureParams?: ThreeDSecure.ConfigurationParams;\n merchantIdentifier?: string;\n urlScheme?: string;\n setReturnUrlSchemeOnAndroid?: boolean;\n}\n\nexport interface InitialiseParams extends InitStripeParams {\n appInfo: AppInfo;\n}\n\nexport type GooglePayInitResult =\n | {\n error?: undefined;\n }\n | {\n error: StripeError<GooglePayError>;\n };\n\nexport type PayWithGooglePayResult =\n | {\n error?: undefined;\n }\n | {\n error: StripeError<GooglePayError>;\n };\n\nexport type CreateGooglePayPaymentMethodResult =\n | {\n paymentMethod: PaymentMethod.Result;\n error?: undefined;\n }\n | {\n paymentMethod?: undefined;\n error: StripeError<GooglePayError>;\n };\n\nexport type OpenApplePaySetupResult =\n | {\n error?: undefined;\n }\n | {\n error: StripeError<ApplePayError>;\n };\n\nexport type VerifyMicrodepositsParams =\n | {\n amounts: number[];\n descriptorCode?: undefined;\n }\n | {\n amounts?: undefined;\n descriptorCode: string;\n };\n\nexport type VerifyMicrodepositsForPaymentResult =\n | {\n paymentIntent: PaymentIntent.Result;\n error?: undefined;\n }\n | {\n paymentIntent?: undefined;\n error: StripeError<VerifyMicrodepositsError>;\n };\n\nexport type VerifyMicrodepositsForSetupResult =\n | {\n setupIntent: SetupIntent.Result;\n error?: undefined;\n }\n | {\n setupIntent?: undefined;\n error: StripeError<VerifyMicrodepositsError>;\n };\n\nexport type CollectBankAccountForPaymentResult =\n | {\n paymentIntent: PaymentIntent.Result;\n error?: undefined;\n }\n | {\n paymentIntent?: undefined;\n error: StripeError<CollectBankAccountError>;\n };\n\nexport type CollectBankAccountForSetupResult =\n | {\n setupIntent: SetupIntent.Result;\n error?: undefined;\n }\n | {\n setupIntent?: undefined;\n error: StripeError<CollectBankAccountError>;\n };\n\nexport type GooglePayCardToken = {\n id: string;\n cardLastFour: string;\n network: number;\n serviceProvider: number;\n issuer: string;\n status:\n | 'TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION'\n | 'TOKEN_STATE_PENDING'\n | 'TOKEN_STATE_SUSPENDED'\n | 'TOKEN_STATE_ACTIVE'\n | 'TOKEN_STATE_FELICA_PENDING_PROVISIONING'\n | 'TOKEN_STATE_UNTOKENIZED';\n};\n\nexport type IsCardInWalletResult =\n | {\n isInWallet: boolean;\n token?: GooglePayCardToken;\n error?: undefined;\n }\n | {\n isInWallet?: undefined;\n token?: undefined;\n error: StripeError<GooglePayError>;\n };\n\nexport type CanAddCardToWalletParams = {\n /** The `primary_account_identifier` value from the issued card. Can be an empty string. */\n primaryAccountIdentifier: string | null;\n /** Last 4 digits of the card number. */\n cardLastFour: string;\n /** iOS only. Set this to `true` until shipping through TestFlight || App Store. If true, you must be using live cards, and have the proper iOS entitlement set up. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#requesting-access-for-ios */\n testEnv?: boolean;\n};\n\nexport type CanAddCardToWalletResult =\n | {\n canAddCard: boolean;\n details?: {\n token?: GooglePayCardToken;\n status?:\n | 'MISSING_CONFIGURATION'\n | 'UNSUPPORTED_DEVICE'\n | 'CARD_ALREADY_EXISTS';\n };\n error?: undefined;\n }\n | {\n canAddCard?: undefined;\n details?: undefined;\n error: StripeError<GooglePayError>;\n };\n"]}
|
|
@@ -5,8 +5,7 @@ declare class BasicPaymentScreen {
|
|
|
5
5
|
iban?: string;
|
|
6
6
|
buttonText?: string;
|
|
7
7
|
}): void;
|
|
8
|
-
authorize({
|
|
9
|
-
elementType?: string | undefined;
|
|
8
|
+
authorize({ pause }?: {
|
|
10
9
|
pause?: number | undefined;
|
|
11
10
|
}): void;
|
|
12
11
|
checkStatus(status?: string): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PaymentMethod, ApplePay, PaymentSheet, SetupIntent, InitialiseParams, CreatePaymentMethodResult, RetrievePaymentIntentResult, RetrieveSetupIntentResult, ConfirmPaymentResult, HandleNextActionResult, ConfirmSetupIntentResult, CreateTokenForCVCUpdateResult, InitPaymentSheetResult, PresentPaymentSheetResult, ConfirmPaymentSheetPaymentResult, ApplePayResult, CreateTokenResult, GooglePayInitResult, PayWithGooglePayResult, CreateGooglePayPaymentMethodResult, GooglePay, OpenApplePaySetupResult, Token, VerifyMicrodepositsParams, IsCardInWalletResult } from './types';
|
|
1
|
+
import type { PaymentMethod, ApplePay, PaymentSheet, SetupIntent, InitialiseParams, CreatePaymentMethodResult, RetrievePaymentIntentResult, RetrieveSetupIntentResult, ConfirmPaymentResult, HandleNextActionResult, ConfirmSetupIntentResult, CreateTokenForCVCUpdateResult, InitPaymentSheetResult, PresentPaymentSheetResult, ConfirmPaymentSheetPaymentResult, ApplePayResult, CreateTokenResult, GooglePayInitResult, PayWithGooglePayResult, CreateGooglePayPaymentMethodResult, GooglePay, OpenApplePaySetupResult, Token, VerifyMicrodepositsParams, IsCardInWalletResult, CanAddCardToWalletParams, CanAddCardToWalletResult } from './types';
|
|
2
2
|
declare type NativeStripeSdkType = {
|
|
3
3
|
initialise(params: InitialiseParams): Promise<void>;
|
|
4
4
|
createPaymentMethod(params: PaymentMethod.CreateParams, options: PaymentMethod.CreateOptions): Promise<CreatePaymentMethodResult>;
|
|
@@ -33,6 +33,7 @@ declare type NativeStripeSdkType = {
|
|
|
33
33
|
ISSUING: string;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
+
canAddCardToWallet(params: CanAddCardToWalletParams): Promise<CanAddCardToWalletResult>;
|
|
36
37
|
isCardInWallet(params: {
|
|
37
38
|
cardLastFour: string;
|
|
38
39
|
}): Promise<IsCardInWalletResult>;
|
|
@@ -10,7 +10,7 @@ export interface Props extends AccessibilityProps {
|
|
|
10
10
|
/** The image asset to use as the Google Pay button. Downloadable from https://developers.google.com/pay/issuers/apis/push-provisioning/android/downloads/flutter/googlepay_flutter_buttons.zip */
|
|
11
11
|
androidAssetSource: ImageSourcePropType;
|
|
12
12
|
testID?: string;
|
|
13
|
-
/**
|
|
13
|
+
/** iOS only. Set this to `true` until shipping through TestFlight || App Store. If true, you must be using live cards, and have the proper iOS entitlement set up. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#requesting-access-for-ios */
|
|
14
14
|
testEnv?: boolean;
|
|
15
15
|
/** Details of the Issued Card you'd like added to the device's wallet */
|
|
16
16
|
cardDetails: {
|
|
@@ -6,7 +6,10 @@ import { AccessibilityProps, StyleProp, ViewStyle } from 'react-native';
|
|
|
6
6
|
*/
|
|
7
7
|
export interface Props extends AccessibilityProps {
|
|
8
8
|
style?: StyleProp<ViewStyle>;
|
|
9
|
+
/** Controls if a postal code entry field can be displayed to the user. Defaults to false. If true, the type of code entry shown is controlled by the set countryCode prop. Some country codes may result in no postal code entry being shown if those countries do not commonly use postal codes. If false, no postal code entry will ever be displayed. */
|
|
9
10
|
postalCodeEnabled?: boolean;
|
|
11
|
+
/** Controls the postal code entry shown (if the postalCodeEnabled prop is set to true). Defaults to the device's default locale. */
|
|
12
|
+
countryCode?: string;
|
|
10
13
|
cardStyle?: CardFieldInput.Styles;
|
|
11
14
|
placeholders?: CardFieldInput.Placeholders;
|
|
12
15
|
autofocus?: boolean;
|
|
@@ -12,6 +12,8 @@ export interface Props extends AccessibilityProps {
|
|
|
12
12
|
cardStyle?: CardFormView.Styles;
|
|
13
13
|
/** Android only */
|
|
14
14
|
placeholders?: CardFormView.Placeholders;
|
|
15
|
+
/** Android only */
|
|
16
|
+
defaultValues?: CardFormView.DefaultValues;
|
|
15
17
|
onFormComplete?(card: CardFormView.Details): void;
|
|
16
18
|
/**
|
|
17
19
|
* WARNING: If set to `true` the full card number will be returned in the `onFormComplete` handler.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApplePay, ApplePayError, ApplePayResult, 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 } from './types';
|
|
1
|
+
import { ApplePay, ApplePayError, ApplePayResult, 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 } 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>;
|
|
@@ -31,6 +31,7 @@ export declare const createGooglePayPaymentMethod: (params: GooglePay.CreatePaym
|
|
|
31
31
|
export declare const openApplePaySetup: () => Promise<OpenApplePaySetupResult>;
|
|
32
32
|
export declare const collectBankAccountForPayment: (clientSecret: string, params: PaymentMethod.CollectBankAccountParams) => Promise<CollectBankAccountForPaymentResult>;
|
|
33
33
|
export declare const collectBankAccountForSetup: (clientSecret: string, params: PaymentMethod.CollectBankAccountParams) => Promise<CollectBankAccountForSetupResult>;
|
|
34
|
+
export declare const canAddCardToWallet: (params: CanAddCardToWalletParams) => Promise<CanAddCardToWalletResult>;
|
|
34
35
|
export declare const isCardInWallet: (params: {
|
|
35
36
|
cardLastFour: string;
|
|
36
37
|
}) => Promise<IsCardInWalletResult>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PaymentMethod, 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 } from '../types';
|
|
1
|
+
import type { PaymentMethod, 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 } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* useStripe hook
|
|
4
4
|
*/
|
|
@@ -35,4 +35,5 @@ export declare function useStripe(): {
|
|
|
35
35
|
collectBankAccountForSetup: (clientSecret: string, params: PaymentMethod.CollectBankAccountParams) => Promise<CollectBankAccountForSetupResult>;
|
|
36
36
|
verifyMicrodepositsForPayment: (clientSecret: string, params: VerifyMicrodepositsParams) => Promise<VerifyMicrodepositsForPaymentResult>;
|
|
37
37
|
verifyMicrodepositsForSetup: (clientSecret: string, params: VerifyMicrodepositsParams) => Promise<VerifyMicrodepositsForSetupResult>;
|
|
38
|
+
canAddCardToWallet: (params: CanAddCardToWalletParams) => Promise<CanAddCardToWalletResult>;
|
|
38
39
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { BillingDetails } from './Common';
|
|
2
2
|
export declare type SetupParams = ClientSecretParams & GooglePayParams & ApplePayParams & {
|
|
3
|
+
/** Your customer-facing business name. On Android, this is required and cannot be an empty string. */
|
|
4
|
+
merchantDisplayName: string;
|
|
3
5
|
customerId?: string;
|
|
4
6
|
customerEphemeralKeySecret?: string;
|
|
5
7
|
customFlow?: boolean;
|
|
6
|
-
merchantDisplayName?: string;
|
|
7
8
|
style?: 'alwaysLight' | 'alwaysDark' | 'automatic';
|
|
8
9
|
returnURL?: string;
|
|
9
10
|
defaultBillingDetails?: BillingDetails;
|
|
@@ -30,7 +30,8 @@ export interface Card {
|
|
|
30
30
|
address: Address;
|
|
31
31
|
name?: string;
|
|
32
32
|
}
|
|
33
|
-
export declare type CreateParams = CreateCardTokenParams | CreateBankAccountTokenParams;
|
|
33
|
+
export declare type CreateParams = CreateCardTokenParams | CreateBankAccountTokenParams | CreatePiiTokenParams;
|
|
34
|
+
/** Creates a single-use token that represents a credit card’s details. Use this in combination with either the CardField or CardForm components. This token can be used in place of a credit card object with any API method. See https://stripe.com/docs/api/tokens/create_card*/
|
|
34
35
|
export declare type CreateCardTokenParams = {
|
|
35
36
|
type: 'Card';
|
|
36
37
|
address?: Address;
|
|
@@ -39,6 +40,7 @@ export declare type CreateCardTokenParams = {
|
|
|
39
40
|
};
|
|
40
41
|
export declare type BankAcccountHolderType = 'Company' | 'Individual';
|
|
41
42
|
export declare type BankAcccountType = 'Checking' | 'Savings';
|
|
43
|
+
/** Creates a single-use token that represents a bank account’s details. This token can be used with any API method in place of a bank account object. See https://stripe.com/docs/api/tokens/create_bank_account */
|
|
42
44
|
export declare type CreateBankAccountTokenParams = {
|
|
43
45
|
type: 'BankAccount';
|
|
44
46
|
accountHolderName?: string;
|
|
@@ -48,3 +50,9 @@ export declare type CreateBankAccountTokenParams = {
|
|
|
48
50
|
currency: string;
|
|
49
51
|
routingNumber?: string;
|
|
50
52
|
};
|
|
53
|
+
/** Creates a single-use token that represents the details of personally identifiable information (PII). See https://stripe.com/docs/api/tokens/create_pii */
|
|
54
|
+
export declare type CreatePiiTokenParams = {
|
|
55
|
+
type: 'Pii';
|
|
56
|
+
/** The user's personal ID number */
|
|
57
|
+
personalId: string;
|
|
58
|
+
};
|
|
@@ -53,6 +53,7 @@ export interface NativeProps {
|
|
|
53
53
|
value?: Partial<Details>;
|
|
54
54
|
postalCodeEnabled?: boolean;
|
|
55
55
|
autofocus?: boolean;
|
|
56
|
+
countryCode: string | null;
|
|
56
57
|
onCardChange(event: NativeSyntheticEvent<Details>): void;
|
|
57
58
|
onFocusChange(event: NativeSyntheticEvent<{
|
|
58
59
|
focusedField: FieldName | null;
|
|
@@ -37,6 +37,10 @@ export interface Placeholders {
|
|
|
37
37
|
cvc?: string;
|
|
38
38
|
postalCode?: string;
|
|
39
39
|
}
|
|
40
|
+
export declare type DefaultValues = {
|
|
41
|
+
/** The 2-letter country code for the country selected by default on Android. If this is null, it is set by the device's configured region in the Settings app. */
|
|
42
|
+
countryCode?: string;
|
|
43
|
+
};
|
|
40
44
|
/**
|
|
41
45
|
* @ignore
|
|
42
46
|
*/
|
|
@@ -46,6 +50,8 @@ export interface NativeProps {
|
|
|
46
50
|
cardStyle?: Styles;
|
|
47
51
|
/** Android only */
|
|
48
52
|
placeholders?: Placeholders;
|
|
53
|
+
/** Android only */
|
|
54
|
+
defaultValues?: DefaultValues;
|
|
49
55
|
onFocusChange(event: NativeSyntheticEvent<{
|
|
50
56
|
focusedField: FieldName | null;
|
|
51
57
|
}>): void;
|
|
@@ -83,10 +83,7 @@ export declare type InitPaymentSheetResult = {
|
|
|
83
83
|
error: StripeError<PaymentSheetError>;
|
|
84
84
|
};
|
|
85
85
|
export declare type PresentPaymentSheetResult = {
|
|
86
|
-
paymentOption
|
|
87
|
-
error?: undefined;
|
|
88
|
-
} | {
|
|
89
|
-
paymentOption?: PaymentSheet.PaymentOption;
|
|
86
|
+
paymentOption: PaymentSheet.PaymentOption;
|
|
90
87
|
error?: undefined;
|
|
91
88
|
} | {
|
|
92
89
|
paymentOption?: undefined;
|
|
@@ -194,3 +191,23 @@ export declare type IsCardInWalletResult = {
|
|
|
194
191
|
token?: undefined;
|
|
195
192
|
error: StripeError<GooglePayError>;
|
|
196
193
|
};
|
|
194
|
+
export declare type CanAddCardToWalletParams = {
|
|
195
|
+
/** The `primary_account_identifier` value from the issued card. Can be an empty string. */
|
|
196
|
+
primaryAccountIdentifier: string | null;
|
|
197
|
+
/** Last 4 digits of the card number. */
|
|
198
|
+
cardLastFour: string;
|
|
199
|
+
/** iOS only. Set this to `true` until shipping through TestFlight || App Store. If true, you must be using live cards, and have the proper iOS entitlement set up. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#requesting-access-for-ios */
|
|
200
|
+
testEnv?: boolean;
|
|
201
|
+
};
|
|
202
|
+
export declare type CanAddCardToWalletResult = {
|
|
203
|
+
canAddCard: boolean;
|
|
204
|
+
details?: {
|
|
205
|
+
token?: GooglePayCardToken;
|
|
206
|
+
status?: 'MISSING_CONFIGURATION' | 'UNSUPPORTED_DEVICE' | 'CARD_ALREADY_EXISTS';
|
|
207
|
+
};
|
|
208
|
+
error?: undefined;
|
|
209
|
+
} | {
|
|
210
|
+
canAddCard?: undefined;
|
|
211
|
+
details?: undefined;
|
|
212
|
+
error: StripeError<GooglePayError>;
|
|
213
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripe/stripe-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"author": "Stripe",
|
|
5
5
|
"description": "Stripe SDK for React Native",
|
|
6
6
|
"main": "lib/commonjs/index",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"test": "jest",
|
|
23
23
|
"typescript": "tsc --noEmit",
|
|
24
|
-
"lint": "eslint \"**/*.{js,ts,tsx}\" --ignore-pattern \"docs/api-reference/*\" --ignore-
|
|
24
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\" --ignore-pattern \"docs/api-reference/*\" --ignore-path .gitignore",
|
|
25
25
|
"prepare": "bob build",
|
|
26
26
|
"release": "./scripts/publish",
|
|
27
27
|
"example": "yarn --cwd example",
|
|
@@ -31,8 +31,10 @@
|
|
|
31
31
|
"docs": "yarn typedoc ./src/index.tsx --out ./docs/api-reference --tsconfig ./tsconfig.json --readme none",
|
|
32
32
|
"run-example-ios": "cd example;ENVFILE=.env.ci react-native run-ios --configuration Release --simulator \"iPhone 13 (15.2)\"",
|
|
33
33
|
"run-example-android": "cd example;ENVFILE=.env.ci react-native run-android --variant=release",
|
|
34
|
-
"test:ios": "mkdir -p .tmp/screenshots && node ./run-appium-tests.js ios",
|
|
35
|
-
"test:android": "mkdir -p .tmp/screenshots && node ./run-appium-tests.js android"
|
|
34
|
+
"test:e2e:ios": "mkdir -p .tmp/screenshots && node ./run-appium-tests.js ios",
|
|
35
|
+
"test:e2e:android": "mkdir -p .tmp/screenshots && node ./run-appium-tests.js android",
|
|
36
|
+
"test:unit:ios": "xcodebuild test -workspace example/ios/StripeSdkExample.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 13' -scheme UnitTests",
|
|
37
|
+
"test:unit:android": "cd example/android && ./gradlew connectedAndroidTest"
|
|
36
38
|
},
|
|
37
39
|
"keywords": [
|
|
38
40
|
"react-native",
|
package/src/NativeStripeSdk.tsx
CHANGED
|
@@ -25,6 +25,8 @@ import type {
|
|
|
25
25
|
Token,
|
|
26
26
|
VerifyMicrodepositsParams,
|
|
27
27
|
IsCardInWalletResult,
|
|
28
|
+
CanAddCardToWalletParams,
|
|
29
|
+
CanAddCardToWalletResult,
|
|
28
30
|
} from './types';
|
|
29
31
|
|
|
30
32
|
type NativeStripeSdkType = {
|
|
@@ -88,6 +90,9 @@ type NativeStripeSdkType = {
|
|
|
88
90
|
params: PaymentMethod.CollectBankAccountParams
|
|
89
91
|
): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;
|
|
90
92
|
getConstants(): { API_VERSIONS: { CORE: string; ISSUING: string } };
|
|
93
|
+
canAddCardToWallet(
|
|
94
|
+
params: CanAddCardToWalletParams
|
|
95
|
+
): Promise<CanAddCardToWalletResult>;
|
|
91
96
|
isCardInWallet(params: {
|
|
92
97
|
cardLastFour: string;
|
|
93
98
|
}): Promise<IsCardInWalletResult>;
|
|
@@ -27,7 +27,7 @@ export interface Props extends AccessibilityProps {
|
|
|
27
27
|
/** The image asset to use as the Google Pay button. Downloadable from https://developers.google.com/pay/issuers/apis/push-provisioning/android/downloads/flutter/googlepay_flutter_buttons.zip */
|
|
28
28
|
androidAssetSource: ImageSourcePropType;
|
|
29
29
|
testID?: string;
|
|
30
|
-
/**
|
|
30
|
+
/** iOS only. Set this to `true` until shipping through TestFlight || App Store. If true, you must be using live cards, and have the proper iOS entitlement set up. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#requesting-access-for-ios */
|
|
31
31
|
testEnv?: boolean;
|
|
32
32
|
/** Details of the Issued Card you'd like added to the device's wallet */
|
|
33
33
|
cardDetails: {
|
|
@@ -30,7 +30,10 @@ const CardFieldNative =
|
|
|
30
30
|
*/
|
|
31
31
|
export interface Props extends AccessibilityProps {
|
|
32
32
|
style?: StyleProp<ViewStyle>;
|
|
33
|
+
/** Controls if a postal code entry field can be displayed to the user. Defaults to false. If true, the type of code entry shown is controlled by the set countryCode prop. Some country codes may result in no postal code entry being shown if those countries do not commonly use postal codes. If false, no postal code entry will ever be displayed. */
|
|
33
34
|
postalCodeEnabled?: boolean;
|
|
35
|
+
/** Controls the postal code entry shown (if the postalCodeEnabled prop is set to true). Defaults to the device's default locale. */
|
|
36
|
+
countryCode?: string;
|
|
34
37
|
cardStyle?: CardFieldInput.Styles;
|
|
35
38
|
placeholders?: CardFieldInput.Placeholders;
|
|
36
39
|
autofocus?: boolean;
|
|
@@ -74,6 +77,7 @@ export const CardField = forwardRef<CardFieldInput.Methods, Props>(
|
|
|
74
77
|
cardStyle,
|
|
75
78
|
placeholders,
|
|
76
79
|
postalCodeEnabled,
|
|
80
|
+
countryCode,
|
|
77
81
|
...props
|
|
78
82
|
},
|
|
79
83
|
ref
|
|
@@ -175,6 +179,7 @@ export const CardField = forwardRef<CardFieldInput.Methods, Props>(
|
|
|
175
179
|
onCardChange={onCardChangeHandler}
|
|
176
180
|
onFocusChange={onFocusHandler}
|
|
177
181
|
postalCodeEnabled={postalCodeEnabled ?? true}
|
|
182
|
+
countryCode={countryCode ?? null}
|
|
178
183
|
cardStyle={{
|
|
179
184
|
backgroundColor: cardStyle?.backgroundColor,
|
|
180
185
|
borderColor: cardStyle?.borderColor,
|
|
@@ -42,6 +42,8 @@ export interface Props extends AccessibilityProps {
|
|
|
42
42
|
|
|
43
43
|
/** Android only */
|
|
44
44
|
placeholders?: CardFormView.Placeholders;
|
|
45
|
+
/** Android only */
|
|
46
|
+
defaultValues?: CardFormView.DefaultValues;
|
|
45
47
|
// onBlur?(): void;
|
|
46
48
|
// onFocus?(focusedField: CardFormView.FieldNames | null): void;
|
|
47
49
|
onFormComplete?(card: CardFormView.Details): void;
|
|
@@ -81,6 +83,7 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
|
|
|
81
83
|
// onFocus,
|
|
82
84
|
// onBlur,
|
|
83
85
|
placeholders,
|
|
86
|
+
defaultValues,
|
|
84
87
|
...props
|
|
85
88
|
},
|
|
86
89
|
ref
|
|
@@ -185,6 +188,9 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
|
|
|
185
188
|
cvc: placeholders?.cvc,
|
|
186
189
|
postalCode: placeholders?.postalCode,
|
|
187
190
|
}}
|
|
191
|
+
defaultValues={{
|
|
192
|
+
...(defaultValues ?? {}),
|
|
193
|
+
}}
|
|
188
194
|
onFocusChange={onFocusHandler}
|
|
189
195
|
// postalCodeEnabled={postalCodeEnabled}
|
|
190
196
|
{...props}
|
package/src/functions.ts
CHANGED
|
@@ -33,6 +33,8 @@ import {
|
|
|
33
33
|
CollectBankAccountForPaymentResult,
|
|
34
34
|
CollectBankAccountForSetupResult,
|
|
35
35
|
IsCardInWalletResult,
|
|
36
|
+
CanAddCardToWalletParams,
|
|
37
|
+
CanAddCardToWalletResult,
|
|
36
38
|
} from './types';
|
|
37
39
|
|
|
38
40
|
const APPLE_PAY_NOT_SUPPORTED_MESSAGE =
|
|
@@ -406,7 +408,7 @@ export const presentPaymentSheet =
|
|
|
406
408
|
};
|
|
407
409
|
}
|
|
408
410
|
return {
|
|
409
|
-
paymentOption: paymentOption
|
|
411
|
+
paymentOption: paymentOption!,
|
|
410
412
|
};
|
|
411
413
|
} catch (error: any) {
|
|
412
414
|
return {
|
|
@@ -565,6 +567,29 @@ export const collectBankAccountForSetup = async (
|
|
|
565
567
|
}
|
|
566
568
|
};
|
|
567
569
|
|
|
570
|
+
export const canAddCardToWallet = async (
|
|
571
|
+
params: CanAddCardToWalletParams
|
|
572
|
+
): Promise<CanAddCardToWalletResult> => {
|
|
573
|
+
try {
|
|
574
|
+
const { canAddCard, details, error } =
|
|
575
|
+
await NativeStripeSdk.canAddCardToWallet(params);
|
|
576
|
+
|
|
577
|
+
if (error) {
|
|
578
|
+
return {
|
|
579
|
+
error,
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
return {
|
|
583
|
+
canAddCard: canAddCard as boolean,
|
|
584
|
+
details: details,
|
|
585
|
+
};
|
|
586
|
+
} catch (error: any) {
|
|
587
|
+
return {
|
|
588
|
+
error: createError(error),
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
|
|
568
593
|
export const isCardInWallet = async (params: {
|
|
569
594
|
cardLastFour: string;
|
|
570
595
|
}): Promise<IsCardInWalletResult> => {
|
package/src/hooks/useStripe.tsx
CHANGED
|
@@ -28,6 +28,8 @@ import type {
|
|
|
28
28
|
VerifyMicrodepositsForSetupResult,
|
|
29
29
|
CollectBankAccountForSetupResult,
|
|
30
30
|
CollectBankAccountForPaymentResult,
|
|
31
|
+
CanAddCardToWalletParams,
|
|
32
|
+
CanAddCardToWalletResult,
|
|
31
33
|
} from '../types';
|
|
32
34
|
import { useCallback, useEffect, useState } from 'react';
|
|
33
35
|
import { isiOS } from '../helpers';
|
|
@@ -57,6 +59,7 @@ import {
|
|
|
57
59
|
collectBankAccountForSetup,
|
|
58
60
|
verifyMicrodepositsForPayment,
|
|
59
61
|
verifyMicrodepositsForSetup,
|
|
62
|
+
canAddCardToWallet,
|
|
60
63
|
} from '../functions';
|
|
61
64
|
|
|
62
65
|
/**
|
|
@@ -278,6 +281,15 @@ export function useStripe() {
|
|
|
278
281
|
[]
|
|
279
282
|
);
|
|
280
283
|
|
|
284
|
+
const _canAddCardToWallet = useCallback(
|
|
285
|
+
async (
|
|
286
|
+
params: CanAddCardToWalletParams
|
|
287
|
+
): Promise<CanAddCardToWalletResult> => {
|
|
288
|
+
return canAddCardToWallet(params);
|
|
289
|
+
},
|
|
290
|
+
[]
|
|
291
|
+
);
|
|
292
|
+
|
|
281
293
|
return {
|
|
282
294
|
retrievePaymentIntent: _retrievePaymentIntent,
|
|
283
295
|
retrieveSetupIntent: _retrieveSetupIntent,
|
|
@@ -304,5 +316,6 @@ export function useStripe() {
|
|
|
304
316
|
collectBankAccountForSetup: _collectBankAccountForSetup,
|
|
305
317
|
verifyMicrodepositsForPayment: _verifyMicrodepositsForPayment,
|
|
306
318
|
verifyMicrodepositsForSetup: _verifyMicrodepositsForSetup,
|
|
319
|
+
canAddCardToWallet: _canAddCardToWallet,
|
|
307
320
|
};
|
|
308
321
|
}
|
|
@@ -3,10 +3,11 @@ import type { BillingDetails } from './Common';
|
|
|
3
3
|
export type SetupParams = ClientSecretParams &
|
|
4
4
|
GooglePayParams &
|
|
5
5
|
ApplePayParams & {
|
|
6
|
+
/** Your customer-facing business name. On Android, this is required and cannot be an empty string. */
|
|
7
|
+
merchantDisplayName: string;
|
|
6
8
|
customerId?: string;
|
|
7
9
|
customerEphemeralKeySecret?: string;
|
|
8
10
|
customFlow?: boolean;
|
|
9
|
-
merchantDisplayName?: string;
|
|
10
11
|
style?: 'alwaysLight' | 'alwaysDark' | 'automatic';
|
|
11
12
|
returnURL?: string;
|
|
12
13
|
defaultBillingDetails?: BillingDetails;
|
package/src/types/Token.ts
CHANGED
|
@@ -50,8 +50,12 @@ export interface Card {
|
|
|
50
50
|
name?: string;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export type CreateParams =
|
|
53
|
+
export type CreateParams =
|
|
54
|
+
| CreateCardTokenParams
|
|
55
|
+
| CreateBankAccountTokenParams
|
|
56
|
+
| CreatePiiTokenParams;
|
|
54
57
|
|
|
58
|
+
/** Creates a single-use token that represents a credit card’s details. Use this in combination with either the CardField or CardForm components. This token can be used in place of a credit card object with any API method. See https://stripe.com/docs/api/tokens/create_card*/
|
|
55
59
|
export type CreateCardTokenParams = {
|
|
56
60
|
type: 'Card';
|
|
57
61
|
address?: Address;
|
|
@@ -63,6 +67,7 @@ export type BankAcccountHolderType = 'Company' | 'Individual';
|
|
|
63
67
|
|
|
64
68
|
export type BankAcccountType = 'Checking' | 'Savings';
|
|
65
69
|
|
|
70
|
+
/** Creates a single-use token that represents a bank account’s details. This token can be used with any API method in place of a bank account object. See https://stripe.com/docs/api/tokens/create_bank_account */
|
|
66
71
|
export type CreateBankAccountTokenParams = {
|
|
67
72
|
type: 'BankAccount';
|
|
68
73
|
accountHolderName?: string;
|
|
@@ -72,3 +77,10 @@ export type CreateBankAccountTokenParams = {
|
|
|
72
77
|
currency: string;
|
|
73
78
|
routingNumber?: string;
|
|
74
79
|
};
|
|
80
|
+
|
|
81
|
+
/** Creates a single-use token that represents the details of personally identifiable information (PII). See https://stripe.com/docs/api/tokens/create_pii */
|
|
82
|
+
export type CreatePiiTokenParams = {
|
|
83
|
+
type: 'Pii';
|
|
84
|
+
/** The user's personal ID number */
|
|
85
|
+
personalId: string;
|
|
86
|
+
};
|
|
@@ -59,6 +59,7 @@ export interface NativeProps {
|
|
|
59
59
|
value?: Partial<Details>;
|
|
60
60
|
postalCodeEnabled?: boolean;
|
|
61
61
|
autofocus?: boolean;
|
|
62
|
+
countryCode: string | null;
|
|
62
63
|
onCardChange(event: NativeSyntheticEvent<Details>): void;
|
|
63
64
|
onFocusChange(
|
|
64
65
|
event: NativeSyntheticEvent<{ focusedField: FieldName | null }>
|
|
@@ -44,6 +44,11 @@ export interface Placeholders {
|
|
|
44
44
|
postalCode?: string;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
export type DefaultValues = {
|
|
48
|
+
/** The 2-letter country code for the country selected by default on Android. If this is null, it is set by the device's configured region in the Settings app. */
|
|
49
|
+
countryCode?: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
47
52
|
/**
|
|
48
53
|
* @ignore
|
|
49
54
|
*/
|
|
@@ -54,6 +59,8 @@ export interface NativeProps {
|
|
|
54
59
|
cardStyle?: Styles;
|
|
55
60
|
/** Android only */
|
|
56
61
|
placeholders?: Placeholders;
|
|
62
|
+
/** Android only */
|
|
63
|
+
defaultValues?: DefaultValues;
|
|
57
64
|
// postalCodeEnabled: boolean;
|
|
58
65
|
onFocusChange(
|
|
59
66
|
event: NativeSyntheticEvent<{ focusedField: FieldName | null }>
|
package/src/types/index.ts
CHANGED
|
@@ -140,11 +140,7 @@ export type InitPaymentSheetResult =
|
|
|
140
140
|
|
|
141
141
|
export type PresentPaymentSheetResult =
|
|
142
142
|
| {
|
|
143
|
-
paymentOption
|
|
144
|
-
error?: undefined;
|
|
145
|
-
}
|
|
146
|
-
| {
|
|
147
|
-
paymentOption?: PaymentSheet.PaymentOption;
|
|
143
|
+
paymentOption: PaymentSheet.PaymentOption;
|
|
148
144
|
error?: undefined;
|
|
149
145
|
}
|
|
150
146
|
| {
|
|
@@ -299,3 +295,30 @@ export type IsCardInWalletResult =
|
|
|
299
295
|
token?: undefined;
|
|
300
296
|
error: StripeError<GooglePayError>;
|
|
301
297
|
};
|
|
298
|
+
|
|
299
|
+
export type CanAddCardToWalletParams = {
|
|
300
|
+
/** The `primary_account_identifier` value from the issued card. Can be an empty string. */
|
|
301
|
+
primaryAccountIdentifier: string | null;
|
|
302
|
+
/** Last 4 digits of the card number. */
|
|
303
|
+
cardLastFour: string;
|
|
304
|
+
/** iOS only. Set this to `true` until shipping through TestFlight || App Store. If true, you must be using live cards, and have the proper iOS entitlement set up. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#requesting-access-for-ios */
|
|
305
|
+
testEnv?: boolean;
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
export type CanAddCardToWalletResult =
|
|
309
|
+
| {
|
|
310
|
+
canAddCard: boolean;
|
|
311
|
+
details?: {
|
|
312
|
+
token?: GooglePayCardToken;
|
|
313
|
+
status?:
|
|
314
|
+
| 'MISSING_CONFIGURATION'
|
|
315
|
+
| 'UNSUPPORTED_DEVICE'
|
|
316
|
+
| 'CARD_ALREADY_EXISTS';
|
|
317
|
+
};
|
|
318
|
+
error?: undefined;
|
|
319
|
+
}
|
|
320
|
+
| {
|
|
321
|
+
canAddCard?: undefined;
|
|
322
|
+
details?: undefined;
|
|
323
|
+
error: StripeError<GooglePayError>;
|
|
324
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'json'
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
-
stripe_version = '~> 22.
|
|
4
|
+
stripe_version = '~> 22.5.1'
|
|
5
5
|
|
|
6
6
|
Pod::Spec.new do |s|
|
|
7
7
|
s.name = 'stripe-react-native'
|
|
@@ -15,6 +15,11 @@ Pod::Spec.new do |s|
|
|
|
15
15
|
s.source = { git: 'https://github.com/stripe/stripe-react-native.git', tag: s.version.to_s }
|
|
16
16
|
|
|
17
17
|
s.source_files = 'ios/**/*.{h,m,mm,swift}'
|
|
18
|
+
s.exclude_files = 'ios/Tests/'
|
|
19
|
+
|
|
20
|
+
s.test_spec 'Tests' do |test_spec|
|
|
21
|
+
test_spec.source_files = 'ios/Tests/**/*.{m,swift}'
|
|
22
|
+
end
|
|
18
23
|
|
|
19
24
|
s.dependency 'React-Core'
|
|
20
25
|
s.dependency 'Stripe', stripe_version
|