@stripe/stripe-react-native 0.65.0 → 0.66.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/README.md +2 -2
- package/android/detekt/detekt-baseline.xml +1 -76
- package/android/gradle.properties +4 -4
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +3 -1
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormViewManager.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +56 -58
- package/android/src/main/java/com/reactnativestripesdk/CurrencySelectorElementEvent.kt +26 -0
- package/android/src/main/java/com/reactnativestripesdk/CurrencySelectorElementView.kt +139 -0
- package/android/src/main/java/com/reactnativestripesdk/CurrencySelectorElementViewManager.kt +59 -0
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +105 -49
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +72 -12
- package/android/src/main/java/com/reactnativestripesdk/EventEmitterCompat.kt +4 -0
- package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetManager.kt +8 -4
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +26 -11
- package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherManager.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/NavigationBarView.kt +14 -5
- package/android/src/main/java/com/reactnativestripesdk/PaymentElementConfig.kt +6 -2
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherManager.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodMessagingElementConfig.kt +6 -2
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodMessagingElementViewManager.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +8 -4
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +9 -3
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetManager.kt +118 -48
- package/android/src/main/java/com/reactnativestripesdk/StripeAbstractComposeView.kt +1 -0
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +281 -46
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +2 -0
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherManager.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +3 -1
- package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetManager.kt +8 -18
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerAdapter.kt +3 -1
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerSessionProvider.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/utils/CheckoutAddressUpdate.kt +45 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/CheckoutMappers.kt +127 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/DefaultActivityLifecycleCallbacks.kt +41 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +4 -2
- package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +5 -1
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +29 -13
- package/android/src/main/java/com/reactnativestripesdk/utils/PostalCodeUtilities.kt +2 -1
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerDelegate.java +6 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerInterface.java +2 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeCurrencySelectorElementManagerDelegate.java +35 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeCurrencySelectorElementManagerInterface.java +18 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeOnrampSdkModuleSpec.java +17 -3
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +13 -1
- package/android/src/onramp/java/com/reactnativestripesdk/OnrampMappers.kt +116 -0
- package/android/src/onramp/java/com/reactnativestripesdk/OnrampSdkModule.kt +109 -1
- package/android/src/test/java/com/reactnativestripesdk/DrawableLoadingTest.kt +6 -2
- package/android/src/test/java/com/reactnativestripesdk/mappers/MappersTest.kt +60 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/OnrampMappersTest.kt +145 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/PaymentOptionDisplayDataMapperTest.kt +9 -4
- package/android/src/test/java/com/reactnativestripesdk/utils/CheckoutMappersTest.kt +98 -0
- package/android/src/test/java/com/reactnativestripesdk/utils/CheckoutTestFixtures.java +57 -0
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewController.swift +6 -8
- package/ios/CurrencySelectorElementManager.m +16 -0
- package/ios/CurrencySelectorElementView.swift +159 -0
- package/ios/EmbeddedPaymentElementView.swift +1 -1
- package/ios/Mappers+Checkout.swift +337 -0
- package/ios/Mappers.swift +90 -2
- package/ios/NewArch/EmbeddedPaymentElementViewComponentView.mm +16 -2
- package/ios/NewArch/StripeCurrencySelectorElementComponentView.h +10 -0
- package/ios/NewArch/StripeCurrencySelectorElementComponentView.mm +89 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.h +1 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.m +6 -0
- package/ios/PaymentOptionDisplayData+ReactNative.swift +1 -1
- package/ios/PaymentSheetAppearance.swift +1 -1
- package/ios/StripeOnrampSdk.mm +19 -0
- package/ios/StripeSdk.mm +136 -0
- package/ios/StripeSdkEmitter.swift +1 -0
- package/ios/StripeSdkImpl+Checkout.swift +360 -0
- package/ios/StripeSdkImpl+CustomerSheet.swift +1 -1
- package/ios/StripeSdkImpl+Embedded.swift +108 -27
- package/ios/StripeSdkImpl+PaymentSheet.swift +18 -2
- package/ios/StripeSdkImpl.swift +89 -7
- package/jest/mock.js +13 -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/CurrencySelectorElement.js +2 -0
- package/lib/commonjs/components/CurrencySelectorElement.js.map +1 -0
- package/lib/commonjs/components/PaymentMethodMessagingElement.js +1 -1
- package/lib/commonjs/components/PaymentMethodMessagingElement.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/connect/Components.js +1 -1
- package/lib/commonjs/connect/Components.js.map +1 -1
- package/lib/commonjs/connect/ConnectComponentsProvider.js +1 -1
- package/lib/commonjs/connect/ConnectComponentsProvider.js.map +1 -1
- package/lib/commonjs/connect/EmbeddedComponent.js +1 -1
- package/lib/commonjs/connect/EmbeddedComponent.js.map +1 -1
- package/lib/commonjs/connect/ModalCloseButton.js +1 -1
- package/lib/commonjs/connect/ModalCloseButton.js.map +1 -1
- package/lib/commonjs/connect/NavigationBar.js +1 -1
- package/lib/commonjs/connect/NavigationBar.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/helpers.js +1 -1
- package/lib/commonjs/hooks/useCheckout.js +1 -1
- package/lib/commonjs/hooks/useCheckout.js.map +1 -1
- package/lib/commonjs/hooks/useOnramp.js +1 -1
- package/lib/commonjs/hooks/useOnramp.js.map +1 -1
- package/lib/commonjs/specs/NativeAddToWalletButton.js +1 -1
- package/lib/commonjs/specs/NativeAddressSheet.js +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js +1 -1
- package/lib/commonjs/specs/NativeCardField.js +1 -1
- package/lib/commonjs/specs/NativeCardField.js.map +1 -1
- package/lib/commonjs/specs/NativeCardForm.js +1 -1
- package/lib/commonjs/specs/NativeCardForm.js.map +1 -1
- package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js +1 -1
- package/lib/commonjs/specs/NativeCurrencySelectorElement.js +2 -0
- package/lib/commonjs/specs/NativeCurrencySelectorElement.js.map +1 -0
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/specs/NativeGooglePayButton.js +1 -1
- package/lib/commonjs/specs/NativeNavigationBar.js +1 -1
- package/lib/commonjs/specs/NativeOnrampSdkModule.js.map +1 -1
- package/lib/commonjs/specs/NativePaymentMethodMessagingElement.js +1 -1
- package/lib/commonjs/specs/NativeStripeContainer.js +1 -1
- package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.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/CurrencySelectorElement.js +2 -0
- package/lib/module/components/CurrencySelectorElement.js.map +1 -0
- package/lib/module/components/PaymentMethodMessagingElement.js +1 -1
- package/lib/module/components/PaymentMethodMessagingElement.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/connect/Components.js +1 -1
- package/lib/module/connect/Components.js.map +1 -1
- package/lib/module/connect/ConnectComponentsProvider.js +1 -1
- package/lib/module/connect/ConnectComponentsProvider.js.map +1 -1
- package/lib/module/connect/EmbeddedComponent.js +1 -1
- package/lib/module/connect/EmbeddedComponent.js.map +1 -1
- package/lib/module/connect/ModalCloseButton.js +1 -1
- package/lib/module/connect/ModalCloseButton.js.map +1 -1
- package/lib/module/connect/NavigationBar.js +1 -1
- package/lib/module/connect/NavigationBar.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/helpers.js +1 -1
- package/lib/module/hooks/useCheckout.js +1 -1
- package/lib/module/hooks/useCheckout.js.map +1 -1
- package/lib/module/hooks/useOnramp.js +1 -1
- package/lib/module/hooks/useOnramp.js.map +1 -1
- package/lib/module/specs/NativeAddToWalletButton.js +1 -1
- package/lib/module/specs/NativeAddressSheet.js +1 -1
- package/lib/module/specs/NativeApplePayButton.js +1 -1
- package/lib/module/specs/NativeAuBECSDebitForm.js +1 -1
- package/lib/module/specs/NativeCardField.js +1 -1
- package/lib/module/specs/NativeCardField.js.map +1 -1
- package/lib/module/specs/NativeCardForm.js +1 -1
- package/lib/module/specs/NativeCardForm.js.map +1 -1
- package/lib/module/specs/NativeConnectAccountOnboardingView.js +1 -1
- package/lib/module/specs/NativeCurrencySelectorElement.js +2 -0
- package/lib/module/specs/NativeCurrencySelectorElement.js.map +1 -0
- package/lib/module/specs/NativeEmbeddedPaymentElement.js +1 -1
- package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -1
- package/lib/module/specs/NativeGooglePayButton.js +1 -1
- package/lib/module/specs/NativeNavigationBar.js +1 -1
- package/lib/module/specs/NativeOnrampSdkModule.js.map +1 -1
- package/lib/module/specs/NativePaymentMethodMessagingElement.js +1 -1
- package/lib/module/specs/NativeStripeContainer.js +1 -1
- package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/typescript/src/components/CurrencySelectorElement.d.ts +62 -0
- package/lib/typescript/src/components/CurrencySelectorElement.d.ts.map +1 -0
- package/lib/typescript/src/components/PaymentMethodMessagingElement.d.ts +1 -1
- package/lib/typescript/src/components/PaymentMethodMessagingElement.d.ts.map +1 -1
- package/lib/typescript/src/events.d.ts +11 -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/hooks/useCheckout.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useOnramp.d.ts +22 -0
- package/lib/typescript/src/hooks/useOnramp.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeCurrencySelectorElement.d.ts +25 -0
- package/lib/typescript/src/specs/NativeCurrencySelectorElement.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts +5 -1
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts +3 -0
- package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +5 -2
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/Checkout.d.ts +268 -86
- package/lib/typescript/src/types/Checkout.d.ts.map +1 -1
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +36 -1
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/types/Onramp.d.ts +94 -0
- package/lib/typescript/src/types/Onramp.d.ts.map +1 -1
- package/package.json +16 -4
- package/src/components/CurrencySelectorElement.tsx +95 -0
- package/src/components/PaymentMethodMessagingElement.tsx +54 -52
- package/src/events.ts +11 -0
- package/src/functions.ts +30 -1
- package/src/hooks/useCheckout.tsx +129 -74
- package/src/hooks/useOnramp.tsx +44 -0
- package/src/specs/NativeCurrencySelectorElement.ts +35 -0
- package/src/specs/NativeEmbeddedPaymentElement.ts +12 -2
- package/src/specs/NativeOnrampSdkModule.ts +5 -0
- package/src/specs/NativeStripeSdkModule.ts +16 -2
- package/src/types/Checkout.ts +291 -86
- package/src/types/EmbeddedPaymentElement.tsx +117 -26
- package/src/types/Onramp.ts +109 -0
- package/stripe-react-native.podspec +1 -1
- package/android/.idea/AndroidProjectSystem.xml +0 -6
- package/android/.idea/caches/deviceStreaming.xml +0 -835
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -17
- 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,35 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
3
|
+
import type {
|
|
4
|
+
DirectEventHandler,
|
|
5
|
+
Double,
|
|
6
|
+
WithDefault,
|
|
7
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
8
|
+
|
|
9
|
+
export interface HeightChangeEvent {
|
|
10
|
+
height: Double;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface NativeProps extends ViewProps {
|
|
14
|
+
/**
|
|
15
|
+
* Opaque key returned by `useCheckout`. The native side uses this to look
|
|
16
|
+
* up the matching `Checkout` instance and observe its state — there's no
|
|
17
|
+
* separate session-update event from this view, since `useCheckout`
|
|
18
|
+
* already subscribes to a single `checkoutSessionDidChangeState` channel
|
|
19
|
+
* that mirrors every native-driven mutation back into JS.
|
|
20
|
+
*/
|
|
21
|
+
sessionKey: string;
|
|
22
|
+
|
|
23
|
+
/** When true, the toggle is visible but ignores user interaction. */
|
|
24
|
+
disabled?: WithDefault<boolean, false>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Fired whenever the element's intrinsic height changes so the RN
|
|
28
|
+
* layout system can update the containing view.
|
|
29
|
+
*/
|
|
30
|
+
onHeightChange?: DirectEventHandler<HeightChangeEvent>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default codegenNativeComponent<NativeProps>(
|
|
34
|
+
'StripeCurrencySelectorElement'
|
|
35
|
+
) as HostComponent<NativeProps>;
|
|
@@ -7,7 +7,8 @@ import type { UnsafeMixed } from './utils';
|
|
|
7
7
|
|
|
8
8
|
export interface NativeProps extends ViewProps {
|
|
9
9
|
configuration: UnsafeMixed<EmbeddedPaymentElementConfiguration>;
|
|
10
|
-
intentConfiguration
|
|
10
|
+
intentConfiguration?: UnsafeMixed<IntentConfiguration>;
|
|
11
|
+
checkout?: UnsafeMixed<{ sessionKey: string }>;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export interface NativeCommands {
|
|
@@ -19,10 +20,19 @@ export interface NativeCommands {
|
|
|
19
20
|
viewRef: React.ElementRef<HostComponent<NativeProps>>,
|
|
20
21
|
intentConfigurationJson: string
|
|
21
22
|
) => void;
|
|
23
|
+
updateWithCheckout: (
|
|
24
|
+
viewRef: React.ElementRef<HostComponent<NativeProps>>,
|
|
25
|
+
sessionKey: string
|
|
26
|
+
) => void;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
25
|
-
supportedCommands: [
|
|
30
|
+
supportedCommands: [
|
|
31
|
+
'confirm',
|
|
32
|
+
'clearPaymentOption',
|
|
33
|
+
'update',
|
|
34
|
+
'updateWithCheckout',
|
|
35
|
+
],
|
|
26
36
|
});
|
|
27
37
|
|
|
28
38
|
type ComponentType = HostComponent<NativeProps>;
|
|
@@ -19,6 +19,11 @@ export interface Spec extends TurboModule {
|
|
|
19
19
|
attachKycInfo(
|
|
20
20
|
kycInfo: UnsafeObject<Onramp.KycInfo>
|
|
21
21
|
): Promise<Onramp.VoidResult>;
|
|
22
|
+
retrieveMissingIdentifiers(): Promise<Onramp.RetrieveMissingIdentifiersResult>;
|
|
23
|
+
submitIdentifiers(
|
|
24
|
+
identifiers: ReadonlyArray<UnsafeObject<Onramp.ComplianceIdentifier>>
|
|
25
|
+
): Promise<Onramp.SubmitIdentifiersResult>;
|
|
26
|
+
presentCRSCARFDeclaration(): Promise<Onramp.CRSCARFDeclarationResult>;
|
|
22
27
|
presentKycInfoVerification: (
|
|
23
28
|
updatedAddress: UnsafeObject<Address> | null
|
|
24
29
|
) => Promise<Onramp.VerifyKycResult>;
|
|
@@ -199,12 +199,19 @@ export interface Spec extends TurboModule {
|
|
|
199
199
|
intentConfig: UnsafeObject<IntentConfiguration>,
|
|
200
200
|
configuration: UnsafeObject<EmbeddedPaymentElementConfiguration>
|
|
201
201
|
): Promise<void>;
|
|
202
|
+
createEmbeddedPaymentElementWithCheckout(
|
|
203
|
+
sessionKey: string,
|
|
204
|
+
configuration: UnsafeObject<EmbeddedPaymentElementConfiguration>
|
|
205
|
+
): Promise<void>;
|
|
202
206
|
confirmEmbeddedPaymentElement(
|
|
203
207
|
viewTag: Int32
|
|
204
208
|
): Promise<EmbeddedPaymentElementResult>;
|
|
205
209
|
updateEmbeddedPaymentElement(
|
|
206
210
|
intentConfig: UnsafeObject<IntentConfiguration>
|
|
207
|
-
): Promise<
|
|
211
|
+
): Promise<UnsafeObject<any> | null>;
|
|
212
|
+
updateEmbeddedPaymentElementWithCheckout(
|
|
213
|
+
sessionKey: string
|
|
214
|
+
): Promise<UnsafeObject<any> | null>;
|
|
208
215
|
clearEmbeddedPaymentOption(viewTag: Int32): Promise<void>;
|
|
209
216
|
createRadarSession(): Promise<CreateRadarSessionResult>;
|
|
210
217
|
|
|
@@ -255,7 +262,14 @@ export interface Spec extends TurboModule {
|
|
|
255
262
|
value: string
|
|
256
263
|
): Promise<UnsafeObject<Checkout.State>>;
|
|
257
264
|
|
|
258
|
-
|
|
265
|
+
checkoutRunServerUpdateStart(
|
|
266
|
+
sessionKey: string
|
|
267
|
+
): Promise<UnsafeObject<Checkout.State>>;
|
|
268
|
+
|
|
269
|
+
checkoutRunServerUpdateComplete(
|
|
270
|
+
sessionKey: string,
|
|
271
|
+
error: string | null
|
|
272
|
+
): Promise<void>;
|
|
259
273
|
|
|
260
274
|
setFinancialConnectionsForceNativeFlow(enabled: boolean): Promise<void>;
|
|
261
275
|
|
package/src/types/Checkout.ts
CHANGED
|
@@ -14,7 +14,7 @@ export namespace Checkout {
|
|
|
14
14
|
* When allowed, Stripe may present prices in the customer's local
|
|
15
15
|
* currency alongside the merchant's settlement currency.
|
|
16
16
|
*
|
|
17
|
-
* Default: `{ allowed:
|
|
17
|
+
* Default: `{ allowed: false }`.
|
|
18
18
|
*/
|
|
19
19
|
adaptivePricing?: AdaptivePricing;
|
|
20
20
|
}
|
|
@@ -30,7 +30,7 @@ export namespace Checkout {
|
|
|
30
30
|
* Set to `false` to prevent Stripe from activating adaptive pricing even
|
|
31
31
|
* if the Checkout Session is configured for it on the server.
|
|
32
32
|
*
|
|
33
|
-
* Default: `
|
|
33
|
+
* Default: `false`.
|
|
34
34
|
*/
|
|
35
35
|
allowed: boolean;
|
|
36
36
|
}
|
|
@@ -67,16 +67,81 @@ export namespace Checkout {
|
|
|
67
67
|
session: Session;
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* A Stripe Checkout Session.
|
|
72
|
+
* @checkoutSessionsPreview
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
export interface Session {
|
|
76
|
+
/** Unique identifier for this checkout session. */
|
|
77
|
+
id: string;
|
|
78
|
+
/** The business name as configured in your Stripe account. */
|
|
79
|
+
businessName?: string;
|
|
80
|
+
/** Three-letter ISO 4217 currency code in lowercase (e.g. `"usd"`). */
|
|
81
|
+
currency?: string;
|
|
82
|
+
/** Currency options available when adaptive pricing is active. */
|
|
83
|
+
currencyOptions: CurrencyOption[];
|
|
84
|
+
/** The aggregate amounts calculated per discount for all line items. */
|
|
85
|
+
discountAmounts: DiscountAmount[];
|
|
86
|
+
/** The customer's email address, if available. */
|
|
87
|
+
email?: string;
|
|
88
|
+
/** The line items the customer is purchasing. */
|
|
89
|
+
lineItems: LineItem[];
|
|
90
|
+
/** Indicates whether this session was created in live mode. */
|
|
91
|
+
livemode: boolean;
|
|
92
|
+
/** The factor used to convert between minor and major currency units. */
|
|
93
|
+
minorUnitsAmountDivisor?: number;
|
|
94
|
+
/** The selected shipping option, if any. */
|
|
95
|
+
shipping?: SelectedShipping;
|
|
96
|
+
/** The shipping address set via `updateShippingAddress`, if any. */
|
|
97
|
+
shippingAddress?: ContactAddress;
|
|
98
|
+
/** The shipping rate options available for this session. */
|
|
99
|
+
shippingOptions: ShippingOption[];
|
|
100
|
+
/** The current session status, if available. */
|
|
101
|
+
status?: Status;
|
|
102
|
+
/** Tax computation status and aggregated tax amounts. */
|
|
103
|
+
tax: Tax;
|
|
104
|
+
/** Tax and discount details for the computed total amount. */
|
|
105
|
+
total?: Total;
|
|
106
|
+
/** The billing address set via `updateBillingAddress`, if any. */
|
|
107
|
+
billingAddress?: ContactAddress;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The mode of a checkout session.
|
|
112
|
+
*
|
|
113
|
+
* - `unknown` - A mode not recognized by this version of the SDK.
|
|
114
|
+
* - `payment` - Accept one-time payments.
|
|
115
|
+
* - `setup` - Save payment details to charge later.
|
|
116
|
+
* - `subscription` - Set up fixed-price subscriptions.
|
|
117
|
+
* @checkoutSessionsPreview
|
|
118
|
+
* @internal
|
|
119
|
+
*/
|
|
120
|
+
export type Mode = 'unknown' | 'payment' | 'setup' | 'subscription';
|
|
121
|
+
|
|
70
122
|
/**
|
|
71
123
|
* The status of a checkout session.
|
|
124
|
+
* @checkoutSessionsPreview
|
|
125
|
+
* @internal
|
|
126
|
+
*/
|
|
127
|
+
export interface Status {
|
|
128
|
+
/** The lifecycle status of the session. */
|
|
129
|
+
type: StatusType;
|
|
130
|
+
/** The payment status. Only meaningful when type is `complete`. */
|
|
131
|
+
paymentStatus?: PaymentStatus;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The lifecycle status of a checkout session.
|
|
72
136
|
*
|
|
73
137
|
* - `unknown` - A status not recognized by this version of the SDK.
|
|
74
138
|
* - `open` - The checkout session is still in progress.
|
|
75
139
|
* - `complete` - The checkout session is complete.
|
|
76
140
|
* - `expired` - The checkout session has expired.
|
|
141
|
+
* @checkoutSessionsPreview
|
|
77
142
|
* @internal
|
|
78
143
|
*/
|
|
79
|
-
export type
|
|
144
|
+
export type StatusType = 'unknown' | 'open' | 'complete' | 'expired';
|
|
80
145
|
|
|
81
146
|
/**
|
|
82
147
|
* The payment status of a checkout session.
|
|
@@ -85,6 +150,7 @@ export namespace Checkout {
|
|
|
85
150
|
* - `paid` - The payment funds are available in your account.
|
|
86
151
|
* - `unpaid` - The payment funds are not yet available in your account.
|
|
87
152
|
* - `noPaymentRequired` - No payment is currently required for the session.
|
|
153
|
+
* @checkoutSessionsPreview
|
|
88
154
|
* @internal
|
|
89
155
|
*/
|
|
90
156
|
export type PaymentStatus =
|
|
@@ -94,61 +160,102 @@ export namespace Checkout {
|
|
|
94
160
|
| 'noPaymentRequired';
|
|
95
161
|
|
|
96
162
|
/**
|
|
97
|
-
* A
|
|
163
|
+
* A monetary amount with both a localized display string and a value in
|
|
164
|
+
* the smallest currency unit (e.g. cents).
|
|
165
|
+
* @checkoutSessionsPreview
|
|
98
166
|
* @internal
|
|
99
167
|
*/
|
|
100
|
-
export interface
|
|
101
|
-
/**
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
168
|
+
export interface Amount {
|
|
169
|
+
/** Localized, formatted string including currency symbol (e.g. `"$10.00"`). */
|
|
170
|
+
amount: string;
|
|
171
|
+
/** Value in the smallest currency unit (e.g. cents for USD). */
|
|
172
|
+
minorUnitsAmount: number;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* A monetary amount supporting sub-minor-unit precision.
|
|
177
|
+
*
|
|
178
|
+
* Use this for sub-cent pricing (e.g. usage-based billing) where rounding
|
|
179
|
+
* to the nearest minor unit would lose precision.
|
|
180
|
+
* @checkoutSessionsPreview
|
|
181
|
+
* @internal
|
|
182
|
+
*/
|
|
183
|
+
export interface DecimalAmount {
|
|
184
|
+
/** Localized, formatted string including currency symbol. */
|
|
185
|
+
amount: string;
|
|
186
|
+
/** Value in the smallest currency unit, with decimal precision. */
|
|
187
|
+
minorUnitsAmount: number;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Tax and discount details for the computed total amount of a checkout session.
|
|
192
|
+
* @checkoutSessionsPreview
|
|
193
|
+
* @internal
|
|
194
|
+
*/
|
|
195
|
+
export interface Total {
|
|
196
|
+
/** Total of all line items, excluding tax, discounts, and shipping. */
|
|
197
|
+
subtotal: Amount;
|
|
198
|
+
/** Sum of all exclusive tax amounts. */
|
|
199
|
+
taxExclusive: Amount;
|
|
200
|
+
/** Sum of all inclusive tax amounts. */
|
|
201
|
+
taxInclusive: Amount;
|
|
202
|
+
/** Sum of all shipping amounts. */
|
|
203
|
+
shippingRate: Amount;
|
|
204
|
+
/** Sum of all discounts. A positive number reduces the amount to be paid. */
|
|
205
|
+
discount: Amount;
|
|
206
|
+
/** Grand total, including discounts and tax. */
|
|
207
|
+
total: Amount;
|
|
208
|
+
/** Amount of customer credit balance applied to the payment. */
|
|
209
|
+
appliedBalance: Amount;
|
|
210
|
+
/** When `true`, no payment is collected and the amount is added to the next invoice. */
|
|
211
|
+
balanceAppliedToNextInvoice: boolean;
|
|
127
212
|
}
|
|
128
213
|
|
|
129
214
|
/**
|
|
130
|
-
*
|
|
215
|
+
* Tax computation status and aggregated tax amounts for a checkout session.
|
|
216
|
+
* @checkoutSessionsPreview
|
|
217
|
+
* @internal
|
|
218
|
+
*/
|
|
219
|
+
export interface Tax {
|
|
220
|
+
/** The current tax computation status. */
|
|
221
|
+
status: TaxStatus;
|
|
222
|
+
/** Per-tax-rate amounts, or undefined if tax has not been computed. */
|
|
223
|
+
taxAmounts?: TaxAmount[];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* The tax computation status of a checkout session.
|
|
131
228
|
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
229
|
+
* - `unknown` - A status not recognized by this version of the SDK.
|
|
230
|
+
* - `ready` - Tax is computed and the session is ready for confirmation.
|
|
231
|
+
* - `requiresShippingAddress` - A shipping address is needed to calculate tax.
|
|
232
|
+
* - `requiresBillingAddress` - A billing address is needed to calculate tax.
|
|
233
|
+
* @checkoutSessionsPreview
|
|
234
|
+
* @internal
|
|
235
|
+
*/
|
|
236
|
+
export type TaxStatus =
|
|
237
|
+
| 'unknown'
|
|
238
|
+
| 'ready'
|
|
239
|
+
| 'requiresShippingAddress'
|
|
240
|
+
| 'requiresBillingAddress';
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* A tax amount calculated for a line item, shipping option, or aggregate session total.
|
|
244
|
+
* @checkoutSessionsPreview
|
|
245
|
+
* @internal
|
|
246
|
+
*/
|
|
247
|
+
export interface TaxAmount {
|
|
248
|
+
/** The tax amount. */
|
|
249
|
+
amount: Amount;
|
|
250
|
+
/** Whether this tax is inclusive (already in subtotal) or exclusive (added on top). */
|
|
251
|
+
inclusive: boolean;
|
|
252
|
+
/** A user-facing description (e.g. `"Sales Tax"` or `"VAT 20%"`). */
|
|
253
|
+
displayName: string;
|
|
148
254
|
}
|
|
149
255
|
|
|
150
256
|
/**
|
|
151
257
|
* A line item in a checkout session.
|
|
258
|
+
* @checkoutSessionsPreview
|
|
152
259
|
* @internal
|
|
153
260
|
*/
|
|
154
261
|
export interface LineItem {
|
|
@@ -156,78 +263,172 @@ export namespace Checkout {
|
|
|
156
263
|
id: string;
|
|
157
264
|
/** The display name shown for this line item. */
|
|
158
265
|
name: string;
|
|
159
|
-
/**
|
|
266
|
+
/** An optional, merchant-supplied description. */
|
|
267
|
+
description?: string;
|
|
268
|
+
/** Image URLs configured on the underlying product. */
|
|
269
|
+
images: string[];
|
|
270
|
+
/** The quantity of items being purchased. */
|
|
160
271
|
quantity: number;
|
|
161
|
-
/** The
|
|
162
|
-
unitAmount
|
|
163
|
-
/**
|
|
164
|
-
|
|
272
|
+
/** The cost of a single unit. */
|
|
273
|
+
unitAmount?: Amount;
|
|
274
|
+
/** The unit amount with sub-cent precision. */
|
|
275
|
+
unitAmountDecimal?: DecimalAmount;
|
|
276
|
+
/** Total before any discounts or exclusive taxes. */
|
|
277
|
+
subtotal?: Amount;
|
|
278
|
+
/** Total discount amount for this line item. */
|
|
279
|
+
discount?: Amount;
|
|
280
|
+
/** Total exclusive tax for this line item. */
|
|
281
|
+
taxExclusive?: Amount;
|
|
282
|
+
/** Total inclusive tax for this line item. */
|
|
283
|
+
taxInclusive?: Amount;
|
|
284
|
+
/** Final total for this line item, including discounts and tax. */
|
|
285
|
+
total?: Amount;
|
|
286
|
+
/** Per-discount breakdown for this line item. */
|
|
287
|
+
discountAmounts: DiscountAmount[];
|
|
288
|
+
/** Per-tax-rate breakdown for this line item. */
|
|
289
|
+
taxAmounts: TaxAmount[];
|
|
290
|
+
/** Configuration for adjustable quantity, if enabled. */
|
|
291
|
+
adjustableQuantity?: AdjustableQuantity;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Configuration for a customer-adjustable line item quantity.
|
|
296
|
+
* @checkoutSessionsPreview
|
|
297
|
+
* @internal
|
|
298
|
+
*/
|
|
299
|
+
export interface AdjustableQuantity {
|
|
300
|
+
/** The minimum quantity the customer can purchase. */
|
|
301
|
+
minimum: number;
|
|
302
|
+
/** The maximum quantity the customer can purchase. */
|
|
303
|
+
maximum: number;
|
|
165
304
|
}
|
|
166
305
|
|
|
167
306
|
/**
|
|
168
307
|
* A shipping option available in a checkout session.
|
|
308
|
+
* @checkoutSessionsPreview
|
|
169
309
|
* @internal
|
|
170
310
|
*/
|
|
171
311
|
export interface ShippingOption {
|
|
172
312
|
/** The shipping rate identifier. */
|
|
173
313
|
id: string;
|
|
174
314
|
/** The display name shown to the customer. */
|
|
175
|
-
displayName
|
|
176
|
-
/** The shipping
|
|
177
|
-
amount:
|
|
315
|
+
displayName?: string;
|
|
316
|
+
/** The shipping cost. */
|
|
317
|
+
amount: Amount;
|
|
178
318
|
/** Three-letter ISO 4217 currency code in lowercase. */
|
|
179
319
|
currency: string;
|
|
180
|
-
/** The estimated delivery window
|
|
181
|
-
deliveryEstimate?:
|
|
320
|
+
/** The estimated delivery window, if available. */
|
|
321
|
+
deliveryEstimate?: DeliveryEstimate;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* The estimated delivery range for a shipping option.
|
|
326
|
+
* @checkoutSessionsPreview
|
|
327
|
+
* @internal
|
|
328
|
+
*/
|
|
329
|
+
export interface DeliveryEstimate {
|
|
330
|
+
/** The lower bound of the delivery estimate. */
|
|
331
|
+
minimum?: DeliveryEstimateBound;
|
|
332
|
+
/** The upper bound of the delivery estimate. */
|
|
333
|
+
maximum?: DeliveryEstimateBound;
|
|
182
334
|
}
|
|
183
335
|
|
|
184
336
|
/**
|
|
185
|
-
* A
|
|
337
|
+
* A bound (minimum or maximum) of a delivery estimate.
|
|
338
|
+
* @checkoutSessionsPreview
|
|
186
339
|
* @internal
|
|
187
340
|
*/
|
|
188
|
-
export interface
|
|
189
|
-
/** The
|
|
190
|
-
|
|
341
|
+
export interface DeliveryEstimateBound {
|
|
342
|
+
/** The unit of time. */
|
|
343
|
+
unit: DeliveryEstimateUnit;
|
|
344
|
+
/** The number of units. */
|
|
345
|
+
value: number;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* The unit of time for a delivery estimate.
|
|
350
|
+
* @checkoutSessionsPreview
|
|
351
|
+
* @internal
|
|
352
|
+
*/
|
|
353
|
+
export type DeliveryEstimateUnit =
|
|
354
|
+
| 'unknown'
|
|
355
|
+
| 'hour'
|
|
356
|
+
| 'day'
|
|
357
|
+
| 'businessDay'
|
|
358
|
+
| 'week'
|
|
359
|
+
| 'month';
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* The shipping option selected for a checkout session, plus any computed
|
|
363
|
+
* shipping tax.
|
|
364
|
+
* @checkoutSessionsPreview
|
|
365
|
+
* @internal
|
|
366
|
+
*/
|
|
367
|
+
export interface SelectedShipping {
|
|
368
|
+
/** The selected shipping option. */
|
|
369
|
+
shippingOption: ShippingOption;
|
|
370
|
+
/** Tax amounts calculated for the shipping cost. */
|
|
371
|
+
taxAmounts: TaxAmount[];
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* A discount applied to a checkout session or line item.
|
|
376
|
+
* @checkoutSessionsPreview
|
|
377
|
+
* @internal
|
|
378
|
+
*/
|
|
379
|
+
export interface DiscountAmount {
|
|
380
|
+
/** The discount amount. A positive number reduces the amount to be paid. */
|
|
381
|
+
amount: Amount;
|
|
382
|
+
/** A user-facing description of the discount. */
|
|
383
|
+
displayName: string;
|
|
191
384
|
/** The promotion code used to apply this discount, if any. */
|
|
192
385
|
promotionCode?: string;
|
|
193
|
-
/** The discount amount in the smallest currency unit. */
|
|
194
|
-
amount: number;
|
|
195
386
|
}
|
|
196
387
|
|
|
197
388
|
/**
|
|
198
|
-
* A
|
|
389
|
+
* A currency option available on a checkout session when adaptive pricing
|
|
390
|
+
* is active.
|
|
391
|
+
* @checkoutSessionsPreview
|
|
199
392
|
* @internal
|
|
200
393
|
*/
|
|
201
|
-
export interface
|
|
202
|
-
/** The
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
|
|
208
|
-
/** The fixed amount off, in the smallest currency unit, if applicable. */
|
|
209
|
-
amountOff?: number;
|
|
394
|
+
export interface CurrencyOption {
|
|
395
|
+
/** The total amount in this currency. */
|
|
396
|
+
amount: Amount;
|
|
397
|
+
/** Three-letter ISO 4217 currency code in lowercase. */
|
|
398
|
+
currency: string;
|
|
399
|
+
/** Conversion details, present only for the customer's local currency. */
|
|
400
|
+
currencyConversion?: CurrencyConversion;
|
|
210
401
|
}
|
|
211
402
|
|
|
212
403
|
/**
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
* Address updates are merged into PaymentSheet configuration and may also be
|
|
216
|
-
* sent to Stripe when tax calculation depends on the billing or shipping
|
|
217
|
-
* address.
|
|
404
|
+
* Currency conversion details for an adaptive-pricing currency option.
|
|
405
|
+
* @checkoutSessionsPreview
|
|
218
406
|
* @internal
|
|
219
407
|
*/
|
|
220
|
-
export interface
|
|
408
|
+
export interface CurrencyConversion {
|
|
409
|
+
/** The exchange rate used to convert source to customer currency. */
|
|
410
|
+
fxRate: string;
|
|
411
|
+
/** The merchant's original currency (three-letter ISO 4217 code). */
|
|
412
|
+
sourceCurrency: string;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* A contact address containing a name, phone, and postal address.
|
|
417
|
+
* @checkoutSessionsPreview
|
|
418
|
+
* @internal
|
|
419
|
+
*/
|
|
420
|
+
export interface ContactAddress {
|
|
221
421
|
/** The customer's or recipient's name, if provided. */
|
|
222
422
|
name?: string;
|
|
223
423
|
/** The customer's or recipient's phone number, if provided. */
|
|
224
424
|
phone?: string;
|
|
225
|
-
/** The postal address
|
|
425
|
+
/** The postal address. */
|
|
226
426
|
address: Address;
|
|
227
427
|
}
|
|
228
428
|
|
|
229
429
|
/**
|
|
230
430
|
* A postal address used for billing, shipping, or tax updates.
|
|
431
|
+
* @checkoutSessionsPreview
|
|
231
432
|
* @internal
|
|
232
433
|
*/
|
|
233
434
|
export interface Address {
|
|
@@ -366,12 +567,16 @@ export interface Checkout {
|
|
|
366
567
|
updateTaxId(type: string, value: string): Promise<void>;
|
|
367
568
|
|
|
368
569
|
/**
|
|
369
|
-
*
|
|
570
|
+
* Runs an async operation that updates the Checkout Session on your server,
|
|
571
|
+
* then automatically refreshes the local session state.
|
|
572
|
+
*
|
|
573
|
+
* Call your server inside `serverUpdate` to modify the Checkout Session.
|
|
574
|
+
* A 20-second timeout is enforced by the native SDK.
|
|
370
575
|
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
576
|
+
* @param serverUpdate - An async function that calls your server to update the session.
|
|
577
|
+
* - Throws: `CheckoutError` if the operation times out or fails.
|
|
578
|
+
* @checkoutSessionsPreview
|
|
374
579
|
* @internal
|
|
375
580
|
*/
|
|
376
|
-
|
|
581
|
+
runServerUpdate(serverUpdate: () => Promise<void>): Promise<void>;
|
|
377
582
|
}
|