@stripe/stripe-react-native 0.19.0 → 0.21.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 +46 -5
- package/README.md +2 -2
- package/android/build.gradle +1 -2
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +6 -3
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +22 -7
- package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +5 -1
- package/android/src/main/java/com/reactnativestripesdk/GooglePayFragment.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +10 -9
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +11 -4
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +27 -14
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +3 -1
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherFragment.kt +111 -0
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetEvent.kt +28 -0
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +178 -0
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +67 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +3 -1
- package/ios/AddressSheet/AddressSheetUtils.swift +98 -0
- package/ios/AddressSheet/AddressSheetView.swift +131 -0
- package/ios/AddressSheet/AddressSheetViewManager.m +25 -0
- package/ios/AddressSheet/AddressSheetViewManager.swift +19 -0
- package/ios/ApplePayUtils.swift +1 -1
- package/ios/CardFieldView.swift +3 -3
- package/ios/FinancialConnections.swift +23 -22
- package/ios/Mappers.swift +10 -2
- package/ios/PaymentMethodFactory.swift +6 -7
- package/ios/PaymentSheetAppearance.swift +27 -26
- package/ios/{pushprovisioning → PushProvisioning}/AddToWalletButtonManager.m +0 -0
- package/ios/{pushprovisioning → PushProvisioning}/AddToWalletButtonManager.swift +0 -0
- package/ios/{pushprovisioning → PushProvisioning}/AddToWalletButtonView.swift +0 -0
- package/ios/{pushprovisioning → PushProvisioning}/PushProvisioningUtils.swift +0 -0
- package/ios/StripeSdk.m +5 -0
- package/ios/StripeSdk.swift +75 -27
- package/ios/Tests/AddressSheetUtilsTests.swift +279 -0
- package/jest/mock.js +2 -0
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/components/AddressSheet.js +2 -0
- package/lib/commonjs/components/AddressSheet.js.map +1 -0
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.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 +1 -1
- package/lib/commonjs/index.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.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.map +1 -1
- package/lib/module/components/AddressSheet.js +2 -0
- package/lib/module/components/AddressSheet.js.map +1 -0
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/hooks/usePaymentSheet.js +1 -1
- package/lib/module/hooks/usePaymentSheet.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 +1 -1
- package/lib/module/index.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.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 +1 -0
- package/lib/typescript/src/components/AddressSheet.d.ts +53 -0
- package/lib/typescript/src/functions.d.ts +6 -0
- package/lib/typescript/src/hooks/usePaymentSheet.d.ts +6 -0
- package/lib/typescript/src/hooks/useStripe.d.ts +6 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/types/Common.d.ts +12 -0
- package/lib/typescript/src/types/Errors.d.ts +4 -0
- package/lib/typescript/src/types/FinancialConnections.d.ts +2 -2
- package/lib/typescript/src/types/PaymentMethod.d.ts +2 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts +24 -1
- package/lib/typescript/src/types/index.d.ts +3 -6
- package/package.json +1 -1
- package/src/NativeStripeSdk.tsx +1 -0
- package/src/components/AddressSheet.tsx +82 -0
- package/src/functions.ts +9 -0
- package/src/hooks/usePaymentSheet.tsx +14 -0
- package/src/hooks/useStripe.tsx +11 -0
- package/src/index.tsx +4 -1
- package/src/types/Common.ts +13 -0
- package/src/types/Errors.ts +5 -0
- package/src/types/FinancialConnections.ts +4 -4
- package/src/types/PaymentMethod.ts +2 -0
- package/src/types/PaymentSheet.ts +26 -1
- package/src/types/index.ts +5 -10
- package/stripe-react-native.podspec +6 -2
- 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 +0 -2
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/gradle.xml +0 -13
- package/android/.idea/misc.xml +0 -9
- package/android/.idea/modules/android.iml +0 -18
- package/android/.idea/modules.xml +0 -8
- package/android/.idea/vcs.xml +0 -6
- package/android/local.properties +0 -8
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcuserdata/charliecruzan.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/StripeSdk.xcodeproj/xcuserdata/charliecruzan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -22
- package/ios/StripeSdk.xcodeproj/xcuserdata/charliecruzan.xcuserdatad/xcschemes/xcschememanagement.plist +0 -27
|
@@ -38,4 +38,10 @@ export declare function useStripe(): {
|
|
|
38
38
|
canAddCardToWallet: (params: CanAddCardToWalletParams) => Promise<CanAddCardToWalletResult>;
|
|
39
39
|
collectBankAccountToken: (clientSecret: string) => Promise<FinancialConnections.TokenResult>;
|
|
40
40
|
collectFinancialConnectionsAccounts: (clientSecret: string) => Promise<FinancialConnections.SessionResult>;
|
|
41
|
+
/**
|
|
42
|
+
* You must call this method when the user logs out from your app. This will ensure that
|
|
43
|
+
* any persisted authentication state in the PaymentSheet, such as authentication cookies,
|
|
44
|
+
* is also cleared during logout.
|
|
45
|
+
*/
|
|
46
|
+
resetPaymentSheetCustomer: () => Promise<null>;
|
|
41
47
|
};
|
|
@@ -13,5 +13,6 @@ export { AuBECSDebitForm, Props as AuBECSDebitFormProps, } from './components/Au
|
|
|
13
13
|
export { StripeContainer, Props as StripeContainerProps, } from './components/StripeContainer';
|
|
14
14
|
export { GooglePayButton, Props as GooglePayButtonProps, } from './components/GooglePayButton';
|
|
15
15
|
export { AddToWalletButton, Props as AddToWalletButtonProps, } from './components/AddToWalletButton';
|
|
16
|
+
export { AddressSheet, Props as AddressSheetProps, } from './components/AddressSheet';
|
|
16
17
|
export * from './functions';
|
|
17
18
|
export * from './types/index';
|
|
@@ -12,3 +12,15 @@ export interface Address {
|
|
|
12
12
|
postalCode?: string;
|
|
13
13
|
state?: string;
|
|
14
14
|
}
|
|
15
|
+
export declare type AddressDetails = {
|
|
16
|
+
/** The customer's full name. */
|
|
17
|
+
name?: string;
|
|
18
|
+
/** The customer's address. */
|
|
19
|
+
address?: Address;
|
|
20
|
+
/** The customer's phone number. */
|
|
21
|
+
phone?: string;
|
|
22
|
+
/** Whether or not the checkbox is initally selected. Defaults to false.
|
|
23
|
+
* Note: The checkbox is displayed below the other fields when additionalFields.checkboxLabel is set.
|
|
24
|
+
* */
|
|
25
|
+
isCheckboxSelected?: boolean;
|
|
26
|
+
};
|
|
@@ -69,8 +69,8 @@ export declare type Account = {
|
|
|
69
69
|
export declare type AccountStatus = 'active' | 'inactive' | 'disconnected';
|
|
70
70
|
export declare type Category = 'cash' | 'credit' | 'investment' | 'other';
|
|
71
71
|
export declare type PaymentMethodType = 'us_bank_account' | 'link';
|
|
72
|
-
export declare type Subcategory = 'checking' | '
|
|
73
|
-
export declare type Permission = 'balances' | 'ownership' | '
|
|
72
|
+
export declare type Subcategory = 'checking' | 'creditCard' | 'lineOfCredit' | 'mortgage' | 'other' | 'savings';
|
|
73
|
+
export declare type Permission = 'balances' | 'ownership' | 'paymentMethod' | 'transactions' | 'accountNumbers';
|
|
74
74
|
export declare type Balance = {
|
|
75
75
|
/** The UNIX timestamp (in milliseconds) of time that the external institution calculated this balance. */
|
|
76
76
|
asOf: number;
|
|
@@ -1,20 +1,43 @@
|
|
|
1
|
-
import type { BillingDetails } from './Common';
|
|
1
|
+
import type { BillingDetails, AddressDetails } from './Common';
|
|
2
2
|
import type { CartSummaryItem } from './ApplePay';
|
|
3
3
|
export declare type SetupParams = ClientSecretParams & {
|
|
4
4
|
/** Your customer-facing business name. On Android, this is required and cannot be an empty string. */
|
|
5
5
|
merchantDisplayName: string;
|
|
6
|
+
/** The identifier of the Stripe Customer object. See https://stripe.com/docs/api/customers/object#customer_object-id */
|
|
6
7
|
customerId?: string;
|
|
8
|
+
/** A short-lived token that allows the SDK to access a Customer’s payment methods. */
|
|
7
9
|
customerEphemeralKeySecret?: string;
|
|
10
|
+
/** When set to true, separates out the payment method selection & confirmation steps.
|
|
11
|
+
* If true, you must call `confirmPaymentSheetPayment` on your own. Defaults to false. */
|
|
8
12
|
customFlow?: boolean;
|
|
9
13
|
/** iOS only. Enable Apple Pay in the Payment Sheet by passing an ApplePayParams object. */
|
|
10
14
|
applePay?: ApplePayParams;
|
|
11
15
|
/** Android only. Enable Google Pay in the Payment Sheet by passing a GooglePayParams object. */
|
|
12
16
|
googlePay?: GooglePayParams;
|
|
17
|
+
/** The color styling to use for PaymentSheet UI. Defaults to 'automatic'. */
|
|
13
18
|
style?: 'alwaysLight' | 'alwaysDark' | 'automatic';
|
|
19
|
+
/** A URL that redirects back to your app that PaymentSheet can use to auto-dismiss web views used for additional authentication, e.g. 3DS2 */
|
|
14
20
|
returnURL?: string;
|
|
21
|
+
/** PaymentSheet pre-populates the billing fields with the values provided. */
|
|
15
22
|
defaultBillingDetails?: BillingDetails;
|
|
23
|
+
/**
|
|
24
|
+
* The shipping information for the customer. If set, PaymentSheet will pre-populate the form fields with the values provided.
|
|
25
|
+
* This is used to display a "Billing address is same as shipping" checkbox if `defaultBillingDetails` is not provided.
|
|
26
|
+
* If `name` and `line1` are populated, it's also [attached to the PaymentIntent](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-shipping) during payment.
|
|
27
|
+
*/
|
|
28
|
+
defaultShippingDetails?: AddressDetails;
|
|
29
|
+
/** If true, allows payment methods that do not move money at the end of the checkout. Defaults to false.
|
|
30
|
+
*
|
|
31
|
+
* Some payment methods can’t guarantee you will receive funds from your customer at the end of the checkout
|
|
32
|
+
* because they take time to settle (eg. most bank debits, like SEPA or ACH) or require customer action to
|
|
33
|
+
* complete (e.g. OXXO, Konbini, Boleto). If this is set to true, make sure your integration listens to webhooks
|
|
34
|
+
* for notifications on whether a payment has succeeded or not.
|
|
35
|
+
*/
|
|
16
36
|
allowsDelayedPaymentMethods?: boolean;
|
|
37
|
+
/** Customizes the appearance of PaymentSheet */
|
|
17
38
|
appearance?: AppearanceParams;
|
|
39
|
+
/** The label to use for the primary button. If not set, Payment Sheet will display suitable default labels for payment and setup intents. */
|
|
40
|
+
primaryButtonLabel?: string;
|
|
18
41
|
};
|
|
19
42
|
export declare type ClientSecretParams = {
|
|
20
43
|
paymentIntentClientSecret: string;
|
|
@@ -14,7 +14,7 @@ import * as Token from './Token';
|
|
|
14
14
|
import * as FinancialConnections from './FinancialConnections';
|
|
15
15
|
export { ApplePay, PaymentIntent, PaymentMethod, PaymentSheet, SetupIntent, ThreeDSecure, GooglePay, ApplePayButtonComponent, AuBECSDebitFormComponent, CardFieldInput, CardFormView, Token, FinancialConnections, };
|
|
16
16
|
export * from './Errors';
|
|
17
|
-
export { Address, BillingDetails } from './Common';
|
|
17
|
+
export { Address, BillingDetails, AddressDetails } from './Common';
|
|
18
18
|
/**
|
|
19
19
|
* @ignore
|
|
20
20
|
*/
|
|
@@ -84,11 +84,8 @@ export declare type InitPaymentSheetResult = {
|
|
|
84
84
|
error: StripeError<PaymentSheetError>;
|
|
85
85
|
};
|
|
86
86
|
export declare type PresentPaymentSheetResult = {
|
|
87
|
-
paymentOption
|
|
88
|
-
error?: undefined;
|
|
89
|
-
} | {
|
|
90
|
-
paymentOption?: undefined;
|
|
91
|
-
error: StripeError<PaymentSheetError>;
|
|
87
|
+
paymentOption?: PaymentSheet.PaymentOption | undefined;
|
|
88
|
+
error?: StripeError<PaymentSheetError> | undefined;
|
|
92
89
|
};
|
|
93
90
|
export declare type CreateTokenResult = {
|
|
94
91
|
token: Token.Result;
|
package/package.json
CHANGED
package/src/NativeStripeSdk.tsx
CHANGED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
AccessibilityProps,
|
|
4
|
+
requireNativeComponent,
|
|
5
|
+
NativeSyntheticEvent,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
import type {
|
|
8
|
+
PaymentSheet,
|
|
9
|
+
AddressDetails,
|
|
10
|
+
StripeError,
|
|
11
|
+
AddressSheetError,
|
|
12
|
+
} from '../types';
|
|
13
|
+
|
|
14
|
+
const AddressSheetNative = requireNativeComponent<any>('AddressSheetView');
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Props
|
|
18
|
+
*/
|
|
19
|
+
export interface Props extends AccessibilityProps {
|
|
20
|
+
/** Whether the sheet is visible. Defaults to false. */
|
|
21
|
+
visible: boolean;
|
|
22
|
+
/** Controls how the modal is presented (after animation). iOS only. Defaults to `popover`. */
|
|
23
|
+
presentationStyle?: 'fullscreen' | 'popover';
|
|
24
|
+
/** Controls how the modal animates. iOS only. */
|
|
25
|
+
animationStyle?: 'flip' | 'curl' | 'slide' | 'dissolve';
|
|
26
|
+
/** Configuration for the look and feel of the UI. */
|
|
27
|
+
appearance?: PaymentSheet.AppearanceParams;
|
|
28
|
+
/** The values to prepopulate the sheet's fields with. */
|
|
29
|
+
defaultValues?: AddressDetails;
|
|
30
|
+
/** Configuration for additional fields besides the physical address */
|
|
31
|
+
additionalFields?: {
|
|
32
|
+
/** Determines whether the phone number is hidden, required, or optional. Defaults to hidden. */
|
|
33
|
+
phoneNumber?: 'hidden' | 'optional' | 'required';
|
|
34
|
+
/** The label of a checkbox displayed below other fields. If null or undefined, the checkbox is not displayed. */
|
|
35
|
+
checkboxLabel?: string;
|
|
36
|
+
};
|
|
37
|
+
/** A list of two-letter country codes representing countries the customers can select. If the list is empty (the default), we display all countries. */
|
|
38
|
+
allowedCountries?: Array<string>;
|
|
39
|
+
/** A list of two-letter country codes representing countries that support address autocomplete. Defaults to a list of countries that Stripe has audited to ensure a good autocomplete experience. */
|
|
40
|
+
autocompleteCountries?: Array<string>;
|
|
41
|
+
/** The title of the primary button displayed at the bottom of the screen. Defaults to "Save Address". */
|
|
42
|
+
primaryButtonTitle?: string;
|
|
43
|
+
/** Title displayed at the top of the sheet. Defaults to "Address". */
|
|
44
|
+
sheetTitle?: string;
|
|
45
|
+
/** Android only. Google Places api key used to provide autocomplete suggestions. When null, autocomplete is disabled on Android. */
|
|
46
|
+
googlePlacesApiKey?: string;
|
|
47
|
+
/** Called when the user submits their information */
|
|
48
|
+
onSubmit: (result: CollectAddressResult) => void;
|
|
49
|
+
/** Called when the user taps the button to close the sheet before submitting their information, or when an error occurs. */
|
|
50
|
+
onError: (error: StripeError<AddressSheetError>) => void;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type CollectAddressResult = Required<AddressDetails>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* <AddressSheet
|
|
61
|
+
*
|
|
62
|
+
* />
|
|
63
|
+
* ```
|
|
64
|
+
* @param __namedParameters Props
|
|
65
|
+
* @returns JSX.Element
|
|
66
|
+
* @category ReactComponents
|
|
67
|
+
*/
|
|
68
|
+
export function AddressSheet({ onSubmit, onError, ...props }: Props) {
|
|
69
|
+
return (
|
|
70
|
+
<AddressSheetNative
|
|
71
|
+
{...props}
|
|
72
|
+
onSubmitAction={(value: NativeSyntheticEvent<CollectAddressResult>) =>
|
|
73
|
+
onSubmit(value.nativeEvent)
|
|
74
|
+
}
|
|
75
|
+
onErrorAction={(
|
|
76
|
+
value: NativeSyntheticEvent<{
|
|
77
|
+
error: StripeError<AddressSheetError>;
|
|
78
|
+
}>
|
|
79
|
+
) => onError(value.nativeEvent.error)}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
}
|
package/src/functions.ts
CHANGED
|
@@ -455,6 +455,15 @@ export const confirmPaymentSheetPayment =
|
|
|
455
455
|
}
|
|
456
456
|
};
|
|
457
457
|
|
|
458
|
+
/**
|
|
459
|
+
* You must call this method when the user logs out from your app. This will ensure that
|
|
460
|
+
* any persisted authentication state in the PaymentSheet, such as authentication cookies,
|
|
461
|
+
* is also cleared during logout.
|
|
462
|
+
*/
|
|
463
|
+
export const resetPaymentSheetCustomer = async (): Promise<null> => {
|
|
464
|
+
return await NativeStripeSdk.resetPaymentSheetCustomer();
|
|
465
|
+
};
|
|
466
|
+
|
|
458
467
|
export const isGooglePaySupported = async (
|
|
459
468
|
params?: GooglePay.IsSupportedParams
|
|
460
469
|
): Promise<boolean> => {
|
|
@@ -10,6 +10,7 @@ export function usePaymentSheet() {
|
|
|
10
10
|
initPaymentSheet: initPaymentSheetNative,
|
|
11
11
|
presentPaymentSheet: presentPaymentSheetNative,
|
|
12
12
|
confirmPaymentSheetPayment: confirmPaymentSheetPaymentNative,
|
|
13
|
+
resetPaymentSheetCustomer: resetPaymentSheetCustomerNative,
|
|
13
14
|
} = useStripe();
|
|
14
15
|
const [loading, setLoading] = useState(false);
|
|
15
16
|
|
|
@@ -34,10 +35,23 @@ export function usePaymentSheet() {
|
|
|
34
35
|
return result;
|
|
35
36
|
};
|
|
36
37
|
|
|
38
|
+
const resetPaymentSheetCustomer = async () => {
|
|
39
|
+
setLoading(true);
|
|
40
|
+
const result = await resetPaymentSheetCustomerNative();
|
|
41
|
+
setLoading(false);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
|
|
37
45
|
return {
|
|
38
46
|
loading,
|
|
39
47
|
initPaymentSheet,
|
|
40
48
|
presentPaymentSheet,
|
|
41
49
|
confirmPaymentSheetPayment,
|
|
50
|
+
/**
|
|
51
|
+
* You must call this method when the user logs out from your app. This will ensure that
|
|
52
|
+
* any persisted authentication state in the PaymentSheet, such as authentication cookies,
|
|
53
|
+
* is also cleared during logout.
|
|
54
|
+
*/
|
|
55
|
+
resetPaymentSheetCustomer,
|
|
42
56
|
};
|
|
43
57
|
}
|
package/src/hooks/useStripe.tsx
CHANGED
|
@@ -64,6 +64,7 @@ import {
|
|
|
64
64
|
canAddCardToWallet,
|
|
65
65
|
collectBankAccountToken,
|
|
66
66
|
collectFinancialConnectionsAccounts,
|
|
67
|
+
resetPaymentSheetCustomer,
|
|
67
68
|
} from '../functions';
|
|
68
69
|
|
|
69
70
|
/**
|
|
@@ -311,6 +312,10 @@ export function useStripe() {
|
|
|
311
312
|
[]
|
|
312
313
|
);
|
|
313
314
|
|
|
315
|
+
const _resetPaymentSheetCustomer = useCallback(async (): Promise<null> => {
|
|
316
|
+
return resetPaymentSheetCustomer();
|
|
317
|
+
}, []);
|
|
318
|
+
|
|
314
319
|
return {
|
|
315
320
|
retrievePaymentIntent: _retrievePaymentIntent,
|
|
316
321
|
retrieveSetupIntent: _retrieveSetupIntent,
|
|
@@ -340,5 +345,11 @@ export function useStripe() {
|
|
|
340
345
|
canAddCardToWallet: _canAddCardToWallet,
|
|
341
346
|
collectBankAccountToken: _collectBankAccountToken,
|
|
342
347
|
collectFinancialConnectionsAccounts: _collectFinancialConnectionsAccounts,
|
|
348
|
+
/**
|
|
349
|
+
* You must call this method when the user logs out from your app. This will ensure that
|
|
350
|
+
* any persisted authentication state in the PaymentSheet, such as authentication cookies,
|
|
351
|
+
* is also cleared during logout.
|
|
352
|
+
*/
|
|
353
|
+
resetPaymentSheetCustomer: _resetPaymentSheetCustomer,
|
|
343
354
|
};
|
|
344
355
|
}
|
package/src/index.tsx
CHANGED
|
@@ -35,7 +35,10 @@ export {
|
|
|
35
35
|
AddToWalletButton,
|
|
36
36
|
Props as AddToWalletButtonProps,
|
|
37
37
|
} from './components/AddToWalletButton';
|
|
38
|
-
|
|
38
|
+
export {
|
|
39
|
+
AddressSheet,
|
|
40
|
+
Props as AddressSheetProps,
|
|
41
|
+
} from './components/AddressSheet';
|
|
39
42
|
export * from './functions';
|
|
40
43
|
|
|
41
44
|
export * from './types/index';
|
package/src/types/Common.ts
CHANGED
|
@@ -13,3 +13,16 @@ export interface Address {
|
|
|
13
13
|
postalCode?: string;
|
|
14
14
|
state?: string;
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
export type AddressDetails = {
|
|
18
|
+
/** The customer's full name. */
|
|
19
|
+
name?: string;
|
|
20
|
+
/** The customer's address. */
|
|
21
|
+
address?: Address;
|
|
22
|
+
/** The customer's phone number. */
|
|
23
|
+
phone?: string;
|
|
24
|
+
/** Whether or not the checkbox is initally selected. Defaults to false.
|
|
25
|
+
* Note: The checkbox is displayed below the other fields when additionalFields.checkboxLabel is set.
|
|
26
|
+
* */
|
|
27
|
+
isCheckboxSelected?: boolean;
|
|
28
|
+
};
|
package/src/types/Errors.ts
CHANGED
|
@@ -84,8 +84,8 @@ export type PaymentMethodType = 'us_bank_account' | 'link';
|
|
|
84
84
|
|
|
85
85
|
export type Subcategory =
|
|
86
86
|
| 'checking'
|
|
87
|
-
| '
|
|
88
|
-
| '
|
|
87
|
+
| 'creditCard'
|
|
88
|
+
| 'lineOfCredit'
|
|
89
89
|
| 'mortgage'
|
|
90
90
|
| 'other'
|
|
91
91
|
| 'savings';
|
|
@@ -93,9 +93,9 @@ export type Subcategory =
|
|
|
93
93
|
export type Permission =
|
|
94
94
|
| 'balances'
|
|
95
95
|
| 'ownership'
|
|
96
|
-
| '
|
|
96
|
+
| 'paymentMethod'
|
|
97
97
|
| 'transactions'
|
|
98
|
-
| '
|
|
98
|
+
| 'accountNumbers';
|
|
99
99
|
|
|
100
100
|
export type Balance = {
|
|
101
101
|
/** The UNIX timestamp (in milliseconds) of time that the external institution calculated this balance. */
|
|
@@ -1,21 +1,44 @@
|
|
|
1
|
-
import type { BillingDetails } from './Common';
|
|
1
|
+
import type { BillingDetails, AddressDetails } from './Common';
|
|
2
2
|
import type { CartSummaryItem } from './ApplePay';
|
|
3
3
|
|
|
4
4
|
export type SetupParams = ClientSecretParams & {
|
|
5
5
|
/** Your customer-facing business name. On Android, this is required and cannot be an empty string. */
|
|
6
6
|
merchantDisplayName: string;
|
|
7
|
+
/** The identifier of the Stripe Customer object. See https://stripe.com/docs/api/customers/object#customer_object-id */
|
|
7
8
|
customerId?: string;
|
|
9
|
+
/** A short-lived token that allows the SDK to access a Customer’s payment methods. */
|
|
8
10
|
customerEphemeralKeySecret?: string;
|
|
11
|
+
/** When set to true, separates out the payment method selection & confirmation steps.
|
|
12
|
+
* If true, you must call `confirmPaymentSheetPayment` on your own. Defaults to false. */
|
|
9
13
|
customFlow?: boolean;
|
|
10
14
|
/** iOS only. Enable Apple Pay in the Payment Sheet by passing an ApplePayParams object. */
|
|
11
15
|
applePay?: ApplePayParams;
|
|
12
16
|
/** Android only. Enable Google Pay in the Payment Sheet by passing a GooglePayParams object. */
|
|
13
17
|
googlePay?: GooglePayParams;
|
|
18
|
+
/** The color styling to use for PaymentSheet UI. Defaults to 'automatic'. */
|
|
14
19
|
style?: 'alwaysLight' | 'alwaysDark' | 'automatic';
|
|
20
|
+
/** A URL that redirects back to your app that PaymentSheet can use to auto-dismiss web views used for additional authentication, e.g. 3DS2 */
|
|
15
21
|
returnURL?: string;
|
|
22
|
+
/** PaymentSheet pre-populates the billing fields with the values provided. */
|
|
16
23
|
defaultBillingDetails?: BillingDetails;
|
|
24
|
+
/**
|
|
25
|
+
* The shipping information for the customer. If set, PaymentSheet will pre-populate the form fields with the values provided.
|
|
26
|
+
* This is used to display a "Billing address is same as shipping" checkbox if `defaultBillingDetails` is not provided.
|
|
27
|
+
* If `name` and `line1` are populated, it's also [attached to the PaymentIntent](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-shipping) during payment.
|
|
28
|
+
*/
|
|
29
|
+
defaultShippingDetails?: AddressDetails;
|
|
30
|
+
/** If true, allows payment methods that do not move money at the end of the checkout. Defaults to false.
|
|
31
|
+
*
|
|
32
|
+
* Some payment methods can’t guarantee you will receive funds from your customer at the end of the checkout
|
|
33
|
+
* because they take time to settle (eg. most bank debits, like SEPA or ACH) or require customer action to
|
|
34
|
+
* complete (e.g. OXXO, Konbini, Boleto). If this is set to true, make sure your integration listens to webhooks
|
|
35
|
+
* for notifications on whether a payment has succeeded or not.
|
|
36
|
+
*/
|
|
17
37
|
allowsDelayedPaymentMethods?: boolean;
|
|
38
|
+
/** Customizes the appearance of PaymentSheet */
|
|
18
39
|
appearance?: AppearanceParams;
|
|
40
|
+
/** The label to use for the primary button. If not set, Payment Sheet will display suitable default labels for payment and setup intents. */
|
|
41
|
+
primaryButtonLabel?: string;
|
|
19
42
|
};
|
|
20
43
|
|
|
21
44
|
export type ClientSecretParams =
|
|
@@ -35,6 +58,8 @@ export type ApplePayParams = {
|
|
|
35
58
|
* An array of CartSummaryItem item objects that summarize the amount of the payment. If you're using a SetupIntent
|
|
36
59
|
* for a recurring payment, you should set this to display the amount you intend to charge. */
|
|
37
60
|
paymentSummaryItems?: CartSummaryItem[];
|
|
61
|
+
// TODO: Uncomment when https://github.com/stripe/stripe-react-native/pull/1164 lands
|
|
62
|
+
// buttonType: ButtonType
|
|
38
63
|
};
|
|
39
64
|
|
|
40
65
|
export type GooglePayParams = {
|
package/src/types/index.ts
CHANGED
|
@@ -44,7 +44,7 @@ export {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
export * from './Errors';
|
|
47
|
-
export { Address, BillingDetails } from './Common';
|
|
47
|
+
export { Address, BillingDetails, AddressDetails } from './Common';
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* @ignore
|
|
@@ -140,15 +140,10 @@ export type InitPaymentSheetResult =
|
|
|
140
140
|
error: StripeError<PaymentSheetError>;
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
-
export type PresentPaymentSheetResult =
|
|
144
|
-
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
| {
|
|
149
|
-
paymentOption?: undefined;
|
|
150
|
-
error: StripeError<PaymentSheetError>;
|
|
151
|
-
};
|
|
143
|
+
export type PresentPaymentSheetResult = {
|
|
144
|
+
paymentOption?: PaymentSheet.PaymentOption | undefined;
|
|
145
|
+
error?: StripeError<PaymentSheetError> | undefined;
|
|
146
|
+
};
|
|
152
147
|
|
|
153
148
|
export type CreateTokenResult =
|
|
154
149
|
| {
|
|
@@ -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 = '~>
|
|
4
|
+
stripe_version = '~> 23.2.0'
|
|
5
5
|
|
|
6
6
|
Pod::Spec.new do |s|
|
|
7
7
|
s.name = 'stripe-react-native'
|
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.license = package['license']
|
|
12
12
|
s.authors = package['author']
|
|
13
13
|
|
|
14
|
-
s.platforms = { ios: '
|
|
14
|
+
s.platforms = { ios: '13.0' }
|
|
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}'
|
|
@@ -23,5 +23,9 @@ Pod::Spec.new do |s|
|
|
|
23
23
|
|
|
24
24
|
s.dependency 'React-Core'
|
|
25
25
|
s.dependency 'Stripe', stripe_version
|
|
26
|
+
s.dependency 'StripePaymentSheet', stripe_version
|
|
27
|
+
s.dependency 'StripePayments', stripe_version
|
|
28
|
+
s.dependency 'StripePaymentsUI', stripe_version
|
|
29
|
+
s.dependency 'StripeApplePay', stripe_version
|
|
26
30
|
s.dependency 'StripeFinancialConnections', stripe_version
|
|
27
31
|
end
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
package/android/.idea/gradle.xml
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="GradleMigrationSettings" migrationVersion="1" />
|
|
4
|
-
<component name="GradleSettings">
|
|
5
|
-
<option name="linkedExternalProjectsSettings">
|
|
6
|
-
<GradleProjectSettings>
|
|
7
|
-
<option name="testRunner" value="GRADLE" />
|
|
8
|
-
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
9
|
-
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
10
|
-
</GradleProjectSettings>
|
|
11
|
-
</option>
|
|
12
|
-
</component>
|
|
13
|
-
</project>
|
package/android/.idea/misc.xml
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectRootManager" version="2" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
|
|
4
|
-
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
5
|
-
</component>
|
|
6
|
-
<component name="ProjectType">
|
|
7
|
-
<option name="id" value="Android" />
|
|
8
|
-
</component>
|
|
9
|
-
</project>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module external.linked.project.id=":" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
|
3
|
-
<component name="FacetManager">
|
|
4
|
-
<facet type="android-gradle" name="Android-Gradle">
|
|
5
|
-
<configuration>
|
|
6
|
-
<option name="GRADLE_PROJECT_PATH" value=":" />
|
|
7
|
-
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" />
|
|
8
|
-
<option name="LAST_KNOWN_AGP_VERSION" />
|
|
9
|
-
</configuration>
|
|
10
|
-
</facet>
|
|
11
|
-
</component>
|
|
12
|
-
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
13
|
-
<exclude-output />
|
|
14
|
-
<content url="file://$MODULE_DIR$/../.." />
|
|
15
|
-
<orderEntry type="inheritedJdk" />
|
|
16
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
17
|
-
</component>
|
|
18
|
-
</module>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/modules/android.iml" filepath="$PROJECT_DIR$/.idea/modules/android.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
package/android/.idea/vcs.xml
DELETED
package/android/local.properties
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
## This file must *NOT* be checked into Version Control Systems,
|
|
2
|
-
# as it contains information specific to your local configuration.
|
|
3
|
-
#
|
|
4
|
-
# Location of the SDK. This is only used by Gradle.
|
|
5
|
-
# For customization when using a Version Control System, please read the
|
|
6
|
-
# header note.
|
|
7
|
-
#Tue Jun 21 15:53:06 EDT 2022
|
|
8
|
-
sdk.dir=/Users/charliecruzan/Library/Android/sdk
|