@stripe/stripe-react-native 0.55.0 → 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/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/Mappers.swift +111 -18
- package/ios/OldArch/StripeSdkEventEmitterCompat.h +1 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.m +6 -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.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.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 +28 -1
- 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 +33 -9
- package/src/types/index.ts +2 -0
- 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
|
@@ -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. */
|
|
@@ -563,19 +564,42 @@ export type IntentCreationCallbackParams =
|
|
|
563
564
|
};
|
|
564
565
|
|
|
565
566
|
export type IntentConfiguration = {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
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?: (
|
|
575
577
|
paymentMethod: Result,
|
|
576
578
|
shouldSavePaymentMethod: boolean,
|
|
577
579
|
intentCreationCallback: (result: IntentCreationCallbackParams) => void
|
|
578
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
|
+
|
|
579
603
|
/* Information about the payment (PaymentIntent) or setup (SetupIntent).*/
|
|
580
604
|
mode: Mode;
|
|
581
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';
|
|
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>
|