@stripe/stripe-react-native 0.54.1 → 0.55.1
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/README.md +11 -0
- package/android/gradle.properties +1 -1
- 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 +4 -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/StripeSdkModule.kt +18 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +84 -1
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +4 -0
- package/ios/Errors.swift +3 -2
- package/ios/Mappers.swift +111 -18
- package/ios/OldArch/StripeSdkEventEmitterCompat.h +1 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.m +6 -0
- package/ios/PaymentSheetAppearance.swift +15 -0
- package/ios/StripeSdk.mm +7 -0
- package/ios/StripeSdkEmitter.swift +1 -0
- package/ios/StripeSdkImpl+Embedded.swift +26 -4
- package/ios/StripeSdkImpl+PaymentSheet.swift +37 -15
- package/ios/StripeSdkImpl.swift +18 -1
- package/lib/commonjs/components/AddToWalletButton.js +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/components/AddressSheet.js +1 -1
- package/lib/commonjs/components/AddressSheet.js.map +1 -1
- package/lib/commonjs/components/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/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/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 +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/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/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 +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/events.d.ts +4 -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/NativeStripeSdkModule.d.ts +1 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/ConfirmationToken.d.ts +59 -0
- package/lib/typescript/src/types/ConfirmationToken.d.ts.map +1 -0
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +52 -3
- 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/events.ts +4 -0
- package/src/functions.ts +16 -0
- package/src/index.tsx +1 -0
- package/src/specs/NativeStripeSdkModule.ts +3 -0
- package/src/types/ConfirmationToken.ts +76 -0
- package/src/types/EmbeddedPaymentElement.tsx +21 -0
- package/src/types/PaymentSheet.ts +60 -11
- package/src/types/index.ts +2 -0
- package/stripe-react-native.podspec +1 -1
- package/android/.idea/AndroidProjectSystem.xml +0 -6
- package/android/.idea/caches/deviceStreaming.xml +0 -703
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -18
- package/android/.idea/migrations.xml +0 -10
- package/android/.idea/misc.xml +0 -10
- package/android/.idea/runConfigurations.xml +0 -17
- package/android/.idea/vcs.xml +0 -6
- package/android/local.properties +0 -8
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
* @internal DO NOT USE - This API is under active development and is not ready for use.
|
|
9
|
+
* The API is subject to breaking changes without notice. Do not use in production or development.
|
|
10
|
+
*/
|
|
11
|
+
export interface Result {
|
|
12
|
+
/** Unique identifier for the object (e.g. `ctoken_...`). */
|
|
13
|
+
id: string;
|
|
14
|
+
|
|
15
|
+
/** Time at which the object was created. Measured in seconds since the Unix epoch. */
|
|
16
|
+
created: number;
|
|
17
|
+
|
|
18
|
+
/** Time at which this ConfirmationToken expires and can no longer be used to confirm a PaymentIntent or SetupIntent. */
|
|
19
|
+
expiresAt?: number;
|
|
20
|
+
|
|
21
|
+
/** `true` if the object exists in live mode or the value `false` if the object exists in test mode. */
|
|
22
|
+
liveMode: boolean;
|
|
23
|
+
|
|
24
|
+
/** ID of the PaymentIntent this token was used to confirm. */
|
|
25
|
+
paymentIntentId?: string;
|
|
26
|
+
|
|
27
|
+
/** ID of the SetupIntent this token was used to confirm. */
|
|
28
|
+
setupIntentId?: string;
|
|
29
|
+
|
|
30
|
+
/** Return URL used to confirm the intent for redirect-based methods. */
|
|
31
|
+
returnURL?: string;
|
|
32
|
+
|
|
33
|
+
/** Indicates intent to reuse the payment method. */
|
|
34
|
+
setupFutureUsage?: FutureUsage;
|
|
35
|
+
|
|
36
|
+
/** Non-PII preview of payment details captured by the Payment Element. */
|
|
37
|
+
paymentMethodPreview?: PaymentMethodPreview;
|
|
38
|
+
|
|
39
|
+
/** Shipping information collected on this token. */
|
|
40
|
+
shipping?: ShippingDetails;
|
|
41
|
+
|
|
42
|
+
/** All response fields from the API, including any additional or undocumented fields. */
|
|
43
|
+
allResponseFields: Record<string, any>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Preview of payment method details captured by the ConfirmationToken.
|
|
48
|
+
* This represents the transactional checkout state, not a reusable PaymentMethod object.
|
|
49
|
+
*/
|
|
50
|
+
export interface PaymentMethodPreview {
|
|
51
|
+
/** Type of the payment method. */
|
|
52
|
+
type: PaymentMethodType;
|
|
53
|
+
|
|
54
|
+
/** Billing details for the payment method. */
|
|
55
|
+
billingDetails?: BillingDetails;
|
|
56
|
+
|
|
57
|
+
/** This field indicates whether this payment method can be shown again to its customer in a checkout flow */
|
|
58
|
+
allowRedisplay?: AllowRedisplay;
|
|
59
|
+
|
|
60
|
+
/** The ID of the Customer to which this PaymentMethod is saved. Null when the PaymentMethod has not been saved to a Customer. */
|
|
61
|
+
customerId?: string;
|
|
62
|
+
|
|
63
|
+
/** All response fields from the API, including any additional or undocumented fields. */
|
|
64
|
+
allResponseFields: Record<string, any>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type AllowRedisplay = 'always' | 'limited' | 'unspecified';
|
|
68
|
+
|
|
69
|
+
export interface ShippingDetails {
|
|
70
|
+
/** The recipient's address. */
|
|
71
|
+
address: BillingDetails['address'];
|
|
72
|
+
/** The recipient's name. */
|
|
73
|
+
name?: string;
|
|
74
|
+
/** The recipient's phone (including extension). */
|
|
75
|
+
phone?: string;
|
|
76
|
+
}
|
|
@@ -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 {
|
|
@@ -253,6 +254,7 @@ class EmbeddedPaymentElement {
|
|
|
253
254
|
// JS Factory: createEmbeddedPaymentElement
|
|
254
255
|
// -----------------------------------------------------------------------------
|
|
255
256
|
let confirmHandlerCallback: EventSubscription | null = null;
|
|
257
|
+
let confirmationTokenHandlerCallback: EventSubscription | null = null;
|
|
256
258
|
let formSheetActionConfirmCallback: EventSubscription | null = null;
|
|
257
259
|
let customPaymentMethodConfirmCallback: EventSubscription | null = null;
|
|
258
260
|
let rowSelectionCallback: EventSubscription | null = null;
|
|
@@ -295,6 +297,25 @@ function setupConfirmAndSelectionHandlers(
|
|
|
295
297
|
);
|
|
296
298
|
}
|
|
297
299
|
|
|
300
|
+
const confirmationTokenConfirmHandler =
|
|
301
|
+
intentConfig.confirmationTokenConfirmHandler;
|
|
302
|
+
if (confirmationTokenConfirmHandler) {
|
|
303
|
+
confirmationTokenHandlerCallback?.remove();
|
|
304
|
+
confirmationTokenHandlerCallback = addListener(
|
|
305
|
+
'onConfirmationTokenHandlerCallback',
|
|
306
|
+
({
|
|
307
|
+
confirmationToken,
|
|
308
|
+
}: {
|
|
309
|
+
confirmationToken: ConfirmationToken.Result;
|
|
310
|
+
}) => {
|
|
311
|
+
confirmationTokenConfirmHandler(
|
|
312
|
+
confirmationToken,
|
|
313
|
+
NativeStripeSdkModule.confirmationTokenCreationCallback
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
|
|
298
319
|
if (configuration.formSheetAction?.type === 'confirm') {
|
|
299
320
|
const confirmFormSheetHandler =
|
|
300
321
|
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. */
|
|
@@ -192,8 +193,12 @@ export type AppearanceParams = RecursivePartial<{
|
|
|
192
193
|
| { light: GlobalColorConfig; dark: GlobalColorConfig };
|
|
193
194
|
/** Describes the appearance of shapes in the PaymentSheet, such as buttons, inputs, and tabs. */
|
|
194
195
|
shapes: {
|
|
195
|
-
/** The border radius used for buttons, inputs,
|
|
196
|
-
*
|
|
196
|
+
/** The border radius used for buttons, inputs, tabs in PaymentSheet
|
|
197
|
+
* - Note: On iOS, the behavior of this property is consistent with the behavior of corner radius on `CALayer`
|
|
198
|
+
* - Note: On iOS, When `nil`, the behavior depends:
|
|
199
|
+
* - iOS 26+ and `UIDesignRequiresCompatibility = NO`: Various `UICornerConfiguration` values are used to match Liquid Glass.
|
|
200
|
+
* - Pre-iOS 26: A 6.0 corner radius is applied.
|
|
201
|
+
* - Note: On Android, a 6.0 corner radius is applied.
|
|
197
202
|
*/
|
|
198
203
|
borderRadius: number;
|
|
199
204
|
/** The border width used for inputs and tabs in your PaymentSheet.
|
|
@@ -211,8 +216,29 @@ export type AppearanceParams = RecursivePartial<{
|
|
|
211
216
|
|
|
212
217
|
/** Describes the inset values applied to Mobile Payment Element forms */
|
|
213
218
|
formInsetValues: EdgeInsetsConfig;
|
|
219
|
+
|
|
220
|
+
/** Setting this boolean to `true` will call the iOS applyLiquidGlass() method
|
|
221
|
+
* (https://stripe.dev/stripe-ios/stripepaymentsheet/documentation/stripepaymentsheet/paymentsheet/appearance/applyliquidglass())
|
|
222
|
+
* on the Appearance object prior to applying other appearance customizations set on AppearanceParams.
|
|
223
|
+
* Requires iOS26 and Xcode 26, and will be ignored if these requirements are not met.
|
|
224
|
+
* @default false
|
|
225
|
+
*/
|
|
226
|
+
applyLiquidGlass?: boolean;
|
|
227
|
+
|
|
228
|
+
/** Describes the navigation bar style (iOS only)
|
|
229
|
+
* @default Plain
|
|
230
|
+
*/
|
|
231
|
+
navigationBarStyle?: NavigationBarStyle;
|
|
214
232
|
}>;
|
|
215
233
|
|
|
234
|
+
/** Display styles for the navigation bar (iOS only) */
|
|
235
|
+
export enum NavigationBarStyle {
|
|
236
|
+
/** Default style */
|
|
237
|
+
Plain = 'plain',
|
|
238
|
+
/** Style to match iOS 26 Liquid Glass. Requires: iOS26 and Xcode 26, and will be ignored if these requirements are not met. */
|
|
239
|
+
Glass = 'glass',
|
|
240
|
+
}
|
|
241
|
+
|
|
216
242
|
export type FontConfig = {
|
|
217
243
|
/**
|
|
218
244
|
* The font used for regular text. PaymentSheet will attempt to use medium and bold versions of this font if they exist.
|
|
@@ -538,19 +564,42 @@ export type IntentCreationCallbackParams =
|
|
|
538
564
|
};
|
|
539
565
|
|
|
540
566
|
export type IntentConfiguration = {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
567
|
+
/**
|
|
568
|
+
* 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.
|
|
569
|
+
* - Note: You must create the PaymentIntent or SetupIntent with the same values used as the `IntentConfiguration` e.g. the same amount, currency, etc.
|
|
570
|
+
* - Note: Either `confirmHandler` or `confirmationTokenConfirmHandler` must be provided, but not both.
|
|
571
|
+
* - Parameters:
|
|
572
|
+
* - paymentMethod: The PaymentMethod representing the customer's payment details.
|
|
573
|
+
* - 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`.
|
|
574
|
+
* - 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.
|
|
575
|
+
*/
|
|
576
|
+
confirmHandler?: (
|
|
550
577
|
paymentMethod: Result,
|
|
551
578
|
shouldSavePaymentMethod: boolean,
|
|
552
579
|
intentCreationCallback: (result: IntentCreationCallbackParams) => void
|
|
553
580
|
) => void;
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* @internal DO NOT USE - This API is under active development and is not ready for use.
|
|
584
|
+
* The API is subject to breaking changes without notice. Do not use in production or development.
|
|
585
|
+
*
|
|
586
|
+
* Called when the customer confirms payment using confirmation tokens.
|
|
587
|
+
* 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.
|
|
588
|
+
*
|
|
589
|
+
* - Note: You must create the PaymentIntent or SetupIntent with the same values used as the `IntentConfiguration` e.g. the same amount, currency, etc.
|
|
590
|
+
* - Note: When confirming the PaymentIntent or SetupIntent on your server, use the confirmation token ID (`confirmationToken.id`) as the `confirmation_token` parameter.
|
|
591
|
+
* - Note: Either `confirmHandler` or `confirmationTokenConfirmHandler` must be provided, but not both.
|
|
592
|
+
*
|
|
593
|
+
* @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.
|
|
594
|
+
* @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.
|
|
595
|
+
*
|
|
596
|
+
* @see https://stripe.com/docs/api/confirmation_tokens
|
|
597
|
+
*/
|
|
598
|
+
confirmationTokenConfirmHandler?: (
|
|
599
|
+
confirmationToken: ConfirmationTokenResult,
|
|
600
|
+
intentCreationCallback: (result: IntentCreationCallbackParams) => void
|
|
601
|
+
) => void;
|
|
602
|
+
|
|
554
603
|
/* Information about the payment (PaymentIntent) or setup (SetupIntent).*/
|
|
555
604
|
mode: Mode;
|
|
556
605
|
/* 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.24.0'
|
|
6
6
|
|
|
7
7
|
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
8
8
|
|