@stripe/stripe-react-native 0.49.0 → 0.50.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/CHANGELOG.md +17 -0
- package/README.md +1 -1
- package/android/.gradle/8.11.1/checksums/checksums.lock +0 -0
- package/android/.gradle/8.11.1/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.11.1/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.11.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.11.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.11.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.11.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/src/main/AndroidManifest.xml +10 -0
- package/android/src/main/java/com/reactnativestripesdk/CustomPaymentMethodActivity.kt +81 -0
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +96 -1
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +26 -5
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +0 -17
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +17 -6
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +116 -20
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +22 -0
- package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetFragment.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +6 -2
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +52 -6
- package/android/src/main/res/values/styles.xml +27 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +8 -0
- package/ios/ApplePayButtonManager.m +4 -0
- package/ios/ApplePayButtonView.swift +11 -4
- package/ios/Mappers.swift +0 -5
- package/ios/NewArch/ApplePayButtonComponentView.mm +6 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.h +1 -1
- package/ios/OldArch/StripeSdkEventEmitterCompat.m +7 -1
- package/ios/PaymentMethodFactory.swift +0 -17
- package/ios/PaymentSheetAppearance.swift +81 -67
- package/ios/StripeSdk.mm +7 -0
- package/ios/StripeSdkEmitter.swift +1 -0
- package/ios/StripeSdkImpl+Embedded.swift +39 -17
- package/ios/StripeSdkImpl+PaymentSheet.swift +114 -1
- package/ios/StripeSdkImpl.swift +38 -9
- 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/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/EmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/types/PaymentIntent.js.map +1 -1
- package/lib/commonjs/types/PaymentSheet.js +1 -1
- package/lib/commonjs/types/PaymentSheet.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/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/EmbeddedPaymentElement.js +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/module/types/PaymentIntent.js.map +1 -1
- package/lib/module/types/PaymentSheet.js +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/typescript/src/components/PlatformPayButton.d.ts.map +1 -1
- package/lib/typescript/src/events.d.ts +1 -1
- package/lib/typescript/src/events.d.ts.map +1 -1
- package/lib/typescript/src/functions.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeApplePayButton.d.ts +4 -0
- package/lib/typescript/src/specs/NativeApplePayButton.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +2 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +2 -0
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentIntent.d.ts +1 -10
- package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentMethod.d.ts +2 -13
- package/lib/typescript/src/types/PaymentMethod.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +55 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
- package/package.json +1 -1
- package/patches/README.md +55 -0
- package/patches/old-arch-codegen-fix.patch +87 -0
- package/src/components/PlatformPayButton.tsx +12 -4
- package/src/events.ts +2 -1
- package/src/functions.ts +36 -1
- package/src/specs/NativeApplePayButton.ts +5 -0
- package/src/specs/NativeStripeSdkModule.ts +4 -0
- package/src/types/EmbeddedPaymentElement.tsx +33 -0
- package/src/types/PaymentIntent.ts +0 -10
- package/src/types/PaymentMethod.ts +0 -14
- package/src/types/PaymentSheet.ts +59 -0
- package/.env +0 -19
- 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
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Old Architecture Codegen Fix
|
|
2
|
+
|
|
3
|
+
This patch fixes the codegen issue that occurs when using `@stripe/stripe-react-native` with React Native 0.74+ in the old architecture.
|
|
4
|
+
|
|
5
|
+
## The Problem
|
|
6
|
+
|
|
7
|
+
When using React Native 0.74+ with the old architecture, you may encounter this error during pod install:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
UnsupportedModulePropertyParserError: Module NativeStripeSdkModule: TypeScript interfaces extending TurboModule must only contain 'FunctionTypeAnnotation's. Property 'onConfirmHandlerCallback' refers to a 'TSTypeReference'.
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This occurs because the React Native codegen in the old architecture doesn't support `EventEmitter` properties in TurboModule interfaces.
|
|
14
|
+
|
|
15
|
+
## The Solution
|
|
16
|
+
|
|
17
|
+
This patch converts all `EventEmitter` properties to callback function methods, making them compatible with the old architecture codegen.
|
|
18
|
+
|
|
19
|
+
## How to Apply
|
|
20
|
+
|
|
21
|
+
### Option 1: Manual patch command
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cd node_modules/@stripe/stripe-react-native
|
|
25
|
+
patch -p0 < patches/old-arch-codegen-fix.patch
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Option 2: Using patch-package (Recommended)
|
|
29
|
+
|
|
30
|
+
1. Install patch-package as a dev dependency:
|
|
31
|
+
```bash
|
|
32
|
+
npm install --save-dev patch-package
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2. Apply the patch manually first:
|
|
36
|
+
```bash
|
|
37
|
+
cd node_modules/@stripe/stripe-react-native
|
|
38
|
+
patch -p0 < ../../patches/old-arch-codegen-fix.patch
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
3. Generate a patch-package patch:
|
|
42
|
+
```bash
|
|
43
|
+
npx patch-package @stripe/stripe-react-native
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
4. Add postinstall script to your `package.json`:
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"scripts": {
|
|
50
|
+
"postinstall": "patch-package"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This ensures the patch is automatically applied whenever you run `npm install`.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
--- src/specs/NativeStripeSdkModule.ts.orig 2025-07-09 10:31:12.373374861 -0600
|
|
2
|
+
+++ src/specs/NativeStripeSdkModule.ts 2025-07-09 10:31:34.254519742 -0600
|
|
3
|
+
@@ -1,7 +1,6 @@
|
|
4
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
5
|
+
import type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';
|
|
6
|
+
import type {
|
|
7
|
+
- EventEmitter,
|
|
8
|
+
Int32,
|
|
9
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
10
|
+
import type {
|
|
11
|
+
@@ -185,35 +184,47 @@
|
|
12
|
+
): Promise<void>;
|
|
13
|
+
clearEmbeddedPaymentOption(viewTag: Int32): Promise<void>;
|
|
14
|
+
|
|
15
|
+
- // Events
|
|
16
|
+
- onConfirmHandlerCallback: EventEmitter<{
|
|
17
|
+
- paymentMethod: UnsafeObject<PaymentMethod.Result>;
|
|
18
|
+
- shouldSavePaymentMethod: boolean;
|
|
19
|
+
- }>;
|
|
20
|
+
- onFinancialConnectionsEvent: EventEmitter<
|
|
21
|
+
- UnsafeObject<FinancialConnectionsEvent>
|
|
22
|
+
- >;
|
|
23
|
+
- onOrderTrackingCallback: EventEmitter<void>;
|
|
24
|
+
- onCustomerAdapterFetchPaymentMethodsCallback: EventEmitter<void>;
|
|
25
|
+
- onCustomerAdapterAttachPaymentMethodCallback: EventEmitter<{
|
|
26
|
+
- paymentMethodId: string;
|
|
27
|
+
- }>;
|
|
28
|
+
- onCustomerAdapterDetachPaymentMethodCallback: EventEmitter<{
|
|
29
|
+
- paymentMethodId: string;
|
|
30
|
+
- }>;
|
|
31
|
+
- onCustomerAdapterSetSelectedPaymentOptionCallback: EventEmitter<{
|
|
32
|
+
- paymentOption: string;
|
|
33
|
+
- }>;
|
|
34
|
+
- onCustomerAdapterFetchSelectedPaymentOptionCallback: EventEmitter<void>;
|
|
35
|
+
- onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback: EventEmitter<void>;
|
|
36
|
+
- embeddedPaymentElementDidUpdateHeight: EventEmitter<UnsafeObject<any>>;
|
|
37
|
+
- embeddedPaymentElementWillPresent: EventEmitter<void>;
|
|
38
|
+
- embeddedPaymentElementDidUpdatePaymentOption: EventEmitter<UnsafeObject<any>>;
|
|
39
|
+
- embeddedPaymentElementFormSheetConfirmComplete: EventEmitter<
|
|
40
|
+
- UnsafeObject<any>
|
|
41
|
+
- >;
|
|
42
|
+
- embeddedPaymentElementRowSelectionImmediateAction: EventEmitter<void>;
|
|
43
|
+
- embeddedPaymentElementLoadingFailed: EventEmitter<UnsafeObject<any>>;
|
|
44
|
+
+ // Events (callback form for old architecture)
|
|
45
|
+
+ onConfirmHandlerCallback(
|
|
46
|
+
+ callback: (event: {
|
|
47
|
+
+ paymentMethod: UnsafeObject<PaymentMethod.Result>;
|
|
48
|
+
+ shouldSavePaymentMethod: boolean;
|
|
49
|
+
+ }) => void
|
|
50
|
+
+ ): void;
|
|
51
|
+
+ onFinancialConnectionsEvent(
|
|
52
|
+
+ callback: (event: UnsafeObject<FinancialConnectionsEvent>) => void
|
|
53
|
+
+ ): void;
|
|
54
|
+
+ onOrderTrackingCallback(callback: () => void): void;
|
|
55
|
+
+ onCustomerAdapterFetchPaymentMethodsCallback(callback: () => void): void;
|
|
56
|
+
+ onCustomerAdapterAttachPaymentMethodCallback(
|
|
57
|
+
+ callback: (event: { paymentMethodId: string }) => void
|
|
58
|
+
+ ): void;
|
|
59
|
+
+ onCustomerAdapterDetachPaymentMethodCallback(
|
|
60
|
+
+ callback: (event: { paymentMethodId: string }) => void
|
|
61
|
+
+ ): void;
|
|
62
|
+
+ onCustomerAdapterSetSelectedPaymentOptionCallback(
|
|
63
|
+
+ callback: (event: { paymentOption: string }) => void
|
|
64
|
+
+ ): void;
|
|
65
|
+
+ onCustomerAdapterFetchSelectedPaymentOptionCallback(
|
|
66
|
+
+ callback: () => void
|
|
67
|
+
+ ): void;
|
|
68
|
+
+ onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback(
|
|
69
|
+
+ callback: () => void
|
|
70
|
+
+ ): void;
|
|
71
|
+
+ embeddedPaymentElementDidUpdateHeight(
|
|
72
|
+
+ callback: (event: UnsafeObject<any>) => void
|
|
73
|
+
+ ): void;
|
|
74
|
+
+ embeddedPaymentElementWillPresent(callback: () => void): void;
|
|
75
|
+
+ embeddedPaymentElementDidUpdatePaymentOption(
|
|
76
|
+
+ callback: (event: UnsafeObject<any>) => void
|
|
77
|
+
+ ): void;
|
|
78
|
+
+ embeddedPaymentElementFormSheetConfirmComplete(
|
|
79
|
+
+ callback: (event: UnsafeObject<any>) => void
|
|
80
|
+
+ ): void;
|
|
81
|
+
+ embeddedPaymentElementRowSelectionImmediateAction(callback: () => void): void;
|
|
82
|
+
+ embeddedPaymentElementLoadingFailed(
|
|
83
|
+
+ callback: (event: UnsafeObject<any>) => void
|
|
84
|
+
+ ): void;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('StripeSdk');
|
|
@@ -141,6 +141,17 @@ export function PlatformPayButton({
|
|
|
141
141
|
}
|
|
142
142
|
: undefined;
|
|
143
143
|
|
|
144
|
+
const callbackProps: any = {
|
|
145
|
+
onShippingMethodSelectedAction: shippingMethodCallback,
|
|
146
|
+
onShippingContactSelectedAction: shippingContactCallback,
|
|
147
|
+
onCouponCodeEnteredAction: couponCodeCallback,
|
|
148
|
+
onOrderTrackingAction: orderTrackingCallback,
|
|
149
|
+
hasShippingMethodCallback: !!onShippingMethodSelected,
|
|
150
|
+
hasShippingContactCallback: !!onShippingContactSelected,
|
|
151
|
+
hasCouponCodeCallback: !!onCouponCodeEntered,
|
|
152
|
+
hasOrderTrackingCallback: !!setOrderTracking,
|
|
153
|
+
};
|
|
154
|
+
|
|
144
155
|
return (
|
|
145
156
|
<TouchableOpacity
|
|
146
157
|
disabled={disabled}
|
|
@@ -154,11 +165,8 @@ export function PlatformPayButton({
|
|
|
154
165
|
buttonStyle={appearance}
|
|
155
166
|
borderRadius={borderRadius}
|
|
156
167
|
disabled={disabled ?? false}
|
|
157
|
-
onShippingMethodSelectedAction={shippingMethodCallback}
|
|
158
|
-
onShippingContactSelectedAction={shippingContactCallback}
|
|
159
|
-
onCouponCodeEnteredAction={couponCodeCallback}
|
|
160
|
-
onOrderTrackingAction={orderTrackingCallback}
|
|
161
168
|
style={styles.nativeButtonStyle}
|
|
169
|
+
{...callbackProps}
|
|
162
170
|
{...props}
|
|
163
171
|
/>
|
|
164
172
|
) : (
|
package/src/events.ts
CHANGED
|
@@ -37,7 +37,8 @@ type Events =
|
|
|
37
37
|
| 'embeddedPaymentElementRowSelectionImmediateAction'
|
|
38
38
|
| 'embeddedPaymentElementDidUpdatePaymentOption'
|
|
39
39
|
| 'embeddedPaymentElementDidUpdateHeight'
|
|
40
|
-
| 'embeddedPaymentElementLoadingFailed'
|
|
40
|
+
| 'embeddedPaymentElementLoadingFailed'
|
|
41
|
+
| 'onCustomPaymentMethodConfirmHandlerCallback';
|
|
41
42
|
|
|
42
43
|
export function addListener<EventT extends Events>(
|
|
43
44
|
event: EventT,
|
package/src/functions.ts
CHANGED
|
@@ -185,7 +185,10 @@ export const handleNextAction = async (
|
|
|
185
185
|
paymentIntentClientSecret,
|
|
186
186
|
returnURL ?? null
|
|
187
187
|
)
|
|
188
|
-
: await NativeStripeSdk.handleNextAction(
|
|
188
|
+
: await NativeStripeSdk.handleNextAction(
|
|
189
|
+
paymentIntentClientSecret,
|
|
190
|
+
returnURL ?? null
|
|
191
|
+
);
|
|
189
192
|
if (error) {
|
|
190
193
|
return {
|
|
191
194
|
error,
|
|
@@ -352,6 +355,8 @@ export const verifyMicrodepositsForSetup = async (
|
|
|
352
355
|
let confirmHandlerCallback: EventSubscription | null = null;
|
|
353
356
|
let orderTrackingCallbackListener: EventSubscription | null = null;
|
|
354
357
|
let financialConnectionsEventListener: EventSubscription | null = null;
|
|
358
|
+
let paymentSheetCustomPaymentMethodConfirmCallback: EventSubscription | null =
|
|
359
|
+
null;
|
|
355
360
|
|
|
356
361
|
export const initPaymentSheet = async (
|
|
357
362
|
params: PaymentSheet.SetupParams
|
|
@@ -372,6 +377,36 @@ export const initPaymentSheet = async (
|
|
|
372
377
|
);
|
|
373
378
|
}
|
|
374
379
|
|
|
380
|
+
// Setup custom payment method confirmation handler for PaymentSheet
|
|
381
|
+
if (params.customPaymentMethodConfiguration) {
|
|
382
|
+
const customPaymentMethodHandler =
|
|
383
|
+
params.customPaymentMethodConfiguration
|
|
384
|
+
.confirmCustomPaymentMethodCallback;
|
|
385
|
+
if (customPaymentMethodHandler) {
|
|
386
|
+
paymentSheetCustomPaymentMethodConfirmCallback?.remove();
|
|
387
|
+
paymentSheetCustomPaymentMethodConfirmCallback = addListener(
|
|
388
|
+
'onCustomPaymentMethodConfirmHandlerCallback',
|
|
389
|
+
({
|
|
390
|
+
customPaymentMethod,
|
|
391
|
+
billingDetails,
|
|
392
|
+
}: {
|
|
393
|
+
customPaymentMethod: PaymentSheet.CustomPaymentMethod;
|
|
394
|
+
billingDetails: import('./types').BillingDetails | null;
|
|
395
|
+
}) => {
|
|
396
|
+
// Call the user's handler with a result handler callback
|
|
397
|
+
customPaymentMethodHandler(
|
|
398
|
+
customPaymentMethod,
|
|
399
|
+
billingDetails,
|
|
400
|
+
(cpmResult: PaymentSheet.CustomPaymentMethodResult) => {
|
|
401
|
+
// Send the result back to the native side
|
|
402
|
+
NativeStripeSdk.customPaymentMethodResultCallback(cpmResult);
|
|
403
|
+
}
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
375
410
|
const orderTrackingCallback = params?.applePay?.setOrderTracking;
|
|
376
411
|
if (orderTrackingCallback) {
|
|
377
412
|
orderTrackingCallbackListener?.remove();
|
|
@@ -31,6 +31,11 @@ export interface NativeProps extends ViewProps {
|
|
|
31
31
|
onShippingContactSelectedAction?: DirectEventHandler<OnShippingContactSelectedActionEvent>;
|
|
32
32
|
onCouponCodeEnteredAction?: DirectEventHandler<OnCouponCodeEnteredActionEvent>;
|
|
33
33
|
onOrderTrackingAction?: DirectEventHandler<OnOrderTrackingActionEvent>;
|
|
34
|
+
// Boolean flags to indicate which callbacks are provided
|
|
35
|
+
hasShippingMethodCallback?: WithDefault<boolean, false>;
|
|
36
|
+
hasShippingContactCallback?: WithDefault<boolean, false>;
|
|
37
|
+
hasCouponCodeCallback?: WithDefault<boolean, false>;
|
|
38
|
+
hasOrderTrackingCallback?: WithDefault<boolean, false>;
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
type ComponentType = HostComponent<NativeProps>;
|
|
@@ -83,6 +83,9 @@ export interface Spec extends TurboModule {
|
|
|
83
83
|
intentCreationCallback(
|
|
84
84
|
result: UnsafeObject<PaymentSheet.IntentCreationCallbackParams>
|
|
85
85
|
): Promise<void>;
|
|
86
|
+
customPaymentMethodResultCallback(
|
|
87
|
+
result: UnsafeObject<PaymentSheet.CustomPaymentMethodResult>
|
|
88
|
+
): Promise<void>;
|
|
86
89
|
presentPaymentSheet(
|
|
87
90
|
options: UnsafeObject<PaymentSheet.PresentOptions>
|
|
88
91
|
): Promise<PresentPaymentSheetResult>;
|
|
@@ -214,6 +217,7 @@ export interface Spec extends TurboModule {
|
|
|
214
217
|
>;
|
|
215
218
|
embeddedPaymentElementRowSelectionImmediateAction: EventEmitter<void>;
|
|
216
219
|
embeddedPaymentElementLoadingFailed: EventEmitter<UnsafeObject<any>>;
|
|
220
|
+
onCustomPaymentMethodConfirmHandlerCallback: EventEmitter<UnsafeObject<any>>;
|
|
217
221
|
}
|
|
218
222
|
|
|
219
223
|
export default TurboModuleRegistry.getEnforcing<Spec>('StripeSdk');
|
|
@@ -192,6 +192,8 @@ export interface EmbeddedPaymentElementConfiguration {
|
|
|
192
192
|
* The sheet has a button at the bottom. `formSheetAction` controls the action the button performs.
|
|
193
193
|
*/
|
|
194
194
|
formSheetAction?: EmbeddedFormSheetAction;
|
|
195
|
+
/** Configuration for custom payment methods in EmbeddedPaymentElement */
|
|
196
|
+
customPaymentMethodConfiguration?: PaymentSheetTypes.CustomPaymentMethodConfiguration;
|
|
195
197
|
/** The view can display payment methods that, when tapped, do not open a sheet to collect additional details.
|
|
196
198
|
* `rowSelectionBehavior` controls the behavior tapping on these payment methods performs.
|
|
197
199
|
*/
|
|
@@ -239,6 +241,7 @@ class EmbeddedPaymentElement {
|
|
|
239
241
|
// -----------------------------------------------------------------------------
|
|
240
242
|
let confirmHandlerCallback: EventSubscription | null = null;
|
|
241
243
|
let formSheetActionConfirmCallback: EventSubscription | null = null;
|
|
244
|
+
let customPaymentMethodConfirmCallback: EventSubscription | null = null;
|
|
242
245
|
let rowSelectionCallback: EventSubscription | null = null;
|
|
243
246
|
|
|
244
247
|
async function createEmbeddedPaymentElement(
|
|
@@ -294,6 +297,36 @@ function setupConfirmAndSelectionHandlers(
|
|
|
294
297
|
}
|
|
295
298
|
}
|
|
296
299
|
|
|
300
|
+
// Setup custom payment method confirmation handler
|
|
301
|
+
if (configuration.customPaymentMethodConfiguration) {
|
|
302
|
+
const customPaymentMethodHandler =
|
|
303
|
+
configuration.customPaymentMethodConfiguration
|
|
304
|
+
.confirmCustomPaymentMethodCallback;
|
|
305
|
+
if (customPaymentMethodHandler) {
|
|
306
|
+
customPaymentMethodConfirmCallback?.remove();
|
|
307
|
+
customPaymentMethodConfirmCallback = addListener(
|
|
308
|
+
'onCustomPaymentMethodConfirmHandlerCallback',
|
|
309
|
+
({
|
|
310
|
+
customPaymentMethod,
|
|
311
|
+
billingDetails,
|
|
312
|
+
}: {
|
|
313
|
+
customPaymentMethod: PaymentSheetTypes.CustomPaymentMethod;
|
|
314
|
+
billingDetails: BillingDetails | null;
|
|
315
|
+
}) => {
|
|
316
|
+
// Call the user's handler with a result handler callback
|
|
317
|
+
customPaymentMethodHandler(
|
|
318
|
+
customPaymentMethod,
|
|
319
|
+
billingDetails,
|
|
320
|
+
(result: PaymentSheetTypes.CustomPaymentMethodResult) => {
|
|
321
|
+
// Send the result back to the native side
|
|
322
|
+
NativeStripeSdkModule.customPaymentMethodResultCallback(result);
|
|
323
|
+
}
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
297
330
|
if (configuration.rowSelectionBehavior?.type === 'immediateAction') {
|
|
298
331
|
const rowSelectionHandler =
|
|
299
332
|
configuration.rowSelectionBehavior.onSelectPaymentOption;
|
|
@@ -39,7 +39,6 @@ export type ConfirmParams =
|
|
|
39
39
|
| SepaParams
|
|
40
40
|
| EpsParams
|
|
41
41
|
| AuBecsDebitParams
|
|
42
|
-
| SofortParams
|
|
43
42
|
| GrabPayParams
|
|
44
43
|
| FPXParams
|
|
45
44
|
| AfterpayClearpayParams
|
|
@@ -149,15 +148,6 @@ export interface OxxoParams {
|
|
|
149
148
|
};
|
|
150
149
|
}
|
|
151
150
|
|
|
152
|
-
export interface SofortParams {
|
|
153
|
-
paymentMethodType: 'Sofort';
|
|
154
|
-
paymentMethodData: {
|
|
155
|
-
country: string;
|
|
156
|
-
billingDetails: BillingDetails;
|
|
157
|
-
mandateData?: MandateData;
|
|
158
|
-
metadata?: MetaData;
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
151
|
export interface GrabPayParams {
|
|
162
152
|
paymentMethodType: 'GrabPay';
|
|
163
153
|
paymentMethodData?: {
|
|
@@ -20,7 +20,6 @@ export interface Result {
|
|
|
20
20
|
Fpx: FpxResult;
|
|
21
21
|
Ideal: IdealResult;
|
|
22
22
|
SepaDebit: SepaDebitResult;
|
|
23
|
-
Sofort: SofortResult;
|
|
24
23
|
Upi: UpiResult;
|
|
25
24
|
USBankAccount: USBankAccountResult;
|
|
26
25
|
}
|
|
@@ -35,7 +34,6 @@ export type CreateParams =
|
|
|
35
34
|
| SepaParams
|
|
36
35
|
| EpsParams
|
|
37
36
|
| AuBecsDebitParams
|
|
38
|
-
| SofortParams
|
|
39
37
|
| GrabPayParams
|
|
40
38
|
| FPXParams
|
|
41
39
|
| AfterpayClearpayParams
|
|
@@ -98,13 +96,6 @@ export interface OxxoParams {
|
|
|
98
96
|
};
|
|
99
97
|
}
|
|
100
98
|
|
|
101
|
-
export interface SofortParams {
|
|
102
|
-
paymentMethodType: 'Sofort';
|
|
103
|
-
paymentMethodData: {
|
|
104
|
-
country: string;
|
|
105
|
-
billingDetails: BillingDetails;
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
99
|
export interface GrabPayParams {
|
|
109
100
|
paymentMethodType: 'GrabPay';
|
|
110
101
|
paymentMethodData?: {
|
|
@@ -264,10 +255,6 @@ export interface SepaDebitResult {
|
|
|
264
255
|
last4?: string;
|
|
265
256
|
}
|
|
266
257
|
|
|
267
|
-
export interface SofortResult {
|
|
268
|
-
country?: string;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
258
|
export interface UpiResult {
|
|
272
259
|
vpa?: string;
|
|
273
260
|
}
|
|
@@ -300,7 +287,6 @@ export type Type =
|
|
|
300
287
|
| 'Eps'
|
|
301
288
|
| 'Bancontact'
|
|
302
289
|
| 'Oxxo'
|
|
303
|
-
| 'Sofort'
|
|
304
290
|
| 'Upi'
|
|
305
291
|
| 'USBankAccount'
|
|
306
292
|
| 'PayPal'
|
|
@@ -84,6 +84,8 @@ export type SetupParamsBase = IntentParams & {
|
|
|
84
84
|
* Note: Card brand filtering is not currently supported in Link.
|
|
85
85
|
*/
|
|
86
86
|
cardBrandAcceptance?: CardBrandAcceptance;
|
|
87
|
+
/** Configuration for custom payment methods in PaymentSheet */
|
|
88
|
+
customPaymentMethodConfiguration?: CustomPaymentMethodConfiguration;
|
|
87
89
|
};
|
|
88
90
|
|
|
89
91
|
export type SetupParams =
|
|
@@ -666,3 +668,60 @@ export type CardBrandAcceptance =
|
|
|
666
668
|
*/
|
|
667
669
|
brands: CardBrandCategory[];
|
|
668
670
|
};
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* Configuration for a custom payment method.
|
|
674
|
+
*/
|
|
675
|
+
export interface CustomPaymentMethod {
|
|
676
|
+
/** The custom payment method ID (beginning with `cpmt_`) as created in your Stripe Dashboard. */
|
|
677
|
+
id: string;
|
|
678
|
+
/** Optional subtitle to display beneath the custom payment method name. */
|
|
679
|
+
subtitle?: string;
|
|
680
|
+
/** Whether to disable billing detail collection for this custom payment method. Defaults to true. */
|
|
681
|
+
disableBillingDetailCollection?: boolean;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Custom payment method confirmation result type for PaymentSheet.
|
|
686
|
+
*/
|
|
687
|
+
export enum CustomPaymentMethodResultStatus {
|
|
688
|
+
/** The custom payment method transaction was completed successfully */
|
|
689
|
+
Completed = 'completed',
|
|
690
|
+
/** The custom payment method transaction was canceled by the user */
|
|
691
|
+
Canceled = 'canceled',
|
|
692
|
+
/** The custom payment method transaction failed */
|
|
693
|
+
Failed = 'failed',
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Result object returned when a custom payment method transaction completes.
|
|
698
|
+
* Contains the transaction status and, in case of failure, an error message.
|
|
699
|
+
*/
|
|
700
|
+
export type CustomPaymentMethodResult =
|
|
701
|
+
| { status: CustomPaymentMethodResultStatus.Completed }
|
|
702
|
+
| { status: CustomPaymentMethodResultStatus.Canceled }
|
|
703
|
+
| { status: CustomPaymentMethodResultStatus.Failed; error: string };
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Callback function called when a custom payment method is selected and confirmed.
|
|
707
|
+
* Your implementation should complete the payment using your custom payment provider's SDK.
|
|
708
|
+
*/
|
|
709
|
+
export type ConfirmCustomPaymentMethodCallback = (
|
|
710
|
+
customPaymentMethod: CustomPaymentMethod,
|
|
711
|
+
billingDetails: BillingDetails | null,
|
|
712
|
+
/**
|
|
713
|
+
* Call this function with the result of your custom payment method transaction.
|
|
714
|
+
* @param result The result of the custom payment method confirmation
|
|
715
|
+
*/
|
|
716
|
+
resultHandler: (result: CustomPaymentMethodResult) => void
|
|
717
|
+
) => void;
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* Configuration for custom payment methods in PaymentSheet.
|
|
721
|
+
*/
|
|
722
|
+
export interface CustomPaymentMethodConfiguration {
|
|
723
|
+
/** Array of custom payment methods to display in the Payment Sheet */
|
|
724
|
+
customPaymentMethods: CustomPaymentMethod[];
|
|
725
|
+
/** Callback function to handle custom payment method confirmation */
|
|
726
|
+
confirmCustomPaymentMethodCallback: ConfirmCustomPaymentMethodCallback;
|
|
727
|
+
}
|
package/.env
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Stripe API keys - see https://stripe.com/docs/development/quickstart#api-keys
|
|
2
|
-
STRIPE_PUBLISHABLE_KEY=pk_test
|
|
3
|
-
STRIPE_SECRET_KEY=sk_test
|
|
4
|
-
|
|
5
|
-
STRIPE_PUBLISHABLE_KEY_MY=pk_test
|
|
6
|
-
STRIPE_SECRET_KEY_MY=sk_test
|
|
7
|
-
|
|
8
|
-
STRIPE_PUBLISHABLE_KEY_MX=pk_test
|
|
9
|
-
STRIPE_SECRET_KEY_MX=sk_test
|
|
10
|
-
|
|
11
|
-
STRIPE_PUBLISHABLE_KEY_AU=pk_test
|
|
12
|
-
STRIPE_SECRET_KEY_AU=sk_test
|
|
13
|
-
|
|
14
|
-
STRIPE_PUBLISHABLE_KEY_WECHAT=pk_test
|
|
15
|
-
STRIPE_SECRET_KEY_WECHAT=sk_test
|
|
16
|
-
|
|
17
|
-
# Required for webhook forwarding
|
|
18
|
-
# See the README on how to do this with the Stripe CLI
|
|
19
|
-
STRIPE_WEBHOOK_SECRET=whsec_
|
|
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>
|