@stripe/stripe-react-native 0.25.0 → 0.27.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 +26 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +26 -16
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +30 -1
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +5 -0
- package/android/src/main/res/drawable/googlepay_button_background_shape.xml +4 -10
- package/android/src/main/res/drawable-hdpi/googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/drawable-hdpi/googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/drawable-mdpi/googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/drawable-mdpi/googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/drawable-v21/googlepay_button_background.xml +7 -0
- package/android/src/main/res/drawable-v21/googlepay_button_no_shadow_background.xml +7 -0
- package/android/src/main/res/drawable-xhdpi/googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/drawable-xhdpi/googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/drawable-xxhdpi/googlepay_button_no_shadow_background_image.9.png +0 -0
- package/android/src/main/res/drawable-xxxhdpi/googlepay_button_background_image.9.png +0 -0
- package/android/src/main/res/drawable-xxxhdpi/googlepay_button_no_shadow_background_image.9.png +0 -0
- package/ios/Mappers.swift +8 -3
- package/ios/PaymentMethodFactory.swift +24 -0
- package/ios/StripeSdk+PaymentSheet.swift +35 -0
- package/ios/StripeSdk.swift +2 -5
- package/lib/commonjs/types/ApplePay.js.map +1 -1
- package/lib/commonjs/types/PaymentIntent.js.map +1 -1
- package/lib/commonjs/types/PaymentMethod.js.map +1 -1
- package/lib/commonjs/types/PaymentSheet.js +1 -1
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/SetupIntent.js.map +1 -1
- package/lib/module/types/ApplePay.js.map +1 -1
- package/lib/module/types/PaymentIntent.js.map +1 -1
- package/lib/module/types/PaymentMethod.js.map +1 -1
- package/lib/module/types/PaymentSheet.js +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/module/types/SetupIntent.js.map +1 -1
- package/lib/typescript/src/functions.d.ts +1 -1
- package/lib/typescript/src/hooks/useConfirmPayment.d.ts +1 -1
- package/lib/typescript/src/hooks/useStripe.d.ts +1 -1
- package/lib/typescript/src/types/ApplePay.d.ts +1 -1
- package/lib/typescript/src/types/PaymentIntent.d.ts +190 -2
- package/lib/typescript/src/types/PaymentMethod.d.ts +11 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +30 -0
- package/lib/typescript/src/types/SetupIntent.d.ts +3 -3
- package/package.json +2 -1
- package/src/types/ApplePay.ts +1 -1
- package/src/types/PaymentIntent.ts +227 -3
- package/src/types/PaymentMethod.ts +14 -1
- package/src/types/PaymentSheet.ts +33 -0
- package/src/types/SetupIntent.ts +7 -20
- package/stripe-react-native.podspec +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { StripeError } from '.';
|
|
2
|
-
import type { Address } from './Common';
|
|
2
|
+
import type { Address, BillingDetails } from './Common';
|
|
3
3
|
import type { Result as PaymentMethodResult } from './PaymentMethod';
|
|
4
4
|
import type { NextAction } from './NextAction';
|
|
5
5
|
import type * as PaymentMethod from './PaymentMethod';
|
|
6
|
-
|
|
6
|
+
import type { FormDetails } from './components/AuBECSDebitFormComponent';
|
|
7
|
+
import type { BankAcccountHolderType, BankAcccountType } from './Token';
|
|
7
8
|
export interface Result {
|
|
8
9
|
id: string;
|
|
9
10
|
amount: number;
|
|
@@ -26,7 +27,27 @@ export interface Result {
|
|
|
26
27
|
nextAction: NextAction | null;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
export type ConfirmParams =
|
|
30
|
+
export type ConfirmParams =
|
|
31
|
+
| CardParams
|
|
32
|
+
| IdealParams
|
|
33
|
+
| OxxoParams
|
|
34
|
+
| P24Params
|
|
35
|
+
| AlipayParams
|
|
36
|
+
| GiropayParams
|
|
37
|
+
| SepaParams
|
|
38
|
+
| EpsParams
|
|
39
|
+
| AuBecsDebitParams
|
|
40
|
+
| SofortParams
|
|
41
|
+
| GrabPayParams
|
|
42
|
+
| FPXParams
|
|
43
|
+
| AfterpayClearpayParams
|
|
44
|
+
| KlarnaParams
|
|
45
|
+
// | WeChatPayParams
|
|
46
|
+
| BancontactParams
|
|
47
|
+
| USBankAccountParams
|
|
48
|
+
| PayPalParams
|
|
49
|
+
| AffirmParams
|
|
50
|
+
| CashAppParams;
|
|
30
51
|
|
|
31
52
|
export type ConfirmOptions = PaymentMethod.ConfirmOptions;
|
|
32
53
|
|
|
@@ -54,3 +75,206 @@ export enum Status {
|
|
|
54
75
|
RequiresCapture = 'RequiresCapture',
|
|
55
76
|
Unknown = 'Unknown',
|
|
56
77
|
}
|
|
78
|
+
|
|
79
|
+
export type MandateData = {
|
|
80
|
+
customerAcceptance: {
|
|
81
|
+
online: {
|
|
82
|
+
ipAddress: string;
|
|
83
|
+
userAgent: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export type CardParams =
|
|
89
|
+
| {
|
|
90
|
+
paymentMethodType: 'Card';
|
|
91
|
+
paymentMethodData?: {
|
|
92
|
+
token?: string;
|
|
93
|
+
billingDetails?: BillingDetails;
|
|
94
|
+
mandateData?: MandateData;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
| {
|
|
98
|
+
paymentMethodType: 'Card';
|
|
99
|
+
paymentMethodData: {
|
|
100
|
+
paymentMethodId: string;
|
|
101
|
+
cvc?: string;
|
|
102
|
+
billingDetails?: BillingDetails;
|
|
103
|
+
mandateData?: MandateData;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export interface IdealParams {
|
|
108
|
+
paymentMethodType: 'Ideal';
|
|
109
|
+
paymentMethodData?: {
|
|
110
|
+
bankName?: string;
|
|
111
|
+
billingDetails?: BillingDetails;
|
|
112
|
+
mandateData?: MandateData;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface FPXParams {
|
|
117
|
+
paymentMethodType: 'Fpx';
|
|
118
|
+
paymentMethodData?: { testOfflineBank?: boolean; mandateData?: MandateData };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface AlipayParams {
|
|
122
|
+
paymentMethodType: 'Alipay';
|
|
123
|
+
paymentMethodData?: {
|
|
124
|
+
mandateData?: MandateData;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface OxxoParams {
|
|
129
|
+
paymentMethodType: 'Oxxo';
|
|
130
|
+
paymentMethodData: {
|
|
131
|
+
billingDetails: BillingDetails;
|
|
132
|
+
mandateData?: MandateData;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface SofortParams {
|
|
137
|
+
paymentMethodType: 'Sofort';
|
|
138
|
+
paymentMethodData: {
|
|
139
|
+
country: string;
|
|
140
|
+
billingDetails: BillingDetails;
|
|
141
|
+
mandateData?: MandateData;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
export interface GrabPayParams {
|
|
145
|
+
paymentMethodType: 'GrabPay';
|
|
146
|
+
paymentMethodData?: {
|
|
147
|
+
billingDetails?: BillingDetails;
|
|
148
|
+
mandateData?: MandateData;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface BancontactParams {
|
|
153
|
+
paymentMethodType: 'Bancontact';
|
|
154
|
+
paymentMethodData: {
|
|
155
|
+
billingDetails: BillingDetails;
|
|
156
|
+
mandateData?: MandateData;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface SepaParams {
|
|
161
|
+
paymentMethodType: 'SepaDebit';
|
|
162
|
+
paymentMethodData: {
|
|
163
|
+
iban: string;
|
|
164
|
+
billingDetails: BillingDetails;
|
|
165
|
+
mandateData?: MandateData;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface GiropayParams {
|
|
170
|
+
paymentMethodType: 'Giropay';
|
|
171
|
+
paymentMethodData: {
|
|
172
|
+
billingDetails: BillingDetails;
|
|
173
|
+
mandateData?: MandateData;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface AfterpayClearpayParams {
|
|
178
|
+
paymentMethodType: 'AfterpayClearpay';
|
|
179
|
+
paymentMethodData: {
|
|
180
|
+
shippingDetails: BillingDetails;
|
|
181
|
+
billingDetails: BillingDetails;
|
|
182
|
+
mandateData?: MandateData;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export type KlarnaParams = {
|
|
187
|
+
paymentMethodType: 'Klarna';
|
|
188
|
+
paymentMethodData: {
|
|
189
|
+
billingDetails: Pick<Required<BillingDetails>, 'email'> & {
|
|
190
|
+
address: Pick<Required<Address>, 'country'>;
|
|
191
|
+
} & BillingDetails;
|
|
192
|
+
shippingDetails?: BillingDetails;
|
|
193
|
+
mandateData?: MandateData;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export interface EpsParams {
|
|
198
|
+
paymentMethodType: 'Eps';
|
|
199
|
+
paymentMethodData: {
|
|
200
|
+
billingDetails: BillingDetails;
|
|
201
|
+
mandateData?: MandateData;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface P24Params {
|
|
206
|
+
paymentMethodType: 'P24';
|
|
207
|
+
paymentMethodData: {
|
|
208
|
+
billingDetails: BillingDetails;
|
|
209
|
+
mandateData?: MandateData;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface WeChatPayParams {
|
|
214
|
+
paymentMethodType: 'WeChatPay';
|
|
215
|
+
paymentMethodData: {
|
|
216
|
+
appId: string;
|
|
217
|
+
billingDetails?: BillingDetails;
|
|
218
|
+
mandateData?: MandateData;
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface AuBecsDebitParams {
|
|
223
|
+
paymentMethodType: 'AuBecsDebit';
|
|
224
|
+
paymentMethodData: { formDetails: FormDetails; mandateData?: MandateData };
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export type AffirmParams = {
|
|
228
|
+
paymentMethodType: 'Affirm';
|
|
229
|
+
paymentMethodData?: {
|
|
230
|
+
/** Affirm requires that shipping is present for the payment to succeed because it significantly helps with loan approval rates. Shipping details can either be provided here or via the Payment Intent- https://stripe.com/docs/api/payment_intents/create#create_payment_intent-shipping. */
|
|
231
|
+
shippingDetails?: BillingDetails;
|
|
232
|
+
billingDetails?: BillingDetails;
|
|
233
|
+
mandateData?: MandateData;
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* If paymentMethodData is null, it is assumed that the bank account details have already been attached
|
|
239
|
+
* via `collectBankAccountForPayment` or `collectBankAccountForSetup`.
|
|
240
|
+
*/
|
|
241
|
+
export type USBankAccountParams = {
|
|
242
|
+
paymentMethodType: 'USBankAccount';
|
|
243
|
+
paymentMethodData?: {
|
|
244
|
+
billingDetails: Pick<Required<BillingDetails>, 'name'> & BillingDetails;
|
|
245
|
+
accountNumber: string;
|
|
246
|
+
routingNumber: string;
|
|
247
|
+
/** Defaults to Individual */
|
|
248
|
+
accountHolderType?: BankAcccountHolderType;
|
|
249
|
+
/** Defaults to Checking */
|
|
250
|
+
accountType?: BankAcccountType;
|
|
251
|
+
mandateData?: MandateData;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export type PayPalParams = {
|
|
256
|
+
paymentMethodType: 'PayPal';
|
|
257
|
+
paymentMethodData?: {
|
|
258
|
+
billingDetails?: BillingDetails;
|
|
259
|
+
mandateData?: MandateData;
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export type CashAppParams = {
|
|
264
|
+
paymentMethodType: 'CashApp';
|
|
265
|
+
paymentMethodData?: {
|
|
266
|
+
billingDetails?: BillingDetails;
|
|
267
|
+
mandateData?: MandateData;
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
export type CollectBankAccountParams = {
|
|
272
|
+
paymentMethodType: 'USBankAccount';
|
|
273
|
+
paymentMethodData: {
|
|
274
|
+
billingDetails: {
|
|
275
|
+
name: string;
|
|
276
|
+
email?: string;
|
|
277
|
+
};
|
|
278
|
+
mandateData?: MandateData;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
@@ -43,7 +43,8 @@ export type CreateParams =
|
|
|
43
43
|
| BancontactParams
|
|
44
44
|
| USBankAccountParams
|
|
45
45
|
| PayPalParams
|
|
46
|
-
| AffirmParams
|
|
46
|
+
| AffirmParams
|
|
47
|
+
| CashAppParams;
|
|
47
48
|
|
|
48
49
|
export type ConfirmParams = CreateParams;
|
|
49
50
|
|
|
@@ -210,6 +211,13 @@ export type PayPalParams = {
|
|
|
210
211
|
};
|
|
211
212
|
};
|
|
212
213
|
|
|
214
|
+
export type CashAppParams = {
|
|
215
|
+
paymentMethodType: 'CashApp';
|
|
216
|
+
paymentMethodData?: {
|
|
217
|
+
billingDetails?: BillingDetails;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
|
|
213
221
|
export interface AuBecsDebitResult {
|
|
214
222
|
fingerprint?: string;
|
|
215
223
|
last4?: string;
|
|
@@ -232,6 +240,11 @@ export interface CardResult {
|
|
|
232
240
|
last4?: string;
|
|
233
241
|
preferredNetwork?: string;
|
|
234
242
|
availableNetworks?: Array<string>;
|
|
243
|
+
threeDSecureUsage?: ThreeDSecureUsage;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export interface ThreeDSecureUsage {
|
|
247
|
+
isSupported?: boolean;
|
|
235
248
|
}
|
|
236
249
|
|
|
237
250
|
export interface FpxResult {
|
|
@@ -25,6 +25,8 @@ export type SetupParams = ClientSecretParams & {
|
|
|
25
25
|
style?: 'alwaysLight' | 'alwaysDark' | 'automatic';
|
|
26
26
|
/** A URL that redirects back to your app that PaymentSheet can use to auto-dismiss web views used for additional authentication, e.g. 3DS2 */
|
|
27
27
|
returnURL?: string;
|
|
28
|
+
/** Configuration for how billing details are collected during checkout. */
|
|
29
|
+
billingDetailsCollectionConfiguration?: BillingDetailsCollectionConfiguration;
|
|
28
30
|
/** PaymentSheet pre-populates the billing fields that are displayed in the Payment Sheet (only country and postal code, as of this version) with the values provided. */
|
|
29
31
|
defaultBillingDetails?: BillingDetails;
|
|
30
32
|
/**
|
|
@@ -262,3 +264,34 @@ export type PresentOptions = {
|
|
|
262
264
|
*/
|
|
263
265
|
timeout?: number;
|
|
264
266
|
};
|
|
267
|
+
|
|
268
|
+
export type BillingDetailsCollectionConfiguration = {
|
|
269
|
+
/** How to collect the name field. Defaults to `CollectionMode.automatic`. */
|
|
270
|
+
name?: CollectionMode;
|
|
271
|
+
/** How to collect the phone field. Defaults to `CollectionMode.automatic`. */
|
|
272
|
+
phone?: CollectionMode;
|
|
273
|
+
/** How to collect the email field. Defaults to `CollectionMode.automatic`. */
|
|
274
|
+
email?: CollectionMode;
|
|
275
|
+
/** How to collect the billing address. Defaults to `CollectionMode.automatic`. */
|
|
276
|
+
address?: AddressCollectionMode;
|
|
277
|
+
/** Whether the values included in `Configuration.defaultBillingDetails` should be attached to the payment method, this includes fields that aren't displayed in the form. If `false` (the default), those values will only be used to prefill the corresponding fields in the form. */
|
|
278
|
+
attachDefaultsToPaymentMethod?: Boolean;
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
export enum CollectionMode {
|
|
282
|
+
/** The field may or may not be collected depending on the Payment Method's requirements. */
|
|
283
|
+
AUTOMATIC = 'automatic',
|
|
284
|
+
/** The field will never be collected. If this field is required by the Payment Method, you must provide it as part of `defaultBillingDetails`. */
|
|
285
|
+
NEVER = 'never',
|
|
286
|
+
/** The field will always be collected, even if it isn't required for the Payment Method. */
|
|
287
|
+
ALWAYS = 'always',
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export enum AddressCollectionMode {
|
|
291
|
+
/** Only the fields required by the Payment Method will be collected, which may be none. */
|
|
292
|
+
AUTOMATIC = 'automatic',
|
|
293
|
+
/** Billing address will never be collected. If the Payment Method requires a billing address, you must provide it as part of `defaultBillingDetails`. */
|
|
294
|
+
NEVER = 'never',
|
|
295
|
+
/** Collect the full billing address, regardless of the Payment Method's requirements. */
|
|
296
|
+
FULL = 'full',
|
|
297
|
+
}
|
package/src/types/SetupIntent.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { Type } from './PaymentMethod';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
LastPaymentError,
|
|
4
|
+
ConfirmParams as PaymentIntentConfirmParams,
|
|
5
|
+
ConfirmOptions as PaymentIntentConfirmOptions,
|
|
6
|
+
} from './PaymentIntent';
|
|
3
7
|
import type { NextAction } from './NextAction';
|
|
4
8
|
import type * as PaymentMethod from './PaymentMethod';
|
|
5
9
|
export interface Result {
|
|
@@ -19,26 +23,9 @@ export interface Result {
|
|
|
19
23
|
nextAction: NextAction | null;
|
|
20
24
|
}
|
|
21
25
|
|
|
22
|
-
export type ConfirmParams =
|
|
23
|
-
| PaymentMethod.CardParams
|
|
24
|
-
| PaymentMethod.IdealParams
|
|
25
|
-
| PaymentMethod.OxxoParams
|
|
26
|
-
| PaymentMethod.P24Params
|
|
27
|
-
| PaymentMethod.AlipayParams
|
|
28
|
-
| PaymentMethod.GiropayParams
|
|
29
|
-
| PaymentMethod.SepaParams
|
|
30
|
-
| PaymentMethod.EpsParams
|
|
31
|
-
| PaymentMethod.AuBecsDebitParams
|
|
32
|
-
| PaymentMethod.SofortParams
|
|
33
|
-
| PaymentMethod.GrabPayParams
|
|
34
|
-
| PaymentMethod.FPXParams
|
|
35
|
-
| PaymentMethod.AfterpayClearpayParams
|
|
36
|
-
| PaymentMethod.KlarnaParams
|
|
37
|
-
| PaymentMethod.BancontactParams
|
|
38
|
-
| PaymentMethod.USBankAccountParams;
|
|
39
|
-
// TODO: Change the above back to PaymentMethod.CreateParams when PayPal is supported through SetupIntents
|
|
26
|
+
export type ConfirmParams = PaymentIntentConfirmParams;
|
|
40
27
|
|
|
41
|
-
export type ConfirmOptions =
|
|
28
|
+
export type ConfirmOptions = PaymentIntentConfirmOptions;
|
|
42
29
|
|
|
43
30
|
export type FutureUsage =
|
|
44
31
|
| 'Unknown'
|