@stripe/stripe-react-native 0.5.0 → 0.6.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/CHANGELOG.md +8 -0
- package/android/src/main/java/com/reactnativestripesdk/Mappers.kt +46 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +15 -8
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +1 -1
- package/ios/.DS_Store +0 -0
- package/ios/Errors.swift +9 -35
- package/ios/Mappers.swift +105 -2
- package/ios/PaymentMethodFactory.swift +46 -1
- package/ios/StripeSdk.m +14 -0
- package/ios/StripeSdk.swift +284 -103
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- package/lib/commonjs/types/NextAction.js +2 -0
- package/lib/commonjs/types/NextAction.js.map +1 -0
- package/lib/commonjs/types/PaymentIntents.js.map +1 -1
- package/lib/commonjs/types/PaymentMethods.js.map +1 -1
- package/lib/commonjs/types/SetupIntent.js.map +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/NativeStripeSdk.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- package/lib/module/types/NextAction.js +2 -0
- package/lib/module/types/NextAction.js.map +1 -0
- package/lib/module/types/PaymentIntents.js.map +1 -1
- package/lib/module/types/PaymentMethods.js.map +1 -1
- package/lib/module/types/SetupIntent.js.map +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/e2e/helpers.d.ts +1 -0
- package/lib/typescript/e2e/screenObject/BasicPaymentScreen.d.ts +1 -0
- package/lib/typescript/e2e/screenObject/HomeScreen.d.ts +1 -1
- package/lib/typescript/example/src/App.d.ts +2 -0
- package/lib/typescript/example/src/screens/ACHPaymentScreen.d.ts +1 -0
- package/lib/typescript/example/src/screens/ACHSetupScreen.d.ts +1 -0
- package/lib/typescript/src/NativeStripeSdk.d.ts +3 -1
- package/lib/typescript/src/functions.d.ts +5 -1
- package/lib/typescript/src/hooks/useStripe.d.ts +5 -1
- package/lib/typescript/src/types/NextAction.d.ts +32 -0
- package/lib/typescript/src/types/PaymentIntents.d.ts +2 -0
- package/lib/typescript/src/types/PaymentMethods.d.ts +28 -2
- package/lib/typescript/src/types/SetupIntent.d.ts +4 -2
- package/lib/typescript/src/types/index.d.ts +15 -1
- package/package.json +3 -3
- package/src/NativeStripeSdk.tsx +12 -0
- package/src/functions.ts +146 -0
- package/src/hooks/useStripe.tsx +50 -0
- package/src/types/NextAction.ts +44 -0
- package/src/types/PaymentIntents.ts +2 -0
- package/src/types/PaymentMethods.ts +31 -2
- package/src/types/SetupIntent.ts +9 -2
- package/src/types/index.ts +24 -1
- package/stripe-react-native.podspec +3 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AuBECSDebitFormComponent } from './components/AuBECSDebitForm';
|
|
2
2
|
import type { Card } from './Card';
|
|
3
3
|
import type { PaymentIntents } from './PaymentIntents';
|
|
4
|
+
import type { BankAcccountHolderType, BankAcccountType } from './index';
|
|
4
5
|
export interface PaymentMethod {
|
|
5
6
|
id: string;
|
|
6
7
|
liveMode: boolean;
|
|
@@ -17,7 +18,7 @@ export interface PaymentMethod {
|
|
|
17
18
|
Upi: PaymentMethods.Upi;
|
|
18
19
|
}
|
|
19
20
|
export declare namespace PaymentMethodCreateParams {
|
|
20
|
-
type Params = CardParams | IdealParams | OxxoParams | P24Params | AlipayParams | GiropayParams | SepaParams | EpsParams | AuBecsDebitParams | SofortParams | GrabPayParams | FPXParams | AfterpayClearpayParams | KlarnaParams | BancontactParams;
|
|
21
|
+
type Params = CardParams | IdealParams | OxxoParams | P24Params | AlipayParams | GiropayParams | SepaParams | EpsParams | AuBecsDebitParams | SofortParams | GrabPayParams | FPXParams | AfterpayClearpayParams | KlarnaParams | BancontactParams | USBankAccountParams;
|
|
21
22
|
type BillingDetails = {
|
|
22
23
|
email?: string;
|
|
23
24
|
name?: string;
|
|
@@ -109,6 +110,20 @@ export declare namespace PaymentMethodCreateParams {
|
|
|
109
110
|
type: 'AuBecsDebit';
|
|
110
111
|
formDetails: AuBECSDebitFormComponent.FormDetails;
|
|
111
112
|
}
|
|
113
|
+
/** Before using this payment method type, ensure you have already collected the bank information
|
|
114
|
+
* for this intent with `collectBankAccountForPayment`. Otherwise, you will need to pass in the bank account
|
|
115
|
+
* details manually.*/
|
|
116
|
+
type USBankAccountParams = {
|
|
117
|
+
type: 'USBankAccount';
|
|
118
|
+
billingDetails?: Pick<Required<BillingDetails>, 'name'> & BillingDetails;
|
|
119
|
+
accountNumber?: string;
|
|
120
|
+
routingNumber?: string;
|
|
121
|
+
/** Defaults to Individual */
|
|
122
|
+
accountHolderType?: BankAcccountHolderType;
|
|
123
|
+
/** Defaults to Checking */
|
|
124
|
+
accountType?: BankAcccountType;
|
|
125
|
+
setupFutureUsage?: PaymentIntents.FutureUsage;
|
|
126
|
+
};
|
|
112
127
|
}
|
|
113
128
|
export declare namespace PaymentMethods {
|
|
114
129
|
interface BillingDetails {
|
|
@@ -163,5 +178,16 @@ export declare namespace PaymentMethods {
|
|
|
163
178
|
interface Upi {
|
|
164
179
|
vpa?: string;
|
|
165
180
|
}
|
|
166
|
-
type
|
|
181
|
+
type USBankAccount = {
|
|
182
|
+
routingNumber?: string;
|
|
183
|
+
accountHolderType?: BankAcccountHolderType;
|
|
184
|
+
accountType?: BankAcccountType;
|
|
185
|
+
last4?: string;
|
|
186
|
+
bankName?: string;
|
|
187
|
+
linkedAccount?: string;
|
|
188
|
+
fingerprint?: string;
|
|
189
|
+
preferredNetwork?: string;
|
|
190
|
+
supportedNetworks?: string[];
|
|
191
|
+
};
|
|
192
|
+
type Types = 'AfterpayClearpay' | 'Card' | 'Alipay' | 'GrabPay' | 'Ideal' | 'Fpx' | 'CardPresent' | 'SepaDebit' | 'AuBecsDebit' | 'BacsDebit' | 'Giropay' | 'P24' | 'Eps' | 'Bancontact' | 'Oxxo' | 'Sofort' | 'Upi' | 'USBankAccount' | 'Unknown';
|
|
167
193
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Nullable, StripeError } from '.';
|
|
2
2
|
import type { AuBECSDebitFormComponent } from './components/AuBECSDebitForm';
|
|
3
|
-
import type {
|
|
3
|
+
import type { NextAction } from './NextAction';
|
|
4
|
+
import type { PaymentMethod, PaymentMethods, PaymentMethodCreateParams } from './PaymentMethods';
|
|
4
5
|
export interface SetupIntent {
|
|
5
6
|
id: string;
|
|
6
7
|
clientSecret: string;
|
|
@@ -12,12 +13,13 @@ export interface SetupIntent {
|
|
|
12
13
|
paymentMethodTypes: PaymentMethods.Types[];
|
|
13
14
|
usage: SetupIntents.FutureUsage;
|
|
14
15
|
description: Nullable<string>;
|
|
16
|
+
nextAction: NextAction | null;
|
|
15
17
|
}
|
|
16
18
|
export declare namespace ConfirmSetupIntent {
|
|
17
19
|
type LastPaymentError = StripeError<string> & {
|
|
18
20
|
paymentMethod: PaymentMethod;
|
|
19
21
|
};
|
|
20
|
-
type Params = CardParams | IdealParams | BancontactParams | SofortParams | AuBecsDebitParams | SepaParams;
|
|
22
|
+
type Params = CardParams | IdealParams | BancontactParams | SofortParams | AuBecsDebitParams | SepaParams | PaymentMethodCreateParams.USBankAccountParams;
|
|
21
23
|
interface Options {
|
|
22
24
|
}
|
|
23
25
|
interface BaseParams {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Card } from './Card';
|
|
2
2
|
import type { ApplePayError, CardActionError, ConfirmPaymentError, ConfirmSetupIntentError, CreatePaymentMethodError, CreateTokenError, GooglePayError, PaymentSheetError, RetrievePaymentIntentError, RetrieveSetupIntentError, StripeError } from './Errors';
|
|
3
3
|
import type { PaymentIntent } from './PaymentIntents';
|
|
4
|
-
import type { PaymentMethod } from './PaymentMethods';
|
|
4
|
+
import type { PaymentMethod, PaymentMethodCreateParams } from './PaymentMethods';
|
|
5
5
|
import type { PaymentSheet } from './PaymentSheet';
|
|
6
6
|
import type { SetupIntent } from './SetupIntent';
|
|
7
7
|
import type { ThreeDSecureConfigurationParams } from './ThreeDSecure';
|
|
@@ -162,6 +162,7 @@ export declare type CreateTokenCardParams = {
|
|
|
162
162
|
currency?: string;
|
|
163
163
|
};
|
|
164
164
|
export declare type BankAcccountHolderType = 'Company' | 'Individual';
|
|
165
|
+
export declare type BankAcccountType = 'Checking' | 'Savings';
|
|
165
166
|
export declare type CreateTokenBankAccountParams = {
|
|
166
167
|
type: 'BankAccount';
|
|
167
168
|
accountHolderName?: string;
|
|
@@ -171,3 +172,16 @@ export declare type CreateTokenBankAccountParams = {
|
|
|
171
172
|
currency: string;
|
|
172
173
|
routingNumber?: string;
|
|
173
174
|
};
|
|
175
|
+
export declare type VerifyMicrodepositsParams = {
|
|
176
|
+
amounts: number[];
|
|
177
|
+
descriptorCode?: undefined;
|
|
178
|
+
} | {
|
|
179
|
+
amounts?: undefined;
|
|
180
|
+
descriptorCode: string;
|
|
181
|
+
};
|
|
182
|
+
export declare type CollectBankAccountParams = PaymentMethodCreateParams.USBankAccountParams & {
|
|
183
|
+
billingDetails: {
|
|
184
|
+
name: string;
|
|
185
|
+
email?: string;
|
|
186
|
+
};
|
|
187
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripe/stripe-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"author": "Stripe",
|
|
5
5
|
"description": "Stripe SDK for React Native",
|
|
6
6
|
"main": "lib/commonjs/index",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"bootstrap": "yarn example && yarn && yarn pods",
|
|
30
30
|
"bootstrap-no-pods": "yarn example && yarn",
|
|
31
31
|
"docs": "yarn typedoc ./src/index.tsx --out ./docs/api-reference --tsconfig ./tsconfig.json --readme none",
|
|
32
|
-
"run-example-ios": "cd example;ENVFILE=.env.ci react-native run-ios --configuration Release --simulator \"iPhone
|
|
32
|
+
"run-example-ios": "cd example;ENVFILE=.env.ci react-native run-ios --configuration Release --simulator \"iPhone 13 (15.2)\"",
|
|
33
33
|
"run-example-android": "cd example;ENVFILE=.env.ci react-native run-android --variant=release",
|
|
34
34
|
"test:ios": "mkdir -p .tmp/screenshots && node ./run-appium-tests.js ios",
|
|
35
35
|
"test:android": "mkdir -p .tmp/screenshots && node ./run-appium-tests.js android"
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@wdio/mocha-framework": "^7.16.15",
|
|
59
59
|
"@wdio/spec-reporter": "^7.16.14",
|
|
60
60
|
"@wdio/sync": "^7.16.15",
|
|
61
|
-
"appium": "^1.22.
|
|
61
|
+
"appium": "^1.22.2",
|
|
62
62
|
"appium-chromedriver": "4.26.2",
|
|
63
63
|
"eslint": "^7.14.0",
|
|
64
64
|
"eslint-config-prettier": "^6.11.0",
|
package/src/NativeStripeSdk.tsx
CHANGED
|
@@ -23,6 +23,8 @@ import type {
|
|
|
23
23
|
GooglePay,
|
|
24
24
|
OpenApplePaySetupResult,
|
|
25
25
|
CreateTokenParams,
|
|
26
|
+
VerifyMicrodepositsParams,
|
|
27
|
+
CollectBankAccountParams,
|
|
26
28
|
} from './types';
|
|
27
29
|
|
|
28
30
|
type NativeStripeSdkType = {
|
|
@@ -77,6 +79,16 @@ type NativeStripeSdkType = {
|
|
|
77
79
|
params: GooglePay.CreatePaymentMethodParams
|
|
78
80
|
): Promise<CreateGooglePayPaymentMethodResult>;
|
|
79
81
|
openApplePaySetup(): Promise<OpenApplePaySetupResult>;
|
|
82
|
+
verifyMicrodeposits(
|
|
83
|
+
type: 'payment' | 'setup',
|
|
84
|
+
clientSecret: string,
|
|
85
|
+
params: VerifyMicrodepositsParams
|
|
86
|
+
): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;
|
|
87
|
+
collectBankAccount(
|
|
88
|
+
type: 'payment' | 'setup',
|
|
89
|
+
clientSecret: string,
|
|
90
|
+
params: CollectBankAccountParams
|
|
91
|
+
): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;
|
|
80
92
|
};
|
|
81
93
|
|
|
82
94
|
const { StripeSdk } = NativeModules;
|
package/src/functions.ts
CHANGED
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
ApplePayError,
|
|
7
7
|
ApplePayResult,
|
|
8
8
|
ConfirmPaymentResult,
|
|
9
|
+
ConfirmPaymentError,
|
|
10
|
+
ConfirmSetupIntentError,
|
|
9
11
|
ConfirmPaymentSheetPaymentResult,
|
|
10
12
|
ConfirmSetupIntent,
|
|
11
13
|
ConfirmSetupIntentResult,
|
|
@@ -26,10 +28,14 @@ import {
|
|
|
26
28
|
CreateGooglePayPaymentMethodResult,
|
|
27
29
|
OpenApplePaySetupResult,
|
|
28
30
|
CreateTokenParams,
|
|
31
|
+
VerifyMicrodepositsParams,
|
|
32
|
+
CollectBankAccountParams,
|
|
29
33
|
} from './types';
|
|
30
34
|
|
|
31
35
|
const APPLE_PAY_NOT_SUPPORTED_MESSAGE =
|
|
32
36
|
'Apple pay is not supported on this device';
|
|
37
|
+
const PAYMENT_INTENT = 'payment';
|
|
38
|
+
const SETUP_INTENT = 'setup';
|
|
33
39
|
|
|
34
40
|
export const createPaymentMethod = async (
|
|
35
41
|
data: PaymentMethodCreateParams.Params,
|
|
@@ -339,6 +345,76 @@ export const handleURLCallback = async (url: string): Promise<boolean> => {
|
|
|
339
345
|
return stripeHandled;
|
|
340
346
|
};
|
|
341
347
|
|
|
348
|
+
export const verifyMicrodepositsForPayment = async (
|
|
349
|
+
clientSecret: string,
|
|
350
|
+
params: VerifyMicrodepositsParams
|
|
351
|
+
): Promise<ConfirmPaymentResult> => {
|
|
352
|
+
if (isAndroid) {
|
|
353
|
+
return {
|
|
354
|
+
error: createError({
|
|
355
|
+
code: ConfirmPaymentError.Failed,
|
|
356
|
+
message:
|
|
357
|
+
'verifyMicrodepositsForPayment is only supported on iOS on this version of @stripe/stripe-react-native. Please verify with paymentIntent.nextAction.redirectUrl',
|
|
358
|
+
}),
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
try {
|
|
362
|
+
const { paymentIntent, error } = (await NativeStripeSdk.verifyMicrodeposits(
|
|
363
|
+
PAYMENT_INTENT,
|
|
364
|
+
clientSecret,
|
|
365
|
+
params
|
|
366
|
+
)) as ConfirmPaymentResult;
|
|
367
|
+
|
|
368
|
+
if (error) {
|
|
369
|
+
return {
|
|
370
|
+
error,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
return {
|
|
374
|
+
paymentIntent: paymentIntent!,
|
|
375
|
+
};
|
|
376
|
+
} catch (error) {
|
|
377
|
+
return {
|
|
378
|
+
error: createError(error),
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
export const verifyMicrodepositsForSetup = async (
|
|
384
|
+
clientSecret: string,
|
|
385
|
+
params: VerifyMicrodepositsParams
|
|
386
|
+
): Promise<ConfirmSetupIntentResult> => {
|
|
387
|
+
if (isAndroid) {
|
|
388
|
+
return {
|
|
389
|
+
error: createError({
|
|
390
|
+
code: ConfirmSetupIntentError.Failed,
|
|
391
|
+
message:
|
|
392
|
+
'verifyMicrodepositsForSetup is only supported on iOS on this version of @stripe/stripe-react-native. Please verify with setupIntent.nextAction.redirectUrl',
|
|
393
|
+
}),
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
try {
|
|
397
|
+
const { setupIntent, error } = (await NativeStripeSdk.verifyMicrodeposits(
|
|
398
|
+
SETUP_INTENT,
|
|
399
|
+
clientSecret,
|
|
400
|
+
params
|
|
401
|
+
)) as ConfirmSetupIntentResult;
|
|
402
|
+
|
|
403
|
+
if (error) {
|
|
404
|
+
return {
|
|
405
|
+
error,
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
return {
|
|
409
|
+
setupIntent: setupIntent!,
|
|
410
|
+
};
|
|
411
|
+
} catch (error) {
|
|
412
|
+
return {
|
|
413
|
+
error: createError(error),
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
|
|
342
418
|
export const initPaymentSheet = async (
|
|
343
419
|
params: PaymentSheet.SetupParams
|
|
344
420
|
): Promise<InitPaymentSheetResult> => {
|
|
@@ -478,3 +554,73 @@ export const openApplePaySetup = async (): Promise<OpenApplePaySetupResult> => {
|
|
|
478
554
|
};
|
|
479
555
|
}
|
|
480
556
|
};
|
|
557
|
+
|
|
558
|
+
export const collectBankAccountForPayment = async (
|
|
559
|
+
clientSecret: string,
|
|
560
|
+
params: CollectBankAccountParams
|
|
561
|
+
): Promise<ConfirmPaymentResult> => {
|
|
562
|
+
if (isAndroid) {
|
|
563
|
+
return {
|
|
564
|
+
error: createError({
|
|
565
|
+
code: ConfirmPaymentError.Failed,
|
|
566
|
+
message:
|
|
567
|
+
'collectBankAccountForPayment is only supported on iOS on this version of @stripe/stripe-react-native.',
|
|
568
|
+
}),
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
try {
|
|
572
|
+
const { paymentIntent, error } = (await NativeStripeSdk.collectBankAccount(
|
|
573
|
+
PAYMENT_INTENT,
|
|
574
|
+
clientSecret,
|
|
575
|
+
params
|
|
576
|
+
)) as ConfirmPaymentResult;
|
|
577
|
+
|
|
578
|
+
if (error) {
|
|
579
|
+
return {
|
|
580
|
+
error,
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
return {
|
|
584
|
+
paymentIntent: paymentIntent!,
|
|
585
|
+
};
|
|
586
|
+
} catch (error) {
|
|
587
|
+
return {
|
|
588
|
+
error: createError(error),
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
export const collectBankAccountForSetup = async (
|
|
594
|
+
clientSecret: string,
|
|
595
|
+
params: CollectBankAccountParams
|
|
596
|
+
): Promise<ConfirmSetupIntentResult> => {
|
|
597
|
+
if (isAndroid) {
|
|
598
|
+
return {
|
|
599
|
+
error: createError({
|
|
600
|
+
code: ConfirmSetupIntentError.Failed,
|
|
601
|
+
message:
|
|
602
|
+
'collectBankAccountForSetup is only supported on iOS on this version of @stripe/stripe-react-native.',
|
|
603
|
+
}),
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
try {
|
|
607
|
+
const { setupIntent, error } = (await NativeStripeSdk.collectBankAccount(
|
|
608
|
+
SETUP_INTENT,
|
|
609
|
+
clientSecret,
|
|
610
|
+
params
|
|
611
|
+
)) as ConfirmSetupIntentResult;
|
|
612
|
+
|
|
613
|
+
if (error) {
|
|
614
|
+
return {
|
|
615
|
+
error,
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
return {
|
|
619
|
+
setupIntent: setupIntent!,
|
|
620
|
+
};
|
|
621
|
+
} catch (error) {
|
|
622
|
+
return {
|
|
623
|
+
error: createError(error),
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
};
|
package/src/hooks/useStripe.tsx
CHANGED
|
@@ -23,6 +23,8 @@ import type {
|
|
|
23
23
|
CreateGooglePayPaymentMethodResult,
|
|
24
24
|
OpenApplePaySetupResult,
|
|
25
25
|
CreateTokenParams,
|
|
26
|
+
VerifyMicrodepositsParams,
|
|
27
|
+
CollectBankAccountParams,
|
|
26
28
|
} from '../types';
|
|
27
29
|
import { useCallback, useEffect, useState } from 'react';
|
|
28
30
|
import { isiOS } from '../helpers';
|
|
@@ -48,6 +50,10 @@ import {
|
|
|
48
50
|
createGooglePayPaymentMethod,
|
|
49
51
|
presentGooglePay,
|
|
50
52
|
openApplePaySetup,
|
|
53
|
+
collectBankAccountForPayment,
|
|
54
|
+
collectBankAccountForSetup,
|
|
55
|
+
verifyMicrodepositsForPayment,
|
|
56
|
+
verifyMicrodepositsForSetup,
|
|
51
57
|
} from '../functions';
|
|
52
58
|
|
|
53
59
|
/**
|
|
@@ -229,6 +235,46 @@ export function useStripe() {
|
|
|
229
235
|
return openApplePaySetup();
|
|
230
236
|
}, []);
|
|
231
237
|
|
|
238
|
+
const _collectBankAccountForPayment = useCallback(
|
|
239
|
+
async (
|
|
240
|
+
clientSecret: string,
|
|
241
|
+
params: CollectBankAccountParams
|
|
242
|
+
): Promise<ConfirmPaymentResult> => {
|
|
243
|
+
return collectBankAccountForPayment(clientSecret, params);
|
|
244
|
+
},
|
|
245
|
+
[]
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
const _collectBankAccountForSetup = useCallback(
|
|
249
|
+
async (
|
|
250
|
+
clientSecret: string,
|
|
251
|
+
params: CollectBankAccountParams
|
|
252
|
+
): Promise<ConfirmSetupIntentResult> => {
|
|
253
|
+
return collectBankAccountForSetup(clientSecret, params);
|
|
254
|
+
},
|
|
255
|
+
[]
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
const _verifyMicrodepositsForPayment = useCallback(
|
|
259
|
+
async (
|
|
260
|
+
clientSecret: string,
|
|
261
|
+
params: VerifyMicrodepositsParams
|
|
262
|
+
): Promise<ConfirmPaymentResult> => {
|
|
263
|
+
return verifyMicrodepositsForPayment(clientSecret, params);
|
|
264
|
+
},
|
|
265
|
+
[]
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
const _verifyMicrodepositsForSetup = useCallback(
|
|
269
|
+
async (
|
|
270
|
+
clientSecret: string,
|
|
271
|
+
params: VerifyMicrodepositsParams
|
|
272
|
+
): Promise<ConfirmSetupIntentResult> => {
|
|
273
|
+
return verifyMicrodepositsForSetup(clientSecret, params);
|
|
274
|
+
},
|
|
275
|
+
[]
|
|
276
|
+
);
|
|
277
|
+
|
|
232
278
|
return {
|
|
233
279
|
retrievePaymentIntent: _retrievePaymentIntent,
|
|
234
280
|
retrieveSetupIntent: _retrieveSetupIntent,
|
|
@@ -252,5 +298,9 @@ export function useStripe() {
|
|
|
252
298
|
presentGooglePay: _presentGooglePay,
|
|
253
299
|
createGooglePayPaymentMethod: _createGooglePayPaymentMethod,
|
|
254
300
|
openApplePaySetup: _openApplePaySetup,
|
|
301
|
+
collectBankAccountForPayment: _collectBankAccountForPayment,
|
|
302
|
+
collectBankAccountForSetup: _collectBankAccountForSetup,
|
|
303
|
+
verifyMicrodepositsForPayment: _verifyMicrodepositsForPayment,
|
|
304
|
+
verifyMicrodepositsForSetup: _verifyMicrodepositsForSetup,
|
|
255
305
|
};
|
|
256
306
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type NextAction =
|
|
2
|
+
| VerifyWithMicrodepositsAction
|
|
3
|
+
| UrlRedirectAction
|
|
4
|
+
| WeChatRedirectAction
|
|
5
|
+
| AlipayRedirectAction
|
|
6
|
+
| BoletoVoucherAction
|
|
7
|
+
| OxxoVoucherAction;
|
|
8
|
+
|
|
9
|
+
export type VerifyWithMicrodepositsAction = {
|
|
10
|
+
type: 'verifyWithMicrodeposits';
|
|
11
|
+
redirectUrl: string;
|
|
12
|
+
microdepositType: string;
|
|
13
|
+
arrivalDate: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type UrlRedirectAction = {
|
|
17
|
+
type: 'urlRedirect';
|
|
18
|
+
redirectUrl: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type WeChatRedirectAction = {
|
|
22
|
+
type: 'weChatRedirect';
|
|
23
|
+
redirectUrl: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type AlipayRedirectAction = {
|
|
27
|
+
type: 'alipayRedirect';
|
|
28
|
+
redirectUrl: string;
|
|
29
|
+
nativeRedirectUrl: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type BoletoVoucherAction = {
|
|
33
|
+
type: 'boletoVoucher';
|
|
34
|
+
expiration: number;
|
|
35
|
+
voucherURL: string;
|
|
36
|
+
voucherNumber: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type OxxoVoucherAction = {
|
|
40
|
+
type: 'oxxoVoucher';
|
|
41
|
+
expiration: number;
|
|
42
|
+
voucherURL: string;
|
|
43
|
+
voucherNumber: string;
|
|
44
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Nullable, StripeError } from '.';
|
|
2
|
+
import type { NextAction } from './NextAction';
|
|
2
3
|
import type { PaymentMethod } from './PaymentMethods';
|
|
3
4
|
|
|
4
5
|
export interface PaymentIntent {
|
|
@@ -17,6 +18,7 @@ export interface PaymentIntent {
|
|
|
17
18
|
confirmationMethod: 'Automatic' | 'Manual';
|
|
18
19
|
lastPaymentError: Nullable<PaymentIntents.LastPaymentError>;
|
|
19
20
|
shipping: Nullable<PaymentIntents.ShippingDetails>;
|
|
21
|
+
nextAction: NextAction | null;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export namespace PaymentIntents {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AuBECSDebitFormComponent } from './components/AuBECSDebitForm';
|
|
2
2
|
import type { Card } from './Card';
|
|
3
3
|
import type { PaymentIntents } from './PaymentIntents';
|
|
4
|
-
|
|
4
|
+
import type { BankAcccountHolderType, BankAcccountType } from './index';
|
|
5
5
|
export interface PaymentMethod {
|
|
6
6
|
id: string;
|
|
7
7
|
liveMode: boolean;
|
|
@@ -35,7 +35,8 @@ export namespace PaymentMethodCreateParams {
|
|
|
35
35
|
| AfterpayClearpayParams
|
|
36
36
|
| KlarnaParams
|
|
37
37
|
// | WeChatPayParams
|
|
38
|
-
| BancontactParams
|
|
38
|
+
| BancontactParams
|
|
39
|
+
| USBankAccountParams;
|
|
39
40
|
|
|
40
41
|
export type BillingDetails = {
|
|
41
42
|
email?: string;
|
|
@@ -148,6 +149,21 @@ export namespace PaymentMethodCreateParams {
|
|
|
148
149
|
type: 'AuBecsDebit';
|
|
149
150
|
formDetails: AuBECSDebitFormComponent.FormDetails;
|
|
150
151
|
}
|
|
152
|
+
|
|
153
|
+
/** Before using this payment method type, ensure you have already collected the bank information
|
|
154
|
+
* for this intent with `collectBankAccountForPayment`. Otherwise, you will need to pass in the bank account
|
|
155
|
+
* details manually.*/
|
|
156
|
+
export type USBankAccountParams = {
|
|
157
|
+
type: 'USBankAccount';
|
|
158
|
+
billingDetails?: Pick<Required<BillingDetails>, 'name'> & BillingDetails;
|
|
159
|
+
accountNumber?: string;
|
|
160
|
+
routingNumber?: string;
|
|
161
|
+
/** Defaults to Individual */
|
|
162
|
+
accountHolderType?: BankAcccountHolderType;
|
|
163
|
+
/** Defaults to Checking */
|
|
164
|
+
accountType?: BankAcccountType;
|
|
165
|
+
setupFutureUsage?: PaymentIntents.FutureUsage;
|
|
166
|
+
};
|
|
151
167
|
}
|
|
152
168
|
|
|
153
169
|
export declare namespace PaymentMethods {
|
|
@@ -213,6 +229,18 @@ export declare namespace PaymentMethods {
|
|
|
213
229
|
vpa?: string;
|
|
214
230
|
}
|
|
215
231
|
|
|
232
|
+
export type USBankAccount = {
|
|
233
|
+
routingNumber?: string;
|
|
234
|
+
accountHolderType?: BankAcccountHolderType;
|
|
235
|
+
accountType?: BankAcccountType;
|
|
236
|
+
last4?: string;
|
|
237
|
+
bankName?: string;
|
|
238
|
+
linkedAccount?: string;
|
|
239
|
+
fingerprint?: string;
|
|
240
|
+
preferredNetwork?: string;
|
|
241
|
+
supportedNetworks?: string[];
|
|
242
|
+
};
|
|
243
|
+
|
|
216
244
|
export type Types =
|
|
217
245
|
| 'AfterpayClearpay'
|
|
218
246
|
| 'Card'
|
|
@@ -231,5 +259,6 @@ export declare namespace PaymentMethods {
|
|
|
231
259
|
| 'Oxxo'
|
|
232
260
|
| 'Sofort'
|
|
233
261
|
| 'Upi'
|
|
262
|
+
| 'USBankAccount'
|
|
234
263
|
| 'Unknown';
|
|
235
264
|
}
|
package/src/types/SetupIntent.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { Nullable, StripeError } from '.';
|
|
2
2
|
import type { AuBECSDebitFormComponent } from './components/AuBECSDebitForm';
|
|
3
|
-
import type {
|
|
3
|
+
import type { NextAction } from './NextAction';
|
|
4
|
+
import type {
|
|
5
|
+
PaymentMethod,
|
|
6
|
+
PaymentMethods,
|
|
7
|
+
PaymentMethodCreateParams,
|
|
8
|
+
} from './PaymentMethods';
|
|
4
9
|
|
|
5
10
|
export interface SetupIntent {
|
|
6
11
|
id: string;
|
|
@@ -13,6 +18,7 @@ export interface SetupIntent {
|
|
|
13
18
|
paymentMethodTypes: PaymentMethods.Types[];
|
|
14
19
|
usage: SetupIntents.FutureUsage;
|
|
15
20
|
description: Nullable<string>;
|
|
21
|
+
nextAction: NextAction | null;
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
export namespace ConfirmSetupIntent {
|
|
@@ -26,7 +32,8 @@ export namespace ConfirmSetupIntent {
|
|
|
26
32
|
| BancontactParams
|
|
27
33
|
| SofortParams
|
|
28
34
|
| AuBecsDebitParams
|
|
29
|
-
| SepaParams
|
|
35
|
+
| SepaParams
|
|
36
|
+
| PaymentMethodCreateParams.USBankAccountParams;
|
|
30
37
|
|
|
31
38
|
export interface Options {}
|
|
32
39
|
|
package/src/types/index.ts
CHANGED
|
@@ -13,7 +13,10 @@ import type {
|
|
|
13
13
|
StripeError,
|
|
14
14
|
} from './Errors';
|
|
15
15
|
import type { PaymentIntent } from './PaymentIntents';
|
|
16
|
-
import type {
|
|
16
|
+
import type {
|
|
17
|
+
PaymentMethod,
|
|
18
|
+
PaymentMethodCreateParams,
|
|
19
|
+
} from './PaymentMethods';
|
|
17
20
|
import type { PaymentSheet } from './PaymentSheet';
|
|
18
21
|
import type { SetupIntent } from './SetupIntent';
|
|
19
22
|
import type { ThreeDSecureConfigurationParams } from './ThreeDSecure';
|
|
@@ -233,6 +236,8 @@ export type CreateTokenCardParams = {
|
|
|
233
236
|
|
|
234
237
|
export type BankAcccountHolderType = 'Company' | 'Individual';
|
|
235
238
|
|
|
239
|
+
export type BankAcccountType = 'Checking' | 'Savings';
|
|
240
|
+
|
|
236
241
|
export type CreateTokenBankAccountParams = {
|
|
237
242
|
type: 'BankAccount';
|
|
238
243
|
accountHolderName?: string;
|
|
@@ -242,3 +247,21 @@ export type CreateTokenBankAccountParams = {
|
|
|
242
247
|
currency: string;
|
|
243
248
|
routingNumber?: string;
|
|
244
249
|
};
|
|
250
|
+
|
|
251
|
+
export type VerifyMicrodepositsParams =
|
|
252
|
+
| {
|
|
253
|
+
amounts: number[];
|
|
254
|
+
descriptorCode?: undefined;
|
|
255
|
+
}
|
|
256
|
+
| {
|
|
257
|
+
amounts?: undefined;
|
|
258
|
+
descriptorCode: string;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
export type CollectBankAccountParams =
|
|
262
|
+
PaymentMethodCreateParams.USBankAccountParams & {
|
|
263
|
+
billingDetails: {
|
|
264
|
+
name: string;
|
|
265
|
+
email?: string;
|
|
266
|
+
};
|
|
267
|
+
};
|
|
@@ -10,11 +10,12 @@ Pod::Spec.new do |s|
|
|
|
10
10
|
s.license = package['license']
|
|
11
11
|
s.authors = package['author']
|
|
12
12
|
|
|
13
|
-
s.platforms = { ios: '
|
|
13
|
+
s.platforms = { ios: '12.0' }
|
|
14
14
|
s.source = { git: 'https://github.com/stripe/stripe-react-native.git', tag: s.version.to_s }
|
|
15
15
|
|
|
16
16
|
s.source_files = 'ios/**/*.{h,m,mm,swift}'
|
|
17
17
|
|
|
18
18
|
s.dependency 'React-Core'
|
|
19
|
-
s.dependency 'Stripe', '~>
|
|
19
|
+
s.dependency 'Stripe', '~> 22.0.0'
|
|
20
|
+
s.dependency 'StripeConnections', '~> 22.0.0'
|
|
20
21
|
end
|