forked from stripe/stripe-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNativeStripeSdk.tsx
157 lines (154 loc) · 5.25 KB
/
NativeStripeSdk.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import { NativeModules } from 'react-native';
import type {
PaymentMethod,
PaymentIntent,
PlatformPay,
PaymentSheet,
SetupIntent,
InitialiseParams,
CreatePaymentMethodResult,
RetrievePaymentIntentResult,
RetrieveSetupIntentResult,
ConfirmPaymentResult,
HandleNextActionResult,
HandleNextActionForSetupResult,
ConfirmSetupIntentResult,
CreateTokenForCVCUpdateResult,
InitPaymentSheetResult,
PresentPaymentSheetResult,
ConfirmPaymentSheetPaymentResult,
CreateTokenResult,
OpenApplePaySetupResult,
Token,
VerifyMicrodepositsParams,
IsCardInWalletResult,
CanAddCardToWalletParams,
CanAddCardToWalletResult,
FinancialConnections,
CustomerSheetInitParams,
CustomerSheetPresentParams,
CustomerSheetResult,
CustomerSheetError,
StripeError,
CustomerPaymentOption,
CustomerAdapter,
} from './types';
type NativeStripeSdkType = {
initialise(params: InitialiseParams): Promise<void>;
createPaymentMethod(
params: PaymentMethod.CreateParams,
options: PaymentMethod.CreateOptions
): Promise<CreatePaymentMethodResult>;
handleNextAction(
paymentIntentClientSecret: string,
returnURL?: string | null
): Promise<HandleNextActionResult>;
handleNextActionForSetup(
setupIntentClientSecret: string,
returnURL?: string | null
): Promise<HandleNextActionForSetupResult>;
confirmPayment(
paymentIntentClientSecret: string,
params?: PaymentIntent.ConfirmParams,
options?: PaymentIntent.ConfirmOptions
): Promise<ConfirmPaymentResult>;
confirmSetupIntent(
paymentIntentClientSecret: string,
params: SetupIntent.ConfirmParams,
options: SetupIntent.ConfirmOptions
): Promise<ConfirmSetupIntentResult>;
retrievePaymentIntent(
clientSecret: string
): Promise<RetrievePaymentIntentResult>;
retrieveSetupIntent(clientSecret: string): Promise<RetrieveSetupIntentResult>;
initPaymentSheet(
params: PaymentSheet.SetupParams
): Promise<InitPaymentSheetResult>;
intentCreationCallback(
result: PaymentSheet.IntentCreationCallbackParams
): void;
presentPaymentSheet(
options: PaymentSheet.PresentOptions
): Promise<PresentPaymentSheetResult>;
confirmPaymentSheetPayment(): Promise<ConfirmPaymentSheetPaymentResult>;
createTokenForCVCUpdate(cvc: string): Promise<CreateTokenForCVCUpdateResult>;
handleURLCallback(url: string): Promise<boolean>;
createToken(params: Token.CreateParams): Promise<CreateTokenResult>;
openApplePaySetup(): Promise<OpenApplePaySetupResult>;
verifyMicrodeposits(
isPaymentIntent: boolean,
clientSecret: string,
params: VerifyMicrodepositsParams
): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;
collectBankAccount(
isPaymentIntent: boolean,
clientSecret: string,
params: PaymentMethod.CollectBankAccountParams
): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;
getConstants(): { API_VERSIONS: { CORE: string; ISSUING: string } };
canAddCardToWallet(
params: CanAddCardToWalletParams
): Promise<CanAddCardToWalletResult>;
isCardInWallet(params: {
cardLastFour: string;
}): Promise<IsCardInWalletResult>;
collectBankAccountToken(
clientSecret: string
): Promise<FinancialConnections.TokenResult>;
collectFinancialConnectionsAccounts(
clientSecret: string
): Promise<FinancialConnections.SessionResult>;
resetPaymentSheetCustomer(): Promise<null>;
isPlatformPaySupported(params: {
googlePay?: PlatformPay.IsGooglePaySupportedParams;
}): Promise<boolean>;
createPlatformPayPaymentMethod(
params: PlatformPay.PaymentMethodParams,
usesDeprecatedTokenFlow: boolean
): Promise<PlatformPay.PaymentMethodResult | PlatformPay.TokenResult>;
dismissPlatformPay(): Promise<boolean>;
updatePlatformPaySheet(
summaryItems: Array<PlatformPay.CartSummaryItem>,
shippingMethods: Array<PlatformPay.ShippingMethod>,
errors: Array<PlatformPay.ApplePaySheetError>
): Promise<void>;
confirmPlatformPay(
clientSecret: string,
params: PlatformPay.ConfirmParams,
isPaymentIntent: boolean
): Promise<
PlatformPay.ConfirmPaymentResult | PlatformPay.ConfirmSetupIntentResult
>;
configureOrderTracking(
orderTypeIdentifier: string,
orderIdentifier: string,
webServiceUrl: string,
authenticationToken: string
): Promise<void>;
initCustomerSheet(
params: CustomerSheetInitParams,
customerAdapterOverrides: { [Property in keyof CustomerAdapter]: boolean }
): Promise<{ error?: StripeError<CustomerSheetError> }>;
presentCustomerSheet(
params: CustomerSheetPresentParams
): Promise<CustomerSheetResult>;
retrieveCustomerSheetPaymentOptionSelection(): Promise<CustomerSheetResult>;
customerAdapterFetchPaymentMethodsCallback(
paymentMethods: Array<object>
): Promise<void>;
customerAdapterAttachPaymentMethodCallback(
paymentMethod: object
): Promise<void>;
customerAdapterDetachPaymentMethodCallback(
paymentMethod: object
): Promise<void>;
customerAdapterSetSelectedPaymentOptionCallback(): Promise<void>;
customerAdapterFetchSelectedPaymentOptionCallback(
paymentOption: CustomerPaymentOption | null
): Promise<void>;
customerAdapterSetupIntentClientSecretForCustomerAttachCallback(
clientSecret: String
): Promise<void>;
};
const { StripeSdk } = NativeModules;
export default StripeSdk as NativeStripeSdkType;