@stripe/stripe-react-native 0.55.0 → 0.56.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/android/.idea/AndroidProjectSystem.xml +6 -0
- package/android/.idea/caches/deviceStreaming.xml +703 -0
- package/android/.idea/compiler.xml +6 -0
- package/android/.idea/gradle.xml +18 -0
- package/android/.idea/migrations.xml +10 -0
- package/android/.idea/misc.xml +10 -0
- package/android/.idea/runConfigurations.xml +17 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/gradle.properties +1 -1
- package/android/local.properties +8 -0
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +120 -57
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +5 -0
- package/android/src/main/java/com/reactnativestripesdk/EventEmitterCompat.kt +12 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +1 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +54 -8
- package/android/src/main/java/com/reactnativestripesdk/StripeAbstractComposeView.kt +3 -2
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +64 -0
- package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetFragment.kt +72 -34
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerSessionProvider.kt +37 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +84 -1
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerDelegate.java +12 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerInterface.java +4 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +12 -64
- package/ios/ApplePayButtonManager.m +1 -1
- package/ios/ApplePayButtonView.swift +2 -2
- package/ios/Mappers.swift +111 -18
- package/ios/NewArch/ApplePayButtonComponentView.mm +1 -1
- package/ios/OldArch/StripeSdkEventEmitterCompat.h +3 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.m +18 -0
- package/ios/StripeSdk.mm +21 -0
- package/ios/StripeSdkEmitter.swift +3 -0
- package/ios/StripeSdkImpl+CustomerSheet.swift +70 -19
- package/ios/StripeSdkImpl+Embedded.swift +26 -4
- package/ios/StripeSdkImpl+PaymentSheet.swift +46 -15
- package/ios/StripeSdkImpl.swift +21 -2
- 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/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/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/events.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js.map +1 -1
- package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/commonjs/types/ConfirmationToken.js +2 -0
- package/lib/commonjs/types/ConfirmationToken.js.map +1 -0
- package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types/index.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/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/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/events.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeApplePayButton.js +1 -1
- package/lib/module/specs/NativeApplePayButton.js.map +1 -1
- package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/module/types/ConfirmationToken.js +2 -0
- package/lib/module/types/ConfirmationToken.js.map +1 -0
- package/lib/module/types/EmbeddedPaymentElement.js +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/module/types/PaymentSheet.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/components/CustomerSheet.d.ts +1 -1
- package/lib/typescript/src/components/CustomerSheet.d.ts.map +1 -1
- package/lib/typescript/src/events.d.ts +6 -0
- package/lib/typescript/src/events.d.ts.map +1 -1
- package/lib/typescript/src/functions.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeApplePayButton.d.ts +1 -1
- package/lib/typescript/src/specs/NativeApplePayButton.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +4 -1
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/ConfirmationToken.d.ts +56 -0
- package/lib/typescript/src/types/ConfirmationToken.d.ts.map +1 -0
- package/lib/typescript/src/types/CustomerSheet.d.ts +70 -12
- package/lib/typescript/src/types/CustomerSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +2 -4
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +26 -4
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +2 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/CustomerSheet.tsx +65 -9
- package/src/components/PlatformPayButton.tsx +1 -1
- package/src/events.ts +6 -0
- package/src/functions.ts +16 -0
- package/src/index.tsx +1 -0
- package/src/specs/NativeApplePayButton.ts +1 -1
- package/src/specs/NativeStripeSdkModule.ts +10 -0
- package/src/types/ConfirmationToken.ts +73 -0
- package/src/types/CustomerSheet.ts +80 -12
- package/src/types/EmbeddedPaymentElement.tsx +23 -4
- package/src/types/PaymentSheet.ts +31 -12
- package/src/types/index.ts +2 -0
- package/stripe-react-native.podspec +1 -1
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcuserdata/wooj.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/StripeSdk.xcodeproj/xcuserdata/wooj.xcuserdatad/xcschemes/xcschememanagement.plist +0 -19
package/src/functions.ts
CHANGED
|
@@ -343,6 +343,7 @@ export const verifyMicrodepositsForSetup = async (
|
|
|
343
343
|
};
|
|
344
344
|
|
|
345
345
|
let confirmHandlerCallback: EventSubscription | null = null;
|
|
346
|
+
let confirmationTokenHandlerCallback: EventSubscription | null = null;
|
|
346
347
|
let orderTrackingCallbackListener: EventSubscription | null = null;
|
|
347
348
|
let financialConnectionsEventListener: EventSubscription | null = null;
|
|
348
349
|
let paymentSheetCustomPaymentMethodConfirmCallback: EventSubscription | null =
|
|
@@ -367,6 +368,21 @@ export const initPaymentSheet = async (
|
|
|
367
368
|
);
|
|
368
369
|
}
|
|
369
370
|
|
|
371
|
+
const confirmationTokenHandler =
|
|
372
|
+
params?.intentConfiguration?.confirmationTokenConfirmHandler;
|
|
373
|
+
if (confirmationTokenHandler) {
|
|
374
|
+
confirmationTokenHandlerCallback?.remove();
|
|
375
|
+
confirmationTokenHandlerCallback = addListener(
|
|
376
|
+
'onConfirmationTokenHandlerCallback',
|
|
377
|
+
({ confirmationToken }) => {
|
|
378
|
+
confirmationTokenHandler(
|
|
379
|
+
confirmationToken,
|
|
380
|
+
NativeStripeSdk.confirmationTokenCreationCallback
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
|
|
370
386
|
// Setup custom payment method confirmation handler for PaymentSheet
|
|
371
387
|
if (params.customPaymentMethodConfiguration) {
|
|
372
388
|
const customPaymentMethodHandler =
|
package/src/index.tsx
CHANGED
|
@@ -26,7 +26,7 @@ export interface NativeProps extends ViewProps {
|
|
|
26
26
|
disabled: boolean;
|
|
27
27
|
type: Int32;
|
|
28
28
|
buttonStyle: Int32;
|
|
29
|
-
|
|
29
|
+
buttonBorderRadius?: WithDefault<Int32, 4>;
|
|
30
30
|
onShippingMethodSelectedAction?: DirectEventHandler<OnShippingMethodSelectedActionEvent>;
|
|
31
31
|
onShippingContactSelectedAction?: DirectEventHandler<OnShippingContactSelectedActionEvent>;
|
|
32
32
|
onCouponCodeEnteredAction?: DirectEventHandler<OnCouponCodeEnteredActionEvent>;
|
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
CreateTokenForCVCUpdateResult,
|
|
12
12
|
CreateTokenResult,
|
|
13
13
|
CustomerAdapter,
|
|
14
|
+
CustomerSessionClientSecret,
|
|
14
15
|
CustomerSheetError,
|
|
15
16
|
CustomerSheetInitParams,
|
|
16
17
|
CustomerSheetPresentParams,
|
|
@@ -79,6 +80,9 @@ export interface Spec extends TurboModule {
|
|
|
79
80
|
intentCreationCallback(
|
|
80
81
|
result: UnsafeObject<PaymentSheet.IntentCreationCallbackParams>
|
|
81
82
|
): Promise<void>;
|
|
83
|
+
confirmationTokenCreationCallback(
|
|
84
|
+
result: UnsafeObject<PaymentSheet.IntentCreationCallbackParams>
|
|
85
|
+
): Promise<void>;
|
|
82
86
|
customPaymentMethodResultCallback(
|
|
83
87
|
result: UnsafeObject<PaymentSheet.CustomPaymentMethodResult>
|
|
84
88
|
): Promise<void>;
|
|
@@ -172,6 +176,12 @@ export interface Spec extends TurboModule {
|
|
|
172
176
|
customerAdapterSetupIntentClientSecretForCustomerAttachCallback(
|
|
173
177
|
clientSecret: string
|
|
174
178
|
): Promise<void>;
|
|
179
|
+
clientSecretProviderSetupIntentClientSecretCallback(
|
|
180
|
+
setupIntentClientSecret: string
|
|
181
|
+
): Promise<void>;
|
|
182
|
+
clientSecretProviderCustomerSessionClientSecretCallback(
|
|
183
|
+
customerSessionClientSecret: UnsafeObject<CustomerSessionClientSecret>
|
|
184
|
+
): Promise<void>;
|
|
175
185
|
createEmbeddedPaymentElement(
|
|
176
186
|
intentConfig: UnsafeObject<IntentConfiguration>,
|
|
177
187
|
configuration: UnsafeObject<EmbeddedPaymentElementConfiguration>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { BillingDetails } from './Common';
|
|
2
|
+
import type { FutureUsage } from './PaymentIntent';
|
|
3
|
+
import type { Type as PaymentMethodType } from './PaymentMethod';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* ConfirmationToken result type.
|
|
7
|
+
*/
|
|
8
|
+
export interface Result {
|
|
9
|
+
/** Unique identifier for the object (e.g. `ctoken_...`). */
|
|
10
|
+
id: string;
|
|
11
|
+
|
|
12
|
+
/** Time at which the object was created. Measured in seconds since the Unix epoch. */
|
|
13
|
+
created: number;
|
|
14
|
+
|
|
15
|
+
/** Time at which this ConfirmationToken expires and can no longer be used to confirm a PaymentIntent or SetupIntent. */
|
|
16
|
+
expiresAt?: number;
|
|
17
|
+
|
|
18
|
+
/** `true` if the object exists in live mode or the value `false` if the object exists in test mode. */
|
|
19
|
+
liveMode: boolean;
|
|
20
|
+
|
|
21
|
+
/** ID of the PaymentIntent this token was used to confirm. */
|
|
22
|
+
paymentIntentId?: string;
|
|
23
|
+
|
|
24
|
+
/** ID of the SetupIntent this token was used to confirm. */
|
|
25
|
+
setupIntentId?: string;
|
|
26
|
+
|
|
27
|
+
/** Return URL used to confirm the intent for redirect-based methods. */
|
|
28
|
+
returnURL?: string;
|
|
29
|
+
|
|
30
|
+
/** Indicates intent to reuse the payment method. */
|
|
31
|
+
setupFutureUsage?: FutureUsage;
|
|
32
|
+
|
|
33
|
+
/** Non-PII preview of payment details captured by the Payment Element. */
|
|
34
|
+
paymentMethodPreview?: PaymentMethodPreview;
|
|
35
|
+
|
|
36
|
+
/** Shipping information collected on this token. */
|
|
37
|
+
shipping?: ShippingDetails;
|
|
38
|
+
|
|
39
|
+
/** All response fields from the API, including any additional or undocumented fields. */
|
|
40
|
+
allResponseFields: Record<string, any>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Preview of payment method details captured by the ConfirmationToken.
|
|
45
|
+
* This represents the transactional checkout state, not a reusable PaymentMethod object.
|
|
46
|
+
*/
|
|
47
|
+
export interface PaymentMethodPreview {
|
|
48
|
+
/** Type of the payment method. */
|
|
49
|
+
type: PaymentMethodType;
|
|
50
|
+
|
|
51
|
+
/** Billing details for the payment method. */
|
|
52
|
+
billingDetails?: BillingDetails;
|
|
53
|
+
|
|
54
|
+
/** This field indicates whether this payment method can be shown again to its customer in a checkout flow */
|
|
55
|
+
allowRedisplay?: AllowRedisplay;
|
|
56
|
+
|
|
57
|
+
/** The ID of the Customer to which this PaymentMethod is saved. Null when the PaymentMethod has not been saved to a Customer. */
|
|
58
|
+
customerId?: string;
|
|
59
|
+
|
|
60
|
+
/** All response fields from the API, including any additional or undocumented fields. */
|
|
61
|
+
allResponseFields: Record<string, any>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type AllowRedisplay = 'always' | 'limited' | 'unspecified';
|
|
65
|
+
|
|
66
|
+
export interface ShippingDetails {
|
|
67
|
+
/** The recipient's address. */
|
|
68
|
+
address: BillingDetails['address'];
|
|
69
|
+
/** The recipient's name. */
|
|
70
|
+
name?: string;
|
|
71
|
+
/** The recipient's phone (including extension). */
|
|
72
|
+
phone?: string;
|
|
73
|
+
}
|
|
@@ -7,17 +7,11 @@ import type {
|
|
|
7
7
|
CardBrand,
|
|
8
8
|
} from '../types';
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
type CustomerSheetOptionalInitParams = {
|
|
11
11
|
/** The color styling to use for PaymentSheet UI. Defaults to 'automatic'. iOS only. */
|
|
12
12
|
style?: 'alwaysLight' | 'alwaysDark' | 'automatic';
|
|
13
13
|
/** Configuration for the look and feel of the UI. */
|
|
14
14
|
appearance?: PaymentSheet.AppearanceParams;
|
|
15
|
-
/** Optional but recommended for cards, required for other payment methods. The SetupIntent client secret that will be used to confirm a new payment method. If this is missing, you will only be able to add cards without authentication steps. */
|
|
16
|
-
setupIntentClientSecret?: string;
|
|
17
|
-
/** The identifier of the Stripe Customer object. See https://stripe.com/docs/api/customers/object#customer_object-id */
|
|
18
|
-
customerId: string;
|
|
19
|
-
/** A short-lived token that allows the SDK to access a Customer's payment methods. */
|
|
20
|
-
customerEphemeralKeySecret: string;
|
|
21
15
|
/** Your customer-facing business name. The default value is the name of your app. */
|
|
22
16
|
merchantDisplayName?: string;
|
|
23
17
|
/** Optional configuration for setting the header text of the Payment Method selection screen */
|
|
@@ -37,11 +31,6 @@ export type CustomerSheetInitParams = {
|
|
|
37
31
|
/** The list of preferred networks that should be used to process payments made with a co-branded card.
|
|
38
32
|
* This value will only be used if your user hasn't selected a network themselves. */
|
|
39
33
|
preferredNetworks?: Array<CardBrand>;
|
|
40
|
-
/** Optional override. It is generally recommended to rely on the default behavior, but- provide a CustomerAdapter here if
|
|
41
|
-
* you would prefer retrieving and updating your Stripe customer object via your own backend instead.
|
|
42
|
-
* WARNING: When implementing your own CustomerAdapter, ensure your application complies with all applicable laws and regulations, including data privacy and consumer protection.
|
|
43
|
-
*/
|
|
44
|
-
customerAdapter?: CustomerAdapter;
|
|
45
34
|
/** This is an experimental feature that may be removed at any time.
|
|
46
35
|
* Defaults to true. If true, the customer can delete all saved payment methods.
|
|
47
36
|
* If false, the customer can't delete if they only have one saved payment method remaining.
|
|
@@ -56,6 +45,45 @@ export type CustomerSheetInitParams = {
|
|
|
56
45
|
cardBrandAcceptance?: PaymentSheet.CardBrandAcceptance;
|
|
57
46
|
};
|
|
58
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Required params for initializing a CustomerSheet using a legacy CustomerAdapter
|
|
50
|
+
*/
|
|
51
|
+
type CustomerAdapterInitParams = {
|
|
52
|
+
/** The identifier of the Stripe Customer object. See https://stripe.com/docs/api/customers/object#customer_object-id */
|
|
53
|
+
customerId: string;
|
|
54
|
+
/** Optional but recommended for cards, required for other payment methods. The SetupIntent client secret that will be used to confirm a new payment method. If this is missing, you will only be able to add cards without authentication steps. */
|
|
55
|
+
setupIntentClientSecret?: string;
|
|
56
|
+
/** A short-lived token that allows the SDK to access a Customer's payment methods. */
|
|
57
|
+
customerEphemeralKeySecret: string;
|
|
58
|
+
/** Optional override. It is generally recommended to rely on the default behavior, but- provide a CustomerAdapter here if
|
|
59
|
+
* you would prefer retrieving and updating your Stripe customer object via your own backend instead.
|
|
60
|
+
* WARNING: When implementing your own CustomerAdapter, ensure your application complies with all applicable laws and regulations, including data privacy and consumer protection.
|
|
61
|
+
*/
|
|
62
|
+
customerAdapter?: CustomerAdapter;
|
|
63
|
+
intentConfiguration?: never;
|
|
64
|
+
clientSecretProvider?: never;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Required params for initializing a CustomerSheet with a CustomerSession
|
|
69
|
+
*/
|
|
70
|
+
type CustomerSessionInitParams = {
|
|
71
|
+
/** An object that configures the intent used to display saved payment methods to a customer.*/
|
|
72
|
+
intentConfiguration: CustomerSheetIntentConfiguration;
|
|
73
|
+
/** An object that provides the client secret for the customer session. */
|
|
74
|
+
clientSecretProvider: ClientSecretProvider;
|
|
75
|
+
customerId?: never;
|
|
76
|
+
setupIntentClientSecret?: never;
|
|
77
|
+
customerEphemeralKeySecret?: never;
|
|
78
|
+
customerAdapter?: never;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export type CustomerSheetInitParams = (
|
|
82
|
+
| CustomerAdapterInitParams
|
|
83
|
+
| CustomerSessionInitParams
|
|
84
|
+
) &
|
|
85
|
+
CustomerSheetOptionalInitParams;
|
|
86
|
+
|
|
59
87
|
export type CustomerSheetPresentParams = {
|
|
60
88
|
/** Controls how the modal is presented (after animation). iOS only. Defaults to `popover`. See https://developer.apple.com/documentation/uikit/uimodalpresentationstyle for more info. */
|
|
61
89
|
presentationStyle?:
|
|
@@ -131,3 +159,43 @@ export type CustomerPaymentOption =
|
|
|
131
159
|
| 'google_pay'
|
|
132
160
|
| 'link'
|
|
133
161
|
| string;
|
|
162
|
+
|
|
163
|
+
export interface ClientSecretProvider {
|
|
164
|
+
/**
|
|
165
|
+
* Provides the `SetupIntent` client secret that is used when attaching a payment method
|
|
166
|
+
* to a customer.
|
|
167
|
+
*/
|
|
168
|
+
provideSetupIntentClientSecret(): Promise<string>;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Provides the CustomerSessionClientSecret that will be claimed and used to access a
|
|
172
|
+
* customer's saved payment methods.
|
|
173
|
+
*/
|
|
174
|
+
provideCustomerSessionClientSecret(): Promise<CustomerSessionClientSecret>;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export type CustomerSheetIntentConfiguration = {
|
|
178
|
+
/** A list of payment method types to display to the customer. If undefined or empty, we dynamically determine the payment methods using your Stripe Dashboard settings. */
|
|
179
|
+
paymentMethodTypes?: Array<string>;
|
|
180
|
+
/** The connected account whose payment method configurations will apply to the CustomerSheet session.
|
|
181
|
+
* Affects the allowed payment methods and whether card brand choice is enabled.
|
|
182
|
+
* When provided, the payment method will be saved to your platform account. See our
|
|
183
|
+
* [SetupIntent docs](https://docs.stripe.com/api/setup_intents/object#setup_intent_object-on_behalf_of)
|
|
184
|
+
* for more information.
|
|
185
|
+
*/
|
|
186
|
+
onBehalfOf?: string;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export type CustomerSessionClientSecret = {
|
|
190
|
+
/**
|
|
191
|
+
* The Customer the Customer Session was created for.
|
|
192
|
+
*/
|
|
193
|
+
customerId: string;
|
|
194
|
+
/**
|
|
195
|
+
* The client secret of this Customer Session.
|
|
196
|
+
* Used on the client to set up secure access to the given customer.
|
|
197
|
+
* See our [CustomerSession docs](https://docs.stripe.com/api/customer_sessions/object)
|
|
198
|
+
* for more information
|
|
199
|
+
*/
|
|
200
|
+
clientSecret: string;
|
|
201
|
+
};
|
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
CardBrand,
|
|
14
14
|
} from './Common';
|
|
15
15
|
import type { PaymentMethod } from '.';
|
|
16
|
+
import type * as ConfirmationToken from './ConfirmationToken';
|
|
16
17
|
import * as PaymentSheetTypes from './PaymentSheet';
|
|
17
18
|
import NativeStripeSdkModule from '../specs/NativeStripeSdkModule';
|
|
18
19
|
import {
|
|
@@ -134,11 +135,9 @@ export interface EmbeddedPaymentElementConfiguration {
|
|
|
134
135
|
merchantDisplayName: string;
|
|
135
136
|
/** The identifier of the Stripe Customer object. See https://stripe.com/docs/api/customers/object#customer_object-id */
|
|
136
137
|
customerId?: string;
|
|
137
|
-
/** A short-lived token that allows the SDK to access a Customer
|
|
138
|
+
/** A short-lived token that allows the SDK to access a Customer's payment methods. */
|
|
138
139
|
customerEphemeralKeySecret?: string;
|
|
139
|
-
/**
|
|
140
|
-
* The client secret of this Customer Session. Used on the client to set up secure access to the given customer.
|
|
141
|
-
*/
|
|
140
|
+
/** The client secret of this Customer Session. Used on the client to set up secure access to the given customer. */
|
|
142
141
|
customerSessionClientSecret?: string;
|
|
143
142
|
/** iOS only. Enable Apple Pay in the Payment Sheet by passing an ApplePayParams object. */
|
|
144
143
|
applePay?: PaymentSheetTypes.ApplePayParams;
|
|
@@ -253,6 +252,7 @@ class EmbeddedPaymentElement {
|
|
|
253
252
|
// JS Factory: createEmbeddedPaymentElement
|
|
254
253
|
// -----------------------------------------------------------------------------
|
|
255
254
|
let confirmHandlerCallback: EventSubscription | null = null;
|
|
255
|
+
let confirmationTokenHandlerCallback: EventSubscription | null = null;
|
|
256
256
|
let formSheetActionConfirmCallback: EventSubscription | null = null;
|
|
257
257
|
let customPaymentMethodConfirmCallback: EventSubscription | null = null;
|
|
258
258
|
let rowSelectionCallback: EventSubscription | null = null;
|
|
@@ -295,6 +295,25 @@ function setupConfirmAndSelectionHandlers(
|
|
|
295
295
|
);
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
+
const confirmationTokenConfirmHandler =
|
|
299
|
+
intentConfig.confirmationTokenConfirmHandler;
|
|
300
|
+
if (confirmationTokenConfirmHandler) {
|
|
301
|
+
confirmationTokenHandlerCallback?.remove();
|
|
302
|
+
confirmationTokenHandlerCallback = addListener(
|
|
303
|
+
'onConfirmationTokenHandlerCallback',
|
|
304
|
+
({
|
|
305
|
+
confirmationToken,
|
|
306
|
+
}: {
|
|
307
|
+
confirmationToken: ConfirmationToken.Result;
|
|
308
|
+
}) => {
|
|
309
|
+
confirmationTokenConfirmHandler(
|
|
310
|
+
confirmationToken,
|
|
311
|
+
NativeStripeSdkModule.confirmationTokenCreationCallback
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
|
|
298
317
|
if (configuration.formSheetAction?.type === 'confirm') {
|
|
299
318
|
const confirmFormSheetHandler =
|
|
300
319
|
configuration.formSheetAction.onFormSheetConfirmComplete;
|
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
import type { FutureUsage } from './PaymentIntent';
|
|
15
15
|
import type { Result } from './PaymentMethod';
|
|
16
16
|
import type { StripeError } from './Errors';
|
|
17
|
+
import type { Result as ConfirmationTokenResult } from './ConfirmationToken';
|
|
17
18
|
|
|
18
19
|
export type SetupParamsBase = IntentParams & {
|
|
19
20
|
/** Your customer-facing business name. On Android, this is required and cannot be an empty string. */
|
|
@@ -96,9 +97,7 @@ export type SetupParams =
|
|
|
96
97
|
})
|
|
97
98
|
| (SetupParamsBase & {
|
|
98
99
|
customerEphemeralKeySecret?: never;
|
|
99
|
-
/**
|
|
100
|
-
* The client secret of this Customer Session. Used on the client to set up secure access to the given customer.
|
|
101
|
-
*/
|
|
100
|
+
/** The client secret of this Customer Session. Used on the client to set up secure access to the given customer. */
|
|
102
101
|
customerSessionClientSecret: string;
|
|
103
102
|
})
|
|
104
103
|
| SetupParamsBase;
|
|
@@ -563,19 +562,39 @@ export type IntentCreationCallbackParams =
|
|
|
563
562
|
};
|
|
564
563
|
|
|
565
564
|
export type IntentConfiguration = {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
565
|
+
/**
|
|
566
|
+
* Called when the customer confirms payment. Your implementation should create a PaymentIntent or SetupIntent on your server and call the `intentCreationCallback` with its client secret or an error if one occurred.
|
|
567
|
+
* - Note: You must create the PaymentIntent or SetupIntent with the same values used as the `IntentConfiguration` e.g. the same amount, currency, etc.
|
|
568
|
+
* - Note: Either `confirmHandler` or `confirmationTokenConfirmHandler` must be provided, but not both.
|
|
569
|
+
* - Parameters:
|
|
570
|
+
* - paymentMethod: The PaymentMethod representing the customer's payment details.
|
|
571
|
+
* - shouldSavePaymentMethod: This is `true` if the customer selected the "Save this payment method for future use" checkbox. Set `setup_future_usage` on the PaymentIntent to `off_session` if this is `true`.
|
|
572
|
+
* - intentCreationCallback: Call this with the `client_secret` of the PaymentIntent or SetupIntent created by your server or the error that occurred. If you're using customFlow: false (default), the error's localizedMessage will be displayed to the customer in the sheet. If you're using customFlow: true, the `confirm` method fails with the error.
|
|
573
|
+
*/
|
|
574
|
+
confirmHandler?: (
|
|
575
575
|
paymentMethod: Result,
|
|
576
576
|
shouldSavePaymentMethod: boolean,
|
|
577
577
|
intentCreationCallback: (result: IntentCreationCallbackParams) => void
|
|
578
578
|
) => void;
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Called when the customer confirms payment using confirmation tokens.
|
|
582
|
+
* Your implementation should follow the guide to create (and optionally confirm) a PaymentIntent or SetupIntent on your server and call the `intentCreationCallback` with its client secret or an error if one occurred.
|
|
583
|
+
*
|
|
584
|
+
* - Note: You must create the PaymentIntent or SetupIntent with the same values used as the `IntentConfiguration` e.g. the same amount, currency, etc.
|
|
585
|
+
* - Note: When confirming the PaymentIntent or SetupIntent on your server, use the confirmation token ID (`confirmationToken.id`) as the `confirmation_token` parameter.
|
|
586
|
+
* - Note: Either `confirmHandler` or `confirmationTokenConfirmHandler` must be provided, but not both.
|
|
587
|
+
*
|
|
588
|
+
* @param confirmationToken - The ConfirmationToken representing the customer's payment details and any additional information collected during checkout (e.g., billing details, shipping address). This token contains a secure, non-PII preview of the payment method that can be safely passed to your server. Use `confirmationToken.id` when confirming the intent on your server.
|
|
589
|
+
* @param intentCreationCallback - Call this with the `client_secret` of the PaymentIntent or SetupIntent created by your server or the error that occurred. If you're using PaymentSheet, the error's localizedMessage will be displayed to the customer in the sheet. If you're using PaymentSheet.FlowController, the `confirm` method fails with the error.
|
|
590
|
+
*
|
|
591
|
+
* @see https://stripe.com/docs/api/confirmation_tokens
|
|
592
|
+
*/
|
|
593
|
+
confirmationTokenConfirmHandler?: (
|
|
594
|
+
confirmationToken: ConfirmationTokenResult,
|
|
595
|
+
intentCreationCallback: (result: IntentCreationCallbackParams) => void
|
|
596
|
+
) => void;
|
|
597
|
+
|
|
579
598
|
/* Information about the payment (PaymentIntent) or setup (SetupIntent).*/
|
|
580
599
|
mode: Mode;
|
|
581
600
|
/* A list of payment method types to display to the customer. If undefined or empty, we dynamically determine the payment methods using your Stripe Dashboard settings. */
|
package/src/types/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ import * as CardFormView from './components/CardFormView';
|
|
|
25
25
|
import * as Token from './Token';
|
|
26
26
|
import * as FinancialConnections from './FinancialConnections';
|
|
27
27
|
import * as PlatformPay from './PlatformPay';
|
|
28
|
+
import * as ConfirmationToken from './ConfirmationToken';
|
|
28
29
|
|
|
29
30
|
export {
|
|
30
31
|
ApplePay,
|
|
@@ -39,6 +40,7 @@ export {
|
|
|
39
40
|
Token,
|
|
40
41
|
FinancialConnections,
|
|
41
42
|
PlatformPay,
|
|
43
|
+
ConfirmationToken,
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
export * from './PushProvisioning';
|
|
@@ -2,7 +2,7 @@ require 'json'
|
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
4
|
# Keep stripe_version in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/stripe-identity-react-native.podspec
|
|
5
|
-
stripe_version = '~> 24.
|
|
5
|
+
stripe_version = '~> 24.25.0'
|
|
6
6
|
|
|
7
7
|
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
8
8
|
|
|
Binary file
|
package/ios/StripeSdk.xcodeproj/xcuserdata/wooj.xcuserdatad/xcschemes/xcschememanagement.plist
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>SchemeUserState</key>
|
|
6
|
-
<dict>
|
|
7
|
-
<key>StripeSdk.xcscheme_^#shared#^_</key>
|
|
8
|
-
<dict>
|
|
9
|
-
<key>orderHint</key>
|
|
10
|
-
<integer>1</integer>
|
|
11
|
-
</dict>
|
|
12
|
-
<key>Tests.xcscheme_^#shared#^_</key>
|
|
13
|
-
<dict>
|
|
14
|
-
<key>orderHint</key>
|
|
15
|
-
<integer>0</integer>
|
|
16
|
-
</dict>
|
|
17
|
-
</dict>
|
|
18
|
-
</dict>
|
|
19
|
-
</plist>
|