@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
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
|
|
6
|
+
## 0.27.0 - 2023-04-21
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- Added `billingDetailsCollectionConfiguration` to `initPaymentSheet` parameters. Use this to configure the collection of email, phone, name, or address in the Payment Sheet. [#1361](https://github.com/stripe/stripe-react-native/pull/1361)
|
|
11
|
+
|
|
12
|
+
### Fixes
|
|
13
|
+
|
|
14
|
+
- Updated Google Pay button asset to match Google's most recent branding guidelines. [#1343](https://github.com/stripe/stripe-react-native/pull/1343)
|
|
15
|
+
- Fixed type for `ApplePay.ShippingContact.phoneNumber`. [#1349](https://github.com/stripe/stripe-react-native/pull/1349)
|
|
16
|
+
- Fixed `CardResult` type to include `threeDSecureUsage`. [#1347](https://github.com/stripe/stripe-react-native/pull/1347)
|
|
17
|
+
|
|
18
|
+
## 0.26.0 - 2023-03-16
|
|
19
|
+
|
|
20
|
+
### New Features
|
|
21
|
+
|
|
22
|
+
- Added support for PayPal and CashApp to PaymentSheet, `confirmPayment`, and `confirmSetupIntent`. [#1331](https://github.com/stripe/stripe-react-native/pull/1331)
|
|
23
|
+
|
|
24
|
+
### Fixes
|
|
25
|
+
|
|
26
|
+
- Compatible with v0.1.4 of `@stripe/stripe-identity-react-native`. [8fa8a7a](https://github.com/stripe/stripe-react-native/commit/8fa8a7a0595a31d7422af6bbe26d696ba5e211f7)
|
|
27
|
+
|
|
5
28
|
## 0.25.0 - 2023-02-27
|
|
6
29
|
|
|
7
30
|
### New Features
|
|
@@ -39,7 +62,7 @@
|
|
|
39
62
|
- Added the `request` field to `initPaymentSheet()`'s, `confirmPlatformPayPayment()`'s, and `confirmPlatformPaySetupIntent`'s `applePay` params. Use this to support different types of payment requests, like `RecurringPaymentRequest`, `AutomaticReloadPaymentRequest`, and `MultiMerchantRequest`.[#1248](https://github.com/stripe/stripe-react-native/pull/1248)
|
|
40
63
|
- Added an `options` argument to `presentPaymentSheet` which includes a `timeout` property. [#1287](https://github.com/stripe/stripe-react-native/pull/1287)
|
|
41
64
|
|
|
42
|
-
## 0.23.3 - 2023-02-07
|
|
65
|
+
## 0.23.3 - 2023-02-07 (📌 Expo SDK 48)
|
|
43
66
|
|
|
44
67
|
### Fixes
|
|
45
68
|
|
|
@@ -53,6 +76,8 @@
|
|
|
53
76
|
|
|
54
77
|
## 0.23.1 - 2023-01-25
|
|
55
78
|
|
|
79
|
+
> **Note**: This version pulls in a new version of `stripe-android` that now requires v1.8.0 of the Kotlin Gradle plugin. [Refer to this issue for a limited workaround](https://github.com/stripe/stripe-react-native/issues/1294#issuecomment-1426150258).
|
|
80
|
+
|
|
56
81
|
### Fixes
|
|
57
82
|
|
|
58
83
|
- Fixed an issue with `confirmPlatformPaySetupIntent` on iOS. [#1266](https://github.com/stripe/stripe-react-native/pull/1266)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
StripeSdk_kotlinVersion=1.8.0
|
|
2
|
-
StripeSdk_stripeVersion=
|
|
2
|
+
StripeSdk_stripeVersion=20.23.+
|
|
@@ -37,6 +37,7 @@ class PaymentMethodCreateParamsFactory(
|
|
|
37
37
|
PaymentMethod.Type.USBankAccount -> createUSBankAccountParams(paymentMethodData)
|
|
38
38
|
PaymentMethod.Type.PayPal -> createPayPalParams()
|
|
39
39
|
PaymentMethod.Type.Affirm -> createAffirmParams()
|
|
40
|
+
PaymentMethod.Type.CashAppPay -> createCashAppParams()
|
|
40
41
|
else -> {
|
|
41
42
|
throw Exception("This paymentMethodType is not supported yet")
|
|
42
43
|
}
|
|
@@ -202,13 +203,17 @@ class PaymentMethodCreateParamsFactory(
|
|
|
202
203
|
return PaymentMethodCreateParams.createAffirm(billingDetailsParams)
|
|
203
204
|
}
|
|
204
205
|
|
|
206
|
+
@Throws(PaymentMethodCreateParamsException::class)
|
|
207
|
+
private fun createCashAppParams(): PaymentMethodCreateParams {
|
|
208
|
+
return PaymentMethodCreateParams.createCashAppPay(billingDetailsParams)
|
|
209
|
+
}
|
|
210
|
+
|
|
205
211
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
206
212
|
fun createParams(clientSecret: String, paymentMethodType: PaymentMethod.Type?, isPaymentIntent: Boolean): ConfirmStripeIntentParams {
|
|
207
213
|
try {
|
|
208
214
|
return when (paymentMethodType) {
|
|
209
215
|
PaymentMethod.Type.Card -> createCardStripeIntentParams(clientSecret, isPaymentIntent)
|
|
210
216
|
PaymentMethod.Type.USBankAccount -> createUSBankAccountStripeIntentParams(clientSecret, isPaymentIntent)
|
|
211
|
-
PaymentMethod.Type.PayPal -> createPayPalStripeIntentParams(clientSecret, isPaymentIntent)
|
|
212
217
|
PaymentMethod.Type.Affirm -> createAffirmStripeIntentParams(clientSecret, isPaymentIntent)
|
|
213
218
|
PaymentMethod.Type.Ideal,
|
|
214
219
|
PaymentMethod.Type.Alipay,
|
|
@@ -223,7 +228,9 @@ class PaymentMethodCreateParamsFactory(
|
|
|
223
228
|
PaymentMethod.Type.Fpx,
|
|
224
229
|
PaymentMethod.Type.AfterpayClearpay,
|
|
225
230
|
PaymentMethod.Type.AuBecsDebit,
|
|
226
|
-
PaymentMethod.Type.Klarna
|
|
231
|
+
PaymentMethod.Type.Klarna,
|
|
232
|
+
PaymentMethod.Type.PayPal,
|
|
233
|
+
PaymentMethod.Type.CashAppPay -> {
|
|
227
234
|
val params = createPaymentMethodParams(paymentMethodType)
|
|
228
235
|
|
|
229
236
|
return if (isPaymentIntent) {
|
|
@@ -232,11 +239,13 @@ class PaymentMethodCreateParamsFactory(
|
|
|
232
239
|
paymentMethodCreateParams = params,
|
|
233
240
|
clientSecret = clientSecret,
|
|
234
241
|
setupFutureUsage = mapToPaymentIntentFutureUsage(getValOr(options, "setupFutureUsage")),
|
|
242
|
+
mandateData = buildMandateDataParams()
|
|
235
243
|
)
|
|
236
244
|
} else {
|
|
237
245
|
ConfirmSetupIntentParams.create(
|
|
238
246
|
paymentMethodCreateParams = params,
|
|
239
247
|
clientSecret = clientSecret,
|
|
248
|
+
mandateData = buildMandateDataParams()
|
|
240
249
|
)
|
|
241
250
|
}
|
|
242
251
|
}
|
|
@@ -339,20 +348,6 @@ class PaymentMethodCreateParamsFactory(
|
|
|
339
348
|
}
|
|
340
349
|
}
|
|
341
350
|
|
|
342
|
-
@Throws(PaymentMethodCreateParamsException::class)
|
|
343
|
-
private fun createPayPalStripeIntentParams(clientSecret: String, isPaymentIntent: Boolean): ConfirmStripeIntentParams {
|
|
344
|
-
if (!isPaymentIntent) {
|
|
345
|
-
throw PaymentMethodCreateParamsException("PayPal is not yet supported through SetupIntents.")
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
val params = createPayPalParams()
|
|
349
|
-
|
|
350
|
-
return ConfirmPaymentIntentParams.createWithPaymentMethodCreateParams(
|
|
351
|
-
paymentMethodCreateParams = params,
|
|
352
|
-
clientSecret = clientSecret,
|
|
353
|
-
)
|
|
354
|
-
}
|
|
355
|
-
|
|
356
351
|
@Throws(PaymentMethodCreateParamsException::class)
|
|
357
352
|
private fun createAffirmStripeIntentParams(clientSecret: String, isPaymentIntent: Boolean): ConfirmStripeIntentParams {
|
|
358
353
|
if (!isPaymentIntent) {
|
|
@@ -366,6 +361,7 @@ class PaymentMethodCreateParamsFactory(
|
|
|
366
361
|
paymentMethodCreateParams = params,
|
|
367
362
|
clientSecret = clientSecret,
|
|
368
363
|
setupFutureUsage = mapToPaymentIntentFutureUsage(getValOr(options, "setupFutureUsage")),
|
|
364
|
+
mandateData = buildMandateDataParams()
|
|
369
365
|
)
|
|
370
366
|
}
|
|
371
367
|
|
|
@@ -401,6 +397,20 @@ class PaymentMethodCreateParamsFactory(
|
|
|
401
397
|
null
|
|
402
398
|
)
|
|
403
399
|
}
|
|
400
|
+
|
|
401
|
+
private fun buildMandateDataParams(): MandateDataParams? {
|
|
402
|
+
getMapOrNull(paymentMethodData, "mandateData")?.let { mandateData ->
|
|
403
|
+
getMapOrNull(mandateData, "customerAcceptance")?.let { customerAcceptance ->
|
|
404
|
+
getMapOrNull(customerAcceptance, "online")?.let { onlineParams ->
|
|
405
|
+
return MandateDataParams(MandateDataParams.Type.Online(
|
|
406
|
+
ipAddress = getValOr(onlineParams, "ipAddress", "") ?: "",
|
|
407
|
+
userAgent = getValOr(onlineParams, "userAgent", "") ?: "",
|
|
408
|
+
))
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
return null
|
|
413
|
+
}
|
|
404
414
|
}
|
|
405
415
|
|
|
406
416
|
class PaymentMethodCreateParamsException(message: String) : Exception(message)
|
|
@@ -64,6 +64,7 @@ class PaymentSheetFragment(
|
|
|
64
64
|
val googlePayConfig = buildGooglePayConfig(arguments?.getBundle("googlePay"))
|
|
65
65
|
val allowsDelayedPaymentMethods = arguments?.getBoolean("allowsDelayedPaymentMethods")
|
|
66
66
|
val billingDetailsBundle = arguments?.getBundle("defaultBillingDetails")
|
|
67
|
+
val billingConfigParams = arguments?.getBundle("billingDetailsCollectionConfiguration")
|
|
67
68
|
paymentIntentClientSecret = arguments?.getString("paymentIntentClientSecret").orEmpty()
|
|
68
69
|
setupIntentClientSecret = arguments?.getString("setupIntentClientSecret").orEmpty()
|
|
69
70
|
val appearance = try {
|
|
@@ -119,6 +120,15 @@ class PaymentSheetFragment(
|
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
|
|
123
|
+
val billingDetailsConfig = PaymentSheet.BillingDetailsCollectionConfiguration(
|
|
124
|
+
name = mapToCollectionMode(billingConfigParams?.getString("name")),
|
|
125
|
+
phone = mapToCollectionMode(billingConfigParams?.getString("phone")),
|
|
126
|
+
email = mapToCollectionMode(billingConfigParams?.getString("email")),
|
|
127
|
+
address = mapToAddressCollectionMode(billingConfigParams?.getString("address")),
|
|
128
|
+
attachDefaultsToPaymentMethod = billingConfigParams?.getBoolean("attachDefaultsToPaymentMethod")
|
|
129
|
+
?: false
|
|
130
|
+
)
|
|
131
|
+
|
|
122
132
|
var defaultBillingDetails: PaymentSheet.BillingDetails? = null
|
|
123
133
|
if (billingDetailsBundle != null) {
|
|
124
134
|
val addressBundle = billingDetailsBundle.getBundle("address")
|
|
@@ -147,7 +157,8 @@ class PaymentSheetFragment(
|
|
|
147
157
|
googlePay = googlePayConfig,
|
|
148
158
|
appearance = appearance,
|
|
149
159
|
shippingDetails = shippingDetails,
|
|
150
|
-
primaryButtonLabel = primaryButtonLabel
|
|
160
|
+
primaryButtonLabel = primaryButtonLabel,
|
|
161
|
+
billingDetailsCollectionConfiguration = billingDetailsConfig
|
|
151
162
|
)
|
|
152
163
|
|
|
153
164
|
if (arguments?.getBoolean("customFlow") == true) {
|
|
@@ -300,3 +311,21 @@ fun getBase64FromBitmap(bitmap: Bitmap?): String? {
|
|
|
300
311
|
val imageBytes: ByteArray = stream.toByteArray()
|
|
301
312
|
return Base64.encodeToString(imageBytes, Base64.DEFAULT)
|
|
302
313
|
}
|
|
314
|
+
|
|
315
|
+
fun mapToCollectionMode(str: String?): PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode {
|
|
316
|
+
return when (str) {
|
|
317
|
+
"automatic" -> PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode.Automatic
|
|
318
|
+
"never" -> PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode.Never
|
|
319
|
+
"always" -> PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode.Always
|
|
320
|
+
else -> PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode.Automatic
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
fun mapToAddressCollectionMode(str: String?): PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode {
|
|
325
|
+
return when (str) {
|
|
326
|
+
"automatic" -> PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode.Automatic
|
|
327
|
+
"never" -> PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode.Never
|
|
328
|
+
"full" -> PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode.Full
|
|
329
|
+
else -> PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode.Automatic
|
|
330
|
+
}
|
|
331
|
+
}
|
|
@@ -123,6 +123,7 @@ internal fun mapPaymentMethodType(type: PaymentMethod.Type?): String {
|
|
|
123
123
|
PaymentMethod.Type.USBankAccount -> "USBankAccount"
|
|
124
124
|
PaymentMethod.Type.PayPal -> "PayPal"
|
|
125
125
|
PaymentMethod.Type.Affirm -> "Affirm"
|
|
126
|
+
PaymentMethod.Type.CashAppPay -> "CashApp"
|
|
126
127
|
else -> "Unknown"
|
|
127
128
|
}
|
|
128
129
|
}
|
|
@@ -152,6 +153,7 @@ internal fun mapToPaymentMethodType(type: String?): PaymentMethod.Type? {
|
|
|
152
153
|
"USBankAccount" -> PaymentMethod.Type.USBankAccount
|
|
153
154
|
"PayPal" -> PaymentMethod.Type.PayPal
|
|
154
155
|
"Affirm" -> PaymentMethod.Type.Affirm
|
|
156
|
+
"CashApp" -> PaymentMethod.Type.CashAppPay
|
|
155
157
|
else -> null
|
|
156
158
|
}
|
|
157
159
|
}
|
|
@@ -344,6 +346,9 @@ internal fun mapFromPaymentMethod(paymentMethod: PaymentMethod): WritableMap {
|
|
|
344
346
|
it.putString("fingerprint", paymentMethod.card?.fingerprint)
|
|
345
347
|
it.putString("preferredNetwork", paymentMethod.card?.networks?.preferred)
|
|
346
348
|
it.putArray("availableNetworks", paymentMethod.card?.networks?.available?.toList() as? ReadableArray)
|
|
349
|
+
it.putMap("threeDSecureUsage", WritableNativeMap().also { threeDSecureUsageMap ->
|
|
350
|
+
threeDSecureUsageMap.putBoolean("isSupported", paymentMethod.card?.threeDSecureUsage?.isSupported ?: false)
|
|
351
|
+
})
|
|
347
352
|
})
|
|
348
353
|
pm.putMap("SepaDebit", WritableNativeMap().also {
|
|
349
354
|
it.putString("bankCode", paymentMethod.sepaDebit?.bankCode)
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<
|
|
3
|
-
<item
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<solid android:color="#000"/>
|
|
7
|
-
<stroke android:color="#747775" android:width="1dp"/>
|
|
8
|
-
<corners android:radius="24dp"/>
|
|
9
|
-
</shape>
|
|
10
|
-
</item>
|
|
11
|
-
</layer-list>
|
|
2
|
+
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
3
|
+
<item
|
|
4
|
+
android:drawable="@drawable/googlepay_button_background_image" />
|
|
5
|
+
</selector>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/src/main/res/drawable-xxhdpi/googlepay_button_no_shadow_background_image.9.png
ADDED
|
Binary file
|
|
Binary file
|
package/android/src/main/res/drawable-xxxhdpi/googlepay_button_no_shadow_background_image.9.png
ADDED
|
Binary file
|
package/ios/Mappers.swift
CHANGED
|
@@ -187,7 +187,7 @@ class Mappers {
|
|
|
187
187
|
"isPending": shippingMethod.type == .pending,
|
|
188
188
|
"label": shippingMethod.label
|
|
189
189
|
]
|
|
190
|
-
|
|
190
|
+
|
|
191
191
|
if #available(iOS 15.0, *) {
|
|
192
192
|
if let dateComponentsRange = shippingMethod.dateComponentsRange {
|
|
193
193
|
method.setObject(
|
|
@@ -292,6 +292,7 @@ class Mappers {
|
|
|
292
292
|
case STPPaymentMethodType.USBankAccount: return "USBankAccount"
|
|
293
293
|
case STPPaymentMethodType.payPal: return "PayPal"
|
|
294
294
|
case STPPaymentMethodType.affirm: return "Affirm"
|
|
295
|
+
case STPPaymentMethodType.cashApp: return "CashApp"
|
|
295
296
|
case STPPaymentMethodType.unknown: return "Unknown"
|
|
296
297
|
default: return "Unknown"
|
|
297
298
|
}
|
|
@@ -322,6 +323,7 @@ class Mappers {
|
|
|
322
323
|
case "USBankAccount": return STPPaymentMethodType.USBankAccount
|
|
323
324
|
case "PayPal": return STPPaymentMethodType.payPal
|
|
324
325
|
case "Affirm": return STPPaymentMethodType.affirm
|
|
326
|
+
case "CashApp": return STPPaymentMethodType.cashApp
|
|
325
327
|
default: return STPPaymentMethodType.unknown
|
|
326
328
|
}
|
|
327
329
|
}
|
|
@@ -610,8 +612,11 @@ class Mappers {
|
|
|
610
612
|
"last4": paymentMethod.card?.last4 ?? NSNull(),
|
|
611
613
|
"preferredNetwork": paymentMethod.card?.networks?.preferred ?? NSNull(),
|
|
612
614
|
"availableNetworks": paymentMethod.card?.networks?.available ?? NSNull(),
|
|
615
|
+
"threeDSecureUsage": [
|
|
616
|
+
"isSupported": paymentMethod.card?.threeDSecureUsage?.supported ?? false
|
|
617
|
+
],
|
|
613
618
|
]
|
|
614
|
-
|
|
619
|
+
|
|
615
620
|
let sepaDebit: NSDictionary = [
|
|
616
621
|
"bankCode": paymentMethod.sepaDebit?.bankCode ?? NSNull(),
|
|
617
622
|
"country": paymentMethod.sepaDebit?.country ?? NSNull(),
|
|
@@ -948,7 +953,7 @@ class Mappers {
|
|
|
948
953
|
}
|
|
949
954
|
return nil
|
|
950
955
|
}
|
|
951
|
-
|
|
956
|
+
|
|
952
957
|
class func convertDateToUnixTimestampSeconds(date: Date?) -> String? {
|
|
953
958
|
if let date = date {
|
|
954
959
|
let value = date.timeIntervalSince1970
|
|
@@ -55,6 +55,8 @@ class PaymentMethodFactory {
|
|
|
55
55
|
return try createPayPalPaymentMethodParams()
|
|
56
56
|
case STPPaymentMethodType.affirm:
|
|
57
57
|
return try createAffirmPaymentMethodParams()
|
|
58
|
+
case STPPaymentMethodType.cashApp:
|
|
59
|
+
return try createCashAppPaymentMethodParams()
|
|
58
60
|
// case STPPaymentMethodType.weChatPay:
|
|
59
61
|
// return try createWeChatPayPaymentMethodParams()
|
|
60
62
|
default:
|
|
@@ -106,6 +108,8 @@ class PaymentMethodFactory {
|
|
|
106
108
|
return nil
|
|
107
109
|
case STPPaymentMethodType.affirm:
|
|
108
110
|
return nil
|
|
111
|
+
case STPPaymentMethodType.cashApp:
|
|
112
|
+
return nil
|
|
109
113
|
default:
|
|
110
114
|
throw PaymentMethodError.paymentNotSupported
|
|
111
115
|
}
|
|
@@ -369,6 +373,26 @@ class PaymentMethodFactory {
|
|
|
369
373
|
let params = STPPaymentMethodAffirmParams()
|
|
370
374
|
return STPPaymentMethodParams(affirm: params, metadata: nil)
|
|
371
375
|
}
|
|
376
|
+
|
|
377
|
+
private func createCashAppPaymentMethodParams() throws -> STPPaymentMethodParams {
|
|
378
|
+
let params = STPPaymentMethodCashAppParams()
|
|
379
|
+
return STPPaymentMethodParams(cashApp: params, billingDetails: billingDetailsParams, metadata: nil)
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
func createMandateData() -> STPMandateDataParams? {
|
|
383
|
+
if let mandateParams = paymentMethodData?["mandateData"] as? NSDictionary {
|
|
384
|
+
if let customerAcceptanceParams = mandateParams["customerAcceptance"] as? NSDictionary {
|
|
385
|
+
let mandate = STPMandateDataParams.init(customerAcceptance: STPMandateCustomerAcceptanceParams.init())
|
|
386
|
+
|
|
387
|
+
mandate.customerAcceptance.type = .online
|
|
388
|
+
if let onlineParams = customerAcceptanceParams["online"] as? NSDictionary {
|
|
389
|
+
mandate.customerAcceptance.onlineParams = .init(ipAddress: onlineParams["ipAddress"] as? String ?? "", userAgent: onlineParams["userAgent"] as? String ?? "")
|
|
390
|
+
}
|
|
391
|
+
return mandate
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return nil
|
|
395
|
+
}
|
|
372
396
|
}
|
|
373
397
|
|
|
374
398
|
enum PaymentMethodError: Error {
|
|
@@ -47,6 +47,14 @@ extension StripeSdk {
|
|
|
47
47
|
if let allowsDelayedPaymentMethods = params["allowsDelayedPaymentMethods"] as? Bool {
|
|
48
48
|
configuration.allowsDelayedPaymentMethods = allowsDelayedPaymentMethods
|
|
49
49
|
}
|
|
50
|
+
|
|
51
|
+
if let billingConfigParams = params["billingDetailsCollectionConfiguration"] as? [String: Any?] {
|
|
52
|
+
configuration.billingDetailsCollectionConfiguration.name = StripeSdk.mapToCollectionMode(str: billingConfigParams["name"] as? String)
|
|
53
|
+
configuration.billingDetailsCollectionConfiguration.phone = StripeSdk.mapToCollectionMode(str: billingConfigParams["phone"] as? String)
|
|
54
|
+
configuration.billingDetailsCollectionConfiguration.email = StripeSdk.mapToCollectionMode(str: billingConfigParams["email"] as? String)
|
|
55
|
+
configuration.billingDetailsCollectionConfiguration.address = StripeSdk.mapToAddressCollectionMode(str: billingConfigParams["address"] as? String)
|
|
56
|
+
configuration.billingDetailsCollectionConfiguration.attachDefaultsToPaymentMethod = billingConfigParams["attachDefaultsToPaymentMethod"] as? Bool == true
|
|
57
|
+
}
|
|
50
58
|
|
|
51
59
|
if let defaultBillingDetails = params["defaultBillingDetails"] as? [String: Any?] {
|
|
52
60
|
configuration.defaultBillingDetails.name = defaultBillingDetails["name"] as? String
|
|
@@ -163,4 +171,31 @@ extension StripeSdk {
|
|
|
163
171
|
}
|
|
164
172
|
})
|
|
165
173
|
}
|
|
174
|
+
|
|
175
|
+
private static func mapToCollectionMode(str: String?) -> PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode {
|
|
176
|
+
switch str {
|
|
177
|
+
case "automatic":
|
|
178
|
+
return .automatic
|
|
179
|
+
case "never":
|
|
180
|
+
return .never
|
|
181
|
+
case "always":
|
|
182
|
+
return .always
|
|
183
|
+
default:
|
|
184
|
+
return .automatic
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
private static func mapToAddressCollectionMode(str: String?) -> PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode {
|
|
189
|
+
switch str {
|
|
190
|
+
case "automatic":
|
|
191
|
+
return .automatic
|
|
192
|
+
case "never":
|
|
193
|
+
return .never
|
|
194
|
+
case "full":
|
|
195
|
+
return .full
|
|
196
|
+
default:
|
|
197
|
+
return .automatic
|
|
198
|
+
}
|
|
199
|
+
}
|
|
166
200
|
}
|
|
201
|
+
|
package/ios/StripeSdk.swift
CHANGED
|
@@ -240,11 +240,6 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
|
|
|
240
240
|
return
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
if (paymentMethodType == .payPal) {
|
|
244
|
-
resolve(Errors.createError(ErrorType.Failed, "PayPal is not yet supported through SetupIntents."))
|
|
245
|
-
return
|
|
246
|
-
}
|
|
247
|
-
|
|
248
243
|
var err: NSDictionary? = nil
|
|
249
244
|
let setupIntentParams: STPSetupIntentConfirmParams = {
|
|
250
245
|
// If payment method data is not supplied, assume payment method was attached through via collectBankAccount
|
|
@@ -260,6 +255,7 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
|
|
|
260
255
|
do {
|
|
261
256
|
let paymentMethodParams = try factory.createParams(paymentMethodType: paymentMethodType)
|
|
262
257
|
parameters.paymentMethodParams = paymentMethodParams
|
|
258
|
+
parameters.mandateData = factory.createMandateData()
|
|
263
259
|
} catch {
|
|
264
260
|
err = Errors.createError(ErrorType.Failed, error as NSError?)
|
|
265
261
|
}
|
|
@@ -881,6 +877,7 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
|
|
|
881
877
|
let paymentMethodOptions = try factory.createOptions(paymentMethodType: paymentMethodType)
|
|
882
878
|
parameters.paymentMethodParams = paymentMethodParams
|
|
883
879
|
parameters.paymentMethodOptions = paymentMethodOptions
|
|
880
|
+
parameters.mandateData = factory.createMandateData()
|
|
884
881
|
} catch {
|
|
885
882
|
err = Errors.createError(ErrorType.Failed, error as NSError?)
|
|
886
883
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["ApplePay.ts"],"sourcesContent":["export type ContactFieldsType =\n | 'emailAddress'\n | 'name'\n | 'phoneNumber'\n | 'phoneticName'\n | 'postalAddress';\n\nexport type AddressFields =\n | 'street'\n | 'city'\n | 'subAdministrativeArea'\n | 'state'\n | 'postalCode'\n | 'country'\n | 'countryCode'\n | 'subLocality';\n\nexport interface ShippingMethod {\n /** A short, localized description. */\n label: string;\n /** The cost associated with this shipping option. */\n amount: string;\n /** When creating items for estimates or charges whose final value is not yet known, set this to true. */\n isPending?: boolean;\n /** A unique identifier for the shipping method. */\n identifier: string;\n /** A user-readable description of the shipping method. For example “Ships in 24 hours.” Don't repeat the content of the 'label' property. */\n detail?: string;\n /** The unix timestamp of the start date of the expected range of delivery or shipping dates for a package, or the time range when an item is available for pickup. Measured in seconds. */\n startDate?: number;\n /** The unix timestamp of the end date of the expected range of delivery or shipping dates for a package, or the time range when an item is available for pickup. Measured in seconds. */\n endDate?: number;\n}\n\ninterface PostalAddress {\n city?: string;\n country?: string;\n postalCode?: string;\n state?: string;\n street?: string;\n isoCountryCode?: string;\n subAdministrativeArea?: string;\n subLocality?: string;\n}\n\ninterface ContactName {\n familyName?: string;\n namePrefix?: string;\n nameSuffix?: string;\n givenName?: string;\n middleName?: string;\n nickname?: string;\n}\n\nexport interface ShippingContact {\n emailAddress?: string;\n name: ContactName;\n phoneNumber?:
|
|
1
|
+
{"version":3,"names":[],"sources":["ApplePay.ts"],"sourcesContent":["export type ContactFieldsType =\n | 'emailAddress'\n | 'name'\n | 'phoneNumber'\n | 'phoneticName'\n | 'postalAddress';\n\nexport type AddressFields =\n | 'street'\n | 'city'\n | 'subAdministrativeArea'\n | 'state'\n | 'postalCode'\n | 'country'\n | 'countryCode'\n | 'subLocality';\n\nexport interface ShippingMethod {\n /** A short, localized description. */\n label: string;\n /** The cost associated with this shipping option. */\n amount: string;\n /** When creating items for estimates or charges whose final value is not yet known, set this to true. */\n isPending?: boolean;\n /** A unique identifier for the shipping method. */\n identifier: string;\n /** A user-readable description of the shipping method. For example “Ships in 24 hours.” Don't repeat the content of the 'label' property. */\n detail?: string;\n /** The unix timestamp of the start date of the expected range of delivery or shipping dates for a package, or the time range when an item is available for pickup. Measured in seconds. */\n startDate?: number;\n /** The unix timestamp of the end date of the expected range of delivery or shipping dates for a package, or the time range when an item is available for pickup. Measured in seconds. */\n endDate?: number;\n}\n\ninterface PostalAddress {\n city?: string;\n country?: string;\n postalCode?: string;\n state?: string;\n street?: string;\n isoCountryCode?: string;\n subAdministrativeArea?: string;\n subLocality?: string;\n}\n\ninterface ContactName {\n familyName?: string;\n namePrefix?: string;\n nameSuffix?: string;\n givenName?: string;\n middleName?: string;\n nickname?: string;\n}\n\nexport interface ShippingContact {\n emailAddress?: string;\n name: ContactName;\n phoneNumber?: string;\n postalAddress: PostalAddress;\n}\n\nexport type CartSummaryItem =\n | DeferredCartSummaryItem\n | ImmediateCartSummaryItem\n | RecurringCartSummaryItem;\n\nexport type CartSummaryItemType = 'Deferred' | 'Immediate' | 'Recurring';\n\n/** Use this type for a payment that occurs in the future, such as a pre-order. Only available on iOS 15 and up, otherwise falls back to ImmediateCartSummaryItem. */\nexport type DeferredCartSummaryItem = {\n paymentType: 'Deferred';\n /** The unix timestamp of the date, in the future, of the payment. Measured in seconds. */\n deferredDate: number;\n label: string;\n amount: string;\n};\n\n/** Use this type for payments that will occur immediately. */\nexport type ImmediateCartSummaryItem = {\n paymentType: 'Immediate';\n /** When creating items for estimates or charges whose final value is not yet known, set this to true. */\n isPending?: boolean;\n label: string;\n amount: string;\n};\n\n/** Use this type for payments that occur more than once, such as a subscription. Only available on iOS 15 and up, otherwise falls back to ImmediateCartSummaryItem.*/\nexport type RecurringCartSummaryItem = {\n paymentType: 'Recurring';\n /** The amount of time – in calendar units such as day, month, or year – that represents a fraction of the total payment interval. For example, if you set the intervalUnit to 'month' and intervalCount to 3, then the payment interval is three months.*/\n intervalUnit: 'minute' | 'hour' | 'day' | 'month' | 'year';\n /** The number of interval units that make up the total payment interval. For example, if you set the intervalUnit to 'month' and intervalCount to 3, then the payment interval is three months.*/\n intervalCount: number;\n /** The unix timestamp of the start date. Measured in seconds. */\n startDate?: number;\n /** The unix timestamp of the end date. Measured in seconds. */\n endDate?: number;\n label: string;\n amount: string;\n};\n\nexport interface PresentParams {\n cartItems: CartSummaryItem[];\n country: string;\n currency: string;\n requiredShippingAddressFields?: ContactFieldsType[];\n requiredBillingContactFields?: ContactFieldsType[];\n shippingMethods?: ShippingMethod[];\n jcbEnabled?: boolean;\n}\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Status"],"sources":["PaymentIntent.ts"],"sourcesContent":["import type { StripeError } from '.';\nimport type { Address } from './Common';\nimport type { Result as PaymentMethodResult } from './PaymentMethod';\nimport type { NextAction } from './NextAction';\nimport type * as PaymentMethod from './PaymentMethod';\
|
|
1
|
+
{"version":3,"names":["Status"],"sources":["PaymentIntent.ts"],"sourcesContent":["import type { StripeError } from '.';\nimport type { Address, BillingDetails } from './Common';\nimport type { Result as PaymentMethodResult } from './PaymentMethod';\nimport type { NextAction } from './NextAction';\nimport type * as PaymentMethod from './PaymentMethod';\nimport type { FormDetails } from './components/AuBECSDebitFormComponent';\nimport type { BankAcccountHolderType, BankAcccountType } from './Token';\nexport interface Result {\n id: string;\n amount: number;\n /** The UNIX timestamp (in milliseconds) of the date this PaymentIntent was created. */\n created: string;\n currency: string;\n status: Status;\n description: string | null;\n receiptEmail: string | null;\n canceledAt: string | null;\n clientSecret: string;\n livemode: boolean;\n /** @deprecated Use paymentMethod.id instead. */\n paymentMethodId: string;\n paymentMethod: PaymentMethodResult | null;\n captureMethod: 'Automatic' | 'Manual';\n confirmationMethod: 'Automatic' | 'Manual';\n lastPaymentError: LastPaymentError | null;\n shipping: ShippingDetails | null;\n nextAction: NextAction | null;\n}\n\nexport type ConfirmParams =\n | CardParams\n | IdealParams\n | OxxoParams\n | P24Params\n | AlipayParams\n | GiropayParams\n | SepaParams\n | EpsParams\n | AuBecsDebitParams\n | SofortParams\n | GrabPayParams\n | FPXParams\n | AfterpayClearpayParams\n | KlarnaParams\n // | WeChatPayParams\n | BancontactParams\n | USBankAccountParams\n | PayPalParams\n | AffirmParams\n | CashAppParams;\n\nexport type ConfirmOptions = PaymentMethod.ConfirmOptions;\n\nexport type LastPaymentError = StripeError<string> & {\n paymentMethod: PaymentMethodResult;\n};\n\nexport type FutureUsage = 'OffSession' | 'OnSession';\n\nexport interface ShippingDetails {\n address: Required<Address>;\n name: string;\n carrier: string;\n phone: string;\n trackingNumber: string;\n}\n\nexport enum Status {\n Succeeded = 'Succeeded',\n RequiresPaymentMethod = 'RequiresPaymentMethod',\n RequiresConfirmation = 'RequiresConfirmation',\n Canceled = 'Canceled',\n Processing = 'Processing',\n RequiresAction = 'RequiresAction',\n RequiresCapture = 'RequiresCapture',\n Unknown = 'Unknown',\n}\n\nexport type MandateData = {\n customerAcceptance: {\n online: {\n ipAddress: string;\n userAgent: string;\n };\n };\n};\n\nexport type CardParams =\n | {\n paymentMethodType: 'Card';\n paymentMethodData?: {\n token?: string;\n billingDetails?: BillingDetails;\n mandateData?: MandateData;\n };\n }\n | {\n paymentMethodType: 'Card';\n paymentMethodData: {\n paymentMethodId: string;\n cvc?: string;\n billingDetails?: BillingDetails;\n mandateData?: MandateData;\n };\n };\n\nexport interface IdealParams {\n paymentMethodType: 'Ideal';\n paymentMethodData?: {\n bankName?: string;\n billingDetails?: BillingDetails;\n mandateData?: MandateData;\n };\n}\n\nexport interface FPXParams {\n paymentMethodType: 'Fpx';\n paymentMethodData?: { testOfflineBank?: boolean; mandateData?: MandateData };\n}\n\nexport interface AlipayParams {\n paymentMethodType: 'Alipay';\n paymentMethodData?: {\n mandateData?: MandateData;\n };\n}\n\nexport interface OxxoParams {\n paymentMethodType: 'Oxxo';\n paymentMethodData: {\n billingDetails: BillingDetails;\n mandateData?: MandateData;\n };\n}\n\nexport interface SofortParams {\n paymentMethodType: 'Sofort';\n paymentMethodData: {\n country: string;\n billingDetails: BillingDetails;\n mandateData?: MandateData;\n };\n}\nexport interface GrabPayParams {\n paymentMethodType: 'GrabPay';\n paymentMethodData?: {\n billingDetails?: BillingDetails;\n mandateData?: MandateData;\n };\n}\n\nexport interface BancontactParams {\n paymentMethodType: 'Bancontact';\n paymentMethodData: {\n billingDetails: BillingDetails;\n mandateData?: MandateData;\n };\n}\n\nexport interface SepaParams {\n paymentMethodType: 'SepaDebit';\n paymentMethodData: {\n iban: string;\n billingDetails: BillingDetails;\n mandateData?: MandateData;\n };\n}\n\nexport interface GiropayParams {\n paymentMethodType: 'Giropay';\n paymentMethodData: {\n billingDetails: BillingDetails;\n mandateData?: MandateData;\n };\n}\n\nexport interface AfterpayClearpayParams {\n paymentMethodType: 'AfterpayClearpay';\n paymentMethodData: {\n shippingDetails: BillingDetails;\n billingDetails: BillingDetails;\n mandateData?: MandateData;\n };\n}\n\nexport type KlarnaParams = {\n paymentMethodType: 'Klarna';\n paymentMethodData: {\n billingDetails: Pick<Required<BillingDetails>, 'email'> & {\n address: Pick<Required<Address>, 'country'>;\n } & BillingDetails;\n shippingDetails?: BillingDetails;\n mandateData?: MandateData;\n };\n};\n\nexport interface EpsParams {\n paymentMethodType: 'Eps';\n paymentMethodData: {\n billingDetails: BillingDetails;\n mandateData?: MandateData;\n };\n}\n\nexport interface P24Params {\n paymentMethodType: 'P24';\n paymentMethodData: {\n billingDetails: BillingDetails;\n mandateData?: MandateData;\n };\n}\n\nexport interface WeChatPayParams {\n paymentMethodType: 'WeChatPay';\n paymentMethodData: {\n appId: string;\n billingDetails?: BillingDetails;\n mandateData?: MandateData;\n };\n}\n\nexport interface AuBecsDebitParams {\n paymentMethodType: 'AuBecsDebit';\n paymentMethodData: { formDetails: FormDetails; mandateData?: MandateData };\n}\n\nexport type AffirmParams = {\n paymentMethodType: 'Affirm';\n paymentMethodData?: {\n /** 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. */\n shippingDetails?: BillingDetails;\n billingDetails?: BillingDetails;\n mandateData?: MandateData;\n };\n};\n\n/**\n * If paymentMethodData is null, it is assumed that the bank account details have already been attached\n * via `collectBankAccountForPayment` or `collectBankAccountForSetup`.\n */\nexport type USBankAccountParams = {\n paymentMethodType: 'USBankAccount';\n paymentMethodData?: {\n billingDetails: Pick<Required<BillingDetails>, 'name'> & BillingDetails;\n accountNumber: string;\n routingNumber: string;\n /** Defaults to Individual */\n accountHolderType?: BankAcccountHolderType;\n /** Defaults to Checking */\n accountType?: BankAcccountType;\n mandateData?: MandateData;\n };\n};\n\nexport type PayPalParams = {\n paymentMethodType: 'PayPal';\n paymentMethodData?: {\n billingDetails?: BillingDetails;\n mandateData?: MandateData;\n };\n};\n\nexport type CashAppParams = {\n paymentMethodType: 'CashApp';\n paymentMethodData?: {\n billingDetails?: BillingDetails;\n mandateData?: MandateData;\n };\n};\n\nexport type CollectBankAccountParams = {\n paymentMethodType: 'USBankAccount';\n paymentMethodData: {\n billingDetails: {\n name: string;\n email?: string;\n };\n mandateData?: MandateData;\n };\n};\n"],"mappings":"kFAmEYA,OAAM,iCAANA,MAAM,EAANA,MAAM,0BAANA,MAAM,kDAANA,MAAM,gDAANA,MAAM,wBAANA,MAAM,4BAANA,MAAM,oCAANA,MAAM,sCAANA,MAAM,yBAANA,MAAM,kBAANA,MAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["PaymentMethod.ts"],"sourcesContent":["import type { FormDetails } from './components/AuBECSDebitFormComponent';\nimport type {\n CardBrand,\n BankAcccountHolderType,\n BankAcccountType,\n} from './Token';\nimport type { FutureUsage } from './PaymentIntent';\nimport type { Address, BillingDetails } from './Common';\n\nexport interface Result {\n id: string;\n liveMode: boolean;\n customerId: string;\n billingDetails: BillingDetails;\n paymentMethodType: Type;\n AuBecsDebit: AuBecsDebitResult;\n BacsDebit: BacsDebitResult;\n Card: CardResult;\n Fpx: FpxResult;\n Ideal: IdealResult;\n SepaDebit: SepaDebitResult;\n Sofort: SofortResult;\n Upi: UpiResult;\n USBankAccount: USBankAccountResult;\n}\n\nexport type CreateParams =\n | CardParams\n | IdealParams\n | OxxoParams\n | P24Params\n | AlipayParams\n | GiropayParams\n | SepaParams\n | EpsParams\n | AuBecsDebitParams\n | SofortParams\n | GrabPayParams\n | FPXParams\n | AfterpayClearpayParams\n | KlarnaParams\n // | WeChatPayParams\n | BancontactParams\n | USBankAccountParams\n | PayPalParams\n | AffirmParams;\n\nexport type ConfirmParams = CreateParams;\n\nexport type CreateOptions = {\n setupFutureUsage?: FutureUsage;\n};\n\nexport type ConfirmOptions = CreateOptions;\n\nexport type ShippingDetails = BillingDetails;\n\nexport type CardParams =\n | {\n paymentMethodType: 'Card';\n paymentMethodData?: {\n token?: string;\n billingDetails?: BillingDetails;\n };\n }\n | {\n paymentMethodType: 'Card';\n paymentMethodData: {\n paymentMethodId: string;\n cvc?: string;\n billingDetails?: BillingDetails;\n };\n };\n\nexport interface IdealParams {\n paymentMethodType: 'Ideal';\n paymentMethodData?: {\n bankName?: string;\n billingDetails?: BillingDetails;\n };\n}\n\nexport interface FPXParams {\n paymentMethodType: 'Fpx';\n paymentMethodData?: { testOfflineBank?: boolean };\n}\n\nexport interface AlipayParams {\n paymentMethodType: 'Alipay';\n}\n\nexport interface OxxoParams {\n paymentMethodType: 'Oxxo';\n paymentMethodData: {\n billingDetails: BillingDetails;\n };\n}\n\nexport interface SofortParams {\n paymentMethodType: 'Sofort';\n paymentMethodData: {\n country: string;\n billingDetails: BillingDetails;\n };\n}\nexport interface GrabPayParams {\n paymentMethodType: 'GrabPay';\n paymentMethodData?: {\n billingDetails?: BillingDetails;\n };\n}\n\nexport interface BancontactParams {\n paymentMethodType: 'Bancontact';\n paymentMethodData: {\n billingDetails: BillingDetails;\n };\n}\n\nexport interface SepaParams {\n paymentMethodType: 'SepaDebit';\n paymentMethodData: {\n iban: string;\n billingDetails: BillingDetails;\n };\n}\n\nexport interface GiropayParams {\n paymentMethodType: 'Giropay';\n paymentMethodData: {\n billingDetails: BillingDetails;\n };\n}\n\nexport interface AfterpayClearpayParams {\n paymentMethodType: 'AfterpayClearpay';\n paymentMethodData: {\n shippingDetails: ShippingDetails;\n billingDetails: BillingDetails;\n };\n}\n\nexport type KlarnaParams = {\n paymentMethodType: 'Klarna';\n paymentMethodData: {\n billingDetails: Pick<Required<BillingDetails>, 'email'> & {\n address: Pick<Required<Address>, 'country'>;\n } & BillingDetails;\n shippingDetails?: ShippingDetails;\n };\n};\n\nexport interface EpsParams {\n paymentMethodType: 'Eps';\n paymentMethodData: {\n billingDetails: BillingDetails;\n };\n}\n\nexport interface P24Params {\n paymentMethodType: 'P24';\n paymentMethodData: {\n billingDetails: BillingDetails;\n };\n}\n\nexport interface WeChatPayParams {\n paymentMethodType: 'WeChatPay';\n paymentMethodData: {\n appId: string;\n billingDetails?: BillingDetails;\n };\n}\n\nexport interface AuBecsDebitParams {\n paymentMethodType: 'AuBecsDebit';\n paymentMethodData: { formDetails: FormDetails };\n}\n\nexport type AffirmParams = {\n paymentMethodType: 'Affirm';\n paymentMethodData?: {\n /** 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. */\n shippingDetails?: ShippingDetails;\n billingDetails?: BillingDetails;\n };\n};\n\n/**\n * If paymentMethodData is null, it is assumed that the bank account details have already been attached\n * via `collectBankAccountForPayment` or `collectBankAccountForSetup`.\n */\nexport type USBankAccountParams = {\n paymentMethodType: 'USBankAccount';\n paymentMethodData?: {\n billingDetails: Pick<Required<BillingDetails>, 'name'> & BillingDetails;\n accountNumber: string;\n routingNumber: string;\n /** Defaults to Individual */\n accountHolderType?: BankAcccountHolderType;\n /** Defaults to Checking */\n accountType?: BankAcccountType;\n };\n};\n\nexport type PayPalParams = {\n paymentMethodType: 'PayPal';\n paymentMethodData?: {\n billingDetails?: BillingDetails;\n };\n};\n\nexport interface AuBecsDebitResult {\n fingerprint?: string;\n last4?: string;\n bsbNumber?: string;\n}\n\nexport interface BacsDebitResult {\n sortCode?: string;\n last4?: string;\n fingerprint?: string;\n}\n\nexport interface CardResult {\n brand?: CardBrand;\n country?: string;\n expYear?: number;\n expMonth?: number;\n fingerprint?: string;\n funding?: string;\n last4?: string;\n preferredNetwork?: string;\n availableNetworks?: Array<string>;\n}\n\nexport interface FpxResult {\n bank?: string;\n}\n\nexport interface IdealResult {\n bankIdentifierCode?: string;\n bank?: string;\n}\n\nexport interface SepaDebitResult {\n bankCode?: string;\n country?: string;\n fingerprint?: string;\n last4?: string;\n}\n\nexport interface SofortResult {\n country?: string;\n}\n\nexport interface UpiResult {\n vpa?: string;\n}\n\nexport type USBankAccountResult = {\n routingNumber?: string;\n accountHolderType?: BankAcccountHolderType;\n accountType?: BankAcccountType;\n last4?: string;\n bankName?: string;\n linkedAccount?: string;\n fingerprint?: string;\n preferredNetwork?: string;\n supportedNetworks?: string[];\n};\n\nexport type Type =\n | 'AfterpayClearpay'\n | 'Card'\n | 'Alipay'\n | 'GrabPay'\n | 'Ideal'\n | 'Fpx'\n | 'CardPresent'\n | 'SepaDebit'\n | 'AuBecsDebit'\n | 'BacsDebit'\n | 'Giropay'\n | 'P24'\n | 'Eps'\n | 'Bancontact'\n | 'Oxxo'\n | 'Sofort'\n | 'Upi'\n | 'USBankAccount'\n | 'PayPal'\n | 'Unknown';\n\nexport type CollectBankAccountParams = {\n paymentMethodType: 'USBankAccount';\n paymentMethodData: {\n billingDetails: {\n name: string;\n email?: string;\n };\n };\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["PaymentMethod.ts"],"sourcesContent":["import type { FormDetails } from './components/AuBECSDebitFormComponent';\nimport type {\n CardBrand,\n BankAcccountHolderType,\n BankAcccountType,\n} from './Token';\nimport type { FutureUsage } from './PaymentIntent';\nimport type { Address, BillingDetails } from './Common';\n\nexport interface Result {\n id: string;\n liveMode: boolean;\n customerId: string;\n billingDetails: BillingDetails;\n paymentMethodType: Type;\n AuBecsDebit: AuBecsDebitResult;\n BacsDebit: BacsDebitResult;\n Card: CardResult;\n Fpx: FpxResult;\n Ideal: IdealResult;\n SepaDebit: SepaDebitResult;\n Sofort: SofortResult;\n Upi: UpiResult;\n USBankAccount: USBankAccountResult;\n}\n\nexport type CreateParams =\n | CardParams\n | IdealParams\n | OxxoParams\n | P24Params\n | AlipayParams\n | GiropayParams\n | SepaParams\n | EpsParams\n | AuBecsDebitParams\n | SofortParams\n | GrabPayParams\n | FPXParams\n | AfterpayClearpayParams\n | KlarnaParams\n // | WeChatPayParams\n | BancontactParams\n | USBankAccountParams\n | PayPalParams\n | AffirmParams\n | CashAppParams;\n\nexport type ConfirmParams = CreateParams;\n\nexport type CreateOptions = {\n setupFutureUsage?: FutureUsage;\n};\n\nexport type ConfirmOptions = CreateOptions;\n\nexport type ShippingDetails = BillingDetails;\n\nexport type CardParams =\n | {\n paymentMethodType: 'Card';\n paymentMethodData?: {\n token?: string;\n billingDetails?: BillingDetails;\n };\n }\n | {\n paymentMethodType: 'Card';\n paymentMethodData: {\n paymentMethodId: string;\n cvc?: string;\n billingDetails?: BillingDetails;\n };\n };\n\nexport interface IdealParams {\n paymentMethodType: 'Ideal';\n paymentMethodData?: {\n bankName?: string;\n billingDetails?: BillingDetails;\n };\n}\n\nexport interface FPXParams {\n paymentMethodType: 'Fpx';\n paymentMethodData?: { testOfflineBank?: boolean };\n}\n\nexport interface AlipayParams {\n paymentMethodType: 'Alipay';\n}\n\nexport interface OxxoParams {\n paymentMethodType: 'Oxxo';\n paymentMethodData: {\n billingDetails: BillingDetails;\n };\n}\n\nexport interface SofortParams {\n paymentMethodType: 'Sofort';\n paymentMethodData: {\n country: string;\n billingDetails: BillingDetails;\n };\n}\nexport interface GrabPayParams {\n paymentMethodType: 'GrabPay';\n paymentMethodData?: {\n billingDetails?: BillingDetails;\n };\n}\n\nexport interface BancontactParams {\n paymentMethodType: 'Bancontact';\n paymentMethodData: {\n billingDetails: BillingDetails;\n };\n}\n\nexport interface SepaParams {\n paymentMethodType: 'SepaDebit';\n paymentMethodData: {\n iban: string;\n billingDetails: BillingDetails;\n };\n}\n\nexport interface GiropayParams {\n paymentMethodType: 'Giropay';\n paymentMethodData: {\n billingDetails: BillingDetails;\n };\n}\n\nexport interface AfterpayClearpayParams {\n paymentMethodType: 'AfterpayClearpay';\n paymentMethodData: {\n shippingDetails: ShippingDetails;\n billingDetails: BillingDetails;\n };\n}\n\nexport type KlarnaParams = {\n paymentMethodType: 'Klarna';\n paymentMethodData: {\n billingDetails: Pick<Required<BillingDetails>, 'email'> & {\n address: Pick<Required<Address>, 'country'>;\n } & BillingDetails;\n shippingDetails?: ShippingDetails;\n };\n};\n\nexport interface EpsParams {\n paymentMethodType: 'Eps';\n paymentMethodData: {\n billingDetails: BillingDetails;\n };\n}\n\nexport interface P24Params {\n paymentMethodType: 'P24';\n paymentMethodData: {\n billingDetails: BillingDetails;\n };\n}\n\nexport interface WeChatPayParams {\n paymentMethodType: 'WeChatPay';\n paymentMethodData: {\n appId: string;\n billingDetails?: BillingDetails;\n };\n}\n\nexport interface AuBecsDebitParams {\n paymentMethodType: 'AuBecsDebit';\n paymentMethodData: { formDetails: FormDetails };\n}\n\nexport type AffirmParams = {\n paymentMethodType: 'Affirm';\n paymentMethodData?: {\n /** 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. */\n shippingDetails?: ShippingDetails;\n billingDetails?: BillingDetails;\n };\n};\n\n/**\n * If paymentMethodData is null, it is assumed that the bank account details have already been attached\n * via `collectBankAccountForPayment` or `collectBankAccountForSetup`.\n */\nexport type USBankAccountParams = {\n paymentMethodType: 'USBankAccount';\n paymentMethodData?: {\n billingDetails: Pick<Required<BillingDetails>, 'name'> & BillingDetails;\n accountNumber: string;\n routingNumber: string;\n /** Defaults to Individual */\n accountHolderType?: BankAcccountHolderType;\n /** Defaults to Checking */\n accountType?: BankAcccountType;\n };\n};\n\nexport type PayPalParams = {\n paymentMethodType: 'PayPal';\n paymentMethodData?: {\n billingDetails?: BillingDetails;\n };\n};\n\nexport type CashAppParams = {\n paymentMethodType: 'CashApp';\n paymentMethodData?: {\n billingDetails?: BillingDetails;\n };\n};\n\nexport interface AuBecsDebitResult {\n fingerprint?: string;\n last4?: string;\n bsbNumber?: string;\n}\n\nexport interface BacsDebitResult {\n sortCode?: string;\n last4?: string;\n fingerprint?: string;\n}\n\nexport interface CardResult {\n brand?: CardBrand;\n country?: string;\n expYear?: number;\n expMonth?: number;\n fingerprint?: string;\n funding?: string;\n last4?: string;\n preferredNetwork?: string;\n availableNetworks?: Array<string>;\n threeDSecureUsage?: ThreeDSecureUsage;\n}\n\nexport interface ThreeDSecureUsage {\n isSupported?: boolean;\n}\n\nexport interface FpxResult {\n bank?: string;\n}\n\nexport interface IdealResult {\n bankIdentifierCode?: string;\n bank?: string;\n}\n\nexport interface SepaDebitResult {\n bankCode?: string;\n country?: string;\n fingerprint?: string;\n last4?: string;\n}\n\nexport interface SofortResult {\n country?: string;\n}\n\nexport interface UpiResult {\n vpa?: string;\n}\n\nexport type USBankAccountResult = {\n routingNumber?: string;\n accountHolderType?: BankAcccountHolderType;\n accountType?: BankAcccountType;\n last4?: string;\n bankName?: string;\n linkedAccount?: string;\n fingerprint?: string;\n preferredNetwork?: string;\n supportedNetworks?: string[];\n};\n\nexport type Type =\n | 'AfterpayClearpay'\n | 'Card'\n | 'Alipay'\n | 'GrabPay'\n | 'Ideal'\n | 'Fpx'\n | 'CardPresent'\n | 'SepaDebit'\n | 'AuBecsDebit'\n | 'BacsDebit'\n | 'Giropay'\n | 'P24'\n | 'Eps'\n | 'Bancontact'\n | 'Oxxo'\n | 'Sofort'\n | 'Upi'\n | 'USBankAccount'\n | 'PayPal'\n | 'Unknown';\n\nexport type CollectBankAccountParams = {\n paymentMethodType: 'USBankAccount';\n paymentMethodData: {\n billingDetails: {\n name: string;\n email?: string;\n };\n };\n};\n"],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.CollectionMode=exports.AddressCollectionMode=void 0;var CollectionMode;exports.CollectionMode=CollectionMode;(function(CollectionMode){CollectionMode["AUTOMATIC"]="automatic";CollectionMode["NEVER"]="never";CollectionMode["ALWAYS"]="always";})(CollectionMode||(exports.CollectionMode=CollectionMode={}));var AddressCollectionMode;exports.AddressCollectionMode=AddressCollectionMode;(function(AddressCollectionMode){AddressCollectionMode["AUTOMATIC"]="automatic";AddressCollectionMode["NEVER"]="never";AddressCollectionMode["FULL"]="full";})(AddressCollectionMode||(exports.AddressCollectionMode=AddressCollectionMode={}));
|
|
2
2
|
//# sourceMappingURL=PaymentSheet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["PaymentSheet.ts"],"sourcesContent":["import type { BillingDetails, AddressDetails } from './Common';\nimport type { CartSummaryItem } from './ApplePay';\nimport type {\n ButtonType,\n RecurringPaymentRequest,\n AutomaticReloadPaymentRequest,\n MultiMerchantRequest,\n} from './PlatformPay';\n\nexport type SetupParams = ClientSecretParams & {\n /** Your customer-facing business name. On Android, this is required and cannot be an empty string. */\n merchantDisplayName: string;\n /** The identifier of the Stripe Customer object. See https://stripe.com/docs/api/customers/object#customer_object-id */\n customerId?: string;\n /** A short-lived token that allows the SDK to access a Customer’s payment methods. */\n customerEphemeralKeySecret?: string;\n /** When set to true, separates out the payment method selection & confirmation steps.\n * If true, you must call `confirmPaymentSheetPayment` on your own. Defaults to false. */\n customFlow?: boolean;\n /** iOS only. Enable Apple Pay in the Payment Sheet by passing an ApplePayParams object. */\n applePay?: ApplePayParams;\n /** Android only. Enable Google Pay in the Payment Sheet by passing a GooglePayParams object. */\n googlePay?: GooglePayParams;\n /** The color styling to use for PaymentSheet UI. Defaults to 'automatic'. */\n style?: 'alwaysLight' | 'alwaysDark' | 'automatic';\n /** A URL that redirects back to your app that PaymentSheet can use to auto-dismiss web views used for additional authentication, e.g. 3DS2 */\n returnURL?: string;\n /** 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. */\n defaultBillingDetails?: BillingDetails;\n /**\n * The shipping information for the customer. If set, PaymentSheet will pre-populate the form fields with the values provided.\n * This is used to display a \"Billing address is same as shipping\" checkbox if `defaultBillingDetails` is not provided.\n * If `name` and `line1` are populated, it's also [attached to the PaymentIntent](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-shipping) during payment.\n */\n defaultShippingDetails?: AddressDetails;\n /** If true, allows payment methods that do not move money at the end of the checkout. Defaults to false.\n *\n * Some payment methods can’t guarantee you will receive funds from your customer at the end of the checkout\n * because they take time to settle (eg. most bank debits, like SEPA or ACH) or require customer action to\n * complete (e.g. OXXO, Konbini, Boleto). If this is set to true, make sure your integration listens to webhooks\n * for notifications on whether a payment has succeeded or not.\n */\n allowsDelayedPaymentMethods?: boolean;\n /** Customizes the appearance of PaymentSheet */\n appearance?: AppearanceParams;\n /** The label to use for the primary button. If not set, Payment Sheet will display suitable default labels for payment and setup intents. */\n primaryButtonLabel?: string;\n};\n\nexport type ClientSecretParams =\n | {\n paymentIntentClientSecret: string;\n setupIntentClientSecret?: undefined;\n }\n | {\n setupIntentClientSecret: string;\n paymentIntentClientSecret?: undefined;\n };\n\nexport type ApplePayParams = {\n /** The two-letter ISO 3166 code of the country of your business, e.g. \"US\" */\n merchantCountryCode: string;\n /**\n * An array of CartSummaryItem item objects that summarize the amount of the payment. If you're using a SetupIntent\n * for a recurring payment, you should set this to display the amount you intend to charge. */\n cartItems?: CartSummaryItem[];\n /** Sets the text displayed by the call to action button in the Apple Pay sheet. */\n buttonType?: ButtonType;\n /** A typical request is for a one-time payment. To support different types of payment requests, include a PaymentRequestType. Only supported on iOS 16 and up. */\n request?:\n | RecurringPaymentRequest\n | AutomaticReloadPaymentRequest\n | MultiMerchantRequest;\n /** Callback function for setting the order details (retrieved from your server) to give users the\n * ability to track and manage their purchases in Wallet. Stripe calls your implementation after the\n * payment is complete, but before iOS dismisses the Apple Pay sheet. You must call the `completion`\n * function, or else the Apple Pay sheet will hang. */\n setOrderTracking?: (\n completion: (\n orderIdentifier: string,\n orderTypeIdentifier: string,\n authenticationToken: string,\n webServiceUrl: string\n ) => void\n ) => void;\n};\n\nexport type GooglePayParams = {\n /** The two-letter ISO 3166 code of the country of your business, e.g. \"US\" */\n merchantCountryCode: string;\n /** The three-letter ISO 4217 alphabetic currency code, e.g. \"USD\" or \"EUR\". Required in order to support Google Pay when processing a Setup Intent. */\n currencyCode?: string;\n /** Whether or not to use the Google Pay test environment. Set to `true` until you have applied for and been granted access to the Production environment. */\n testEnv?: boolean;\n};\n\n/**\n * Used to customize the appearance of your PaymentSheet\n */\nexport type AppearanceParams = RecursivePartial<{\n /** Describes the appearance of fonts in your PaymentSheet */\n font: FontConfig;\n /** Describes the colors in your PaymentSheet. Provide either a base config, or both `light` and `dark` configs, which will be useed based on whether the user is in Light or Dark mode. */\n colors:\n | GlobalColorConfig\n | { light: GlobalColorConfig; dark: GlobalColorConfig };\n /** Describes the appearance of shapes in the PaymentSheet, such as buttons, inputs, and tabs. */\n shapes: {\n /** The border radius used for buttons, inputs, and tabs in your PaymentSheet.\n * @default 6.0\n */\n borderRadius: number;\n /** The border width used for inputs and tabs in your PaymentSheet.\n * @default 1.0\n */\n borderWidth: number;\n /** iOS only. The shadow used for buttons, inputs, and tabs in your PaymentSheet */\n shadow: ShadowConfig;\n };\n /** Describes the appearance of the primary \"Pay\" button at the bottom of your Payment Sheet */\n primaryButton: PrimaryButtonConfig;\n}>;\n\nexport type FontConfig = {\n /**\n * The font used for regular text. PaymentSheet will attempt to use medium and bold versions of this font if they exist.\n *\n * On iOS, this should be the \"PostScript name\" found in Font Book after installing the font.\n * On Android, this should be the name of the font file (containing only lowercase alphanumeric characters) in android/app/src/main/res/font\n *\n * @default The OS's system font\n */\n family: string;\n /** The scale factor for all fonts in your PaymentSheet. This value is required to be greater than 0. Font sizes are multiplied by this value before being displayed. For example, setting this to 1.2 increases the size of all text by 20%.\n * @default 1.0\n */\n scale: number;\n};\n\nexport type ShadowConfig = {\n /** The color of the shadow.\n * @default \"#000000\"\n * */\n color: string;\n /** The alpha or opacity of the shadow.\n * @default 0.05\n */\n opacity: number;\n /** The positioning of the shadow relative to the component. For example, a negative x and y will result in a shadow placed below and to the left of the component.\n * @default {x: 0, y: 2}\n */\n offset: { x: number; y: number };\n /** The blur radius of the shadow.\n * @default 4\n */\n blurRadius: number;\n};\n\nexport type GlobalColorConfig = {\n /** A primary color used throughout your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System blue color on iOS, and \"#007AFF\" (light) / \"#0074D4\" (dark) on Android.\n */\n primary: string;\n /** The color used for the background of your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System background color on iOS, and \"#ffffff\" (light) / \"#2e2e2e\" (dark) on Android.\n */\n background: string;\n /** The color used for the background of inputs, tabs, and other components in your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System background color (light) / System secondary background color (dark) on iOS, and \"#ffffff\" (light) / \"#a9a9a9\" (dark) on Android.\n */\n componentBackground: string;\n /** The color used for the external border of inputs, tabs, and other components in your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System gray (3) color on iOS, and \"#33787880\" (light) / \"#787880\" (dark) on Android.\n */\n componentBorder: string;\n /** The color used for the internal border (meaning the border is shared with another component) of inputs, tabs, and other components in your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System gray (3) color on iOS, and \"#33787880\" (light) / \"#787880\" (dark) on Android.\n */\n componentDivider: string;\n /** The color of the header text in your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System label color on iOS, and \"#000000\" (light) / \"#ffffff\" (dark) on Android.\n */\n primaryText: string;\n /** The color of the label text of input fields, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System seconday label color on iOS, and \"#000000\" (light) / \"#ffffff\" (dark) on Android.\n */\n secondaryText: string;\n /** The color of the input text in your PaymentSheet components, such as the user's card number or zip code, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default \"#000000\"\n */\n componentText: string;\n /** The color of the placeholder text of input fields, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System label color on iOS, and \"#99000000\" (light) / \"#99ffffff\" (dark) on Android.\n */\n placeholderText: string;\n /** The color used for icons in your Payment Sheet, such as the close or back icons, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System seconday label color on iOS, and \"#99000000\" (light) / \"#ffffff\" (dark) on Android.\n */\n icon: string;\n /** The color used to indicate errors or destructive actions in your Payment Sheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System red color on iOS, and \"#ff0000\" (light) / \"#ff0000\" (dark) on Android.\n */\n error: string;\n};\n\nexport type PrimaryButtonConfig = {\n /** The font family used specifically for the primary button.\n * @default The root `appearance.font.family`\n */\n font: Pick<FontConfig, 'family'>;\n /** The colors used specifically for the primary button. Provide either a base config, or both `light` and `dark` configs, which will be useed based on whether the user is in Light or Dark mode. */\n colors:\n | PrimaryButtonColorConfig\n | { light: PrimaryButtonColorConfig; dark: PrimaryButtonColorConfig };\n /** Describes the border and shadow of the primary button. */\n shapes: {\n /** The border radius used for the primary button in your PaymentSheet\n * @default The root `appearance.shapes.borderRadius`\n */\n borderRadius: number;\n /** The border width used for the primary button in your PaymentSheet\n * @default The root `appearance.shapes.borderWidth`\n */\n borderWidth: number;\n /** iOS only. The shadow used for the primary button in your PaymentSheet\n * @default The root `appearance.shapes.shadow`\n */\n shadow: ShadowConfig;\n };\n};\n\nexport type PrimaryButtonColorConfig = {\n /** The background color used for the primary button in your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The root `appearance.colors.primary`\n */\n background: string;\n /** The color of the text for the primary button in your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default White or black, depending on the color of the button.\n */\n text: string;\n /** The border color used for the primary button in your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System quaternary label on iOS, transparent on Android.\n */\n border: string;\n};\n\ntype RecursivePartial<T> = {\n [P in keyof T]?: T[P] extends (infer U)[]\n ? RecursivePartial<U>[]\n : T[P] extends object\n ? RecursivePartial<T[P]>\n : T[P];\n};\nexport interface PaymentOption {\n label: string;\n image: string;\n}\n\nexport type PresentOptions = {\n /** The number of milliseconds (after presenting) before the Payment Sheet closes automatically, at which point\n *`presentPaymentSheet` will resolve with an `error.code` of `PaymentSheetError.Timeout`. The default is no timeout.\n */\n timeout?: number;\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":["CollectionMode","AddressCollectionMode"],"sources":["PaymentSheet.ts"],"sourcesContent":["import type { BillingDetails, AddressDetails } from './Common';\nimport type { CartSummaryItem } from './ApplePay';\nimport type {\n ButtonType,\n RecurringPaymentRequest,\n AutomaticReloadPaymentRequest,\n MultiMerchantRequest,\n} from './PlatformPay';\n\nexport type SetupParams = ClientSecretParams & {\n /** Your customer-facing business name. On Android, this is required and cannot be an empty string. */\n merchantDisplayName: string;\n /** The identifier of the Stripe Customer object. See https://stripe.com/docs/api/customers/object#customer_object-id */\n customerId?: string;\n /** A short-lived token that allows the SDK to access a Customer’s payment methods. */\n customerEphemeralKeySecret?: string;\n /** When set to true, separates out the payment method selection & confirmation steps.\n * If true, you must call `confirmPaymentSheetPayment` on your own. Defaults to false. */\n customFlow?: boolean;\n /** iOS only. Enable Apple Pay in the Payment Sheet by passing an ApplePayParams object. */\n applePay?: ApplePayParams;\n /** Android only. Enable Google Pay in the Payment Sheet by passing a GooglePayParams object. */\n googlePay?: GooglePayParams;\n /** The color styling to use for PaymentSheet UI. Defaults to 'automatic'. */\n style?: 'alwaysLight' | 'alwaysDark' | 'automatic';\n /** A URL that redirects back to your app that PaymentSheet can use to auto-dismiss web views used for additional authentication, e.g. 3DS2 */\n returnURL?: string;\n /** Configuration for how billing details are collected during checkout. */\n billingDetailsCollectionConfiguration?: BillingDetailsCollectionConfiguration;\n /** 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. */\n defaultBillingDetails?: BillingDetails;\n /**\n * The shipping information for the customer. If set, PaymentSheet will pre-populate the form fields with the values provided.\n * This is used to display a \"Billing address is same as shipping\" checkbox if `defaultBillingDetails` is not provided.\n * If `name` and `line1` are populated, it's also [attached to the PaymentIntent](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-shipping) during payment.\n */\n defaultShippingDetails?: AddressDetails;\n /** If true, allows payment methods that do not move money at the end of the checkout. Defaults to false.\n *\n * Some payment methods can’t guarantee you will receive funds from your customer at the end of the checkout\n * because they take time to settle (eg. most bank debits, like SEPA or ACH) or require customer action to\n * complete (e.g. OXXO, Konbini, Boleto). If this is set to true, make sure your integration listens to webhooks\n * for notifications on whether a payment has succeeded or not.\n */\n allowsDelayedPaymentMethods?: boolean;\n /** Customizes the appearance of PaymentSheet */\n appearance?: AppearanceParams;\n /** The label to use for the primary button. If not set, Payment Sheet will display suitable default labels for payment and setup intents. */\n primaryButtonLabel?: string;\n};\n\nexport type ClientSecretParams =\n | {\n paymentIntentClientSecret: string;\n setupIntentClientSecret?: undefined;\n }\n | {\n setupIntentClientSecret: string;\n paymentIntentClientSecret?: undefined;\n };\n\nexport type ApplePayParams = {\n /** The two-letter ISO 3166 code of the country of your business, e.g. \"US\" */\n merchantCountryCode: string;\n /**\n * An array of CartSummaryItem item objects that summarize the amount of the payment. If you're using a SetupIntent\n * for a recurring payment, you should set this to display the amount you intend to charge. */\n cartItems?: CartSummaryItem[];\n /** Sets the text displayed by the call to action button in the Apple Pay sheet. */\n buttonType?: ButtonType;\n /** A typical request is for a one-time payment. To support different types of payment requests, include a PaymentRequestType. Only supported on iOS 16 and up. */\n request?:\n | RecurringPaymentRequest\n | AutomaticReloadPaymentRequest\n | MultiMerchantRequest;\n /** Callback function for setting the order details (retrieved from your server) to give users the\n * ability to track and manage their purchases in Wallet. Stripe calls your implementation after the\n * payment is complete, but before iOS dismisses the Apple Pay sheet. You must call the `completion`\n * function, or else the Apple Pay sheet will hang. */\n setOrderTracking?: (\n completion: (\n orderIdentifier: string,\n orderTypeIdentifier: string,\n authenticationToken: string,\n webServiceUrl: string\n ) => void\n ) => void;\n};\n\nexport type GooglePayParams = {\n /** The two-letter ISO 3166 code of the country of your business, e.g. \"US\" */\n merchantCountryCode: string;\n /** The three-letter ISO 4217 alphabetic currency code, e.g. \"USD\" or \"EUR\". Required in order to support Google Pay when processing a Setup Intent. */\n currencyCode?: string;\n /** Whether or not to use the Google Pay test environment. Set to `true` until you have applied for and been granted access to the Production environment. */\n testEnv?: boolean;\n};\n\n/**\n * Used to customize the appearance of your PaymentSheet\n */\nexport type AppearanceParams = RecursivePartial<{\n /** Describes the appearance of fonts in your PaymentSheet */\n font: FontConfig;\n /** Describes the colors in your PaymentSheet. Provide either a base config, or both `light` and `dark` configs, which will be useed based on whether the user is in Light or Dark mode. */\n colors:\n | GlobalColorConfig\n | { light: GlobalColorConfig; dark: GlobalColorConfig };\n /** Describes the appearance of shapes in the PaymentSheet, such as buttons, inputs, and tabs. */\n shapes: {\n /** The border radius used for buttons, inputs, and tabs in your PaymentSheet.\n * @default 6.0\n */\n borderRadius: number;\n /** The border width used for inputs and tabs in your PaymentSheet.\n * @default 1.0\n */\n borderWidth: number;\n /** iOS only. The shadow used for buttons, inputs, and tabs in your PaymentSheet */\n shadow: ShadowConfig;\n };\n /** Describes the appearance of the primary \"Pay\" button at the bottom of your Payment Sheet */\n primaryButton: PrimaryButtonConfig;\n}>;\n\nexport type FontConfig = {\n /**\n * The font used for regular text. PaymentSheet will attempt to use medium and bold versions of this font if they exist.\n *\n * On iOS, this should be the \"PostScript name\" found in Font Book after installing the font.\n * On Android, this should be the name of the font file (containing only lowercase alphanumeric characters) in android/app/src/main/res/font\n *\n * @default The OS's system font\n */\n family: string;\n /** The scale factor for all fonts in your PaymentSheet. This value is required to be greater than 0. Font sizes are multiplied by this value before being displayed. For example, setting this to 1.2 increases the size of all text by 20%.\n * @default 1.0\n */\n scale: number;\n};\n\nexport type ShadowConfig = {\n /** The color of the shadow.\n * @default \"#000000\"\n * */\n color: string;\n /** The alpha or opacity of the shadow.\n * @default 0.05\n */\n opacity: number;\n /** The positioning of the shadow relative to the component. For example, a negative x and y will result in a shadow placed below and to the left of the component.\n * @default {x: 0, y: 2}\n */\n offset: { x: number; y: number };\n /** The blur radius of the shadow.\n * @default 4\n */\n blurRadius: number;\n};\n\nexport type GlobalColorConfig = {\n /** A primary color used throughout your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System blue color on iOS, and \"#007AFF\" (light) / \"#0074D4\" (dark) on Android.\n */\n primary: string;\n /** The color used for the background of your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System background color on iOS, and \"#ffffff\" (light) / \"#2e2e2e\" (dark) on Android.\n */\n background: string;\n /** The color used for the background of inputs, tabs, and other components in your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System background color (light) / System secondary background color (dark) on iOS, and \"#ffffff\" (light) / \"#a9a9a9\" (dark) on Android.\n */\n componentBackground: string;\n /** The color used for the external border of inputs, tabs, and other components in your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System gray (3) color on iOS, and \"#33787880\" (light) / \"#787880\" (dark) on Android.\n */\n componentBorder: string;\n /** The color used for the internal border (meaning the border is shared with another component) of inputs, tabs, and other components in your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System gray (3) color on iOS, and \"#33787880\" (light) / \"#787880\" (dark) on Android.\n */\n componentDivider: string;\n /** The color of the header text in your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System label color on iOS, and \"#000000\" (light) / \"#ffffff\" (dark) on Android.\n */\n primaryText: string;\n /** The color of the label text of input fields, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System seconday label color on iOS, and \"#000000\" (light) / \"#ffffff\" (dark) on Android.\n */\n secondaryText: string;\n /** The color of the input text in your PaymentSheet components, such as the user's card number or zip code, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default \"#000000\"\n */\n componentText: string;\n /** The color of the placeholder text of input fields, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System label color on iOS, and \"#99000000\" (light) / \"#99ffffff\" (dark) on Android.\n */\n placeholderText: string;\n /** The color used for icons in your Payment Sheet, such as the close or back icons, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System seconday label color on iOS, and \"#99000000\" (light) / \"#ffffff\" (dark) on Android.\n */\n icon: string;\n /** The color used to indicate errors or destructive actions in your Payment Sheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System red color on iOS, and \"#ff0000\" (light) / \"#ff0000\" (dark) on Android.\n */\n error: string;\n};\n\nexport type PrimaryButtonConfig = {\n /** The font family used specifically for the primary button.\n * @default The root `appearance.font.family`\n */\n font: Pick<FontConfig, 'family'>;\n /** The colors used specifically for the primary button. Provide either a base config, or both `light` and `dark` configs, which will be useed based on whether the user is in Light or Dark mode. */\n colors:\n | PrimaryButtonColorConfig\n | { light: PrimaryButtonColorConfig; dark: PrimaryButtonColorConfig };\n /** Describes the border and shadow of the primary button. */\n shapes: {\n /** The border radius used for the primary button in your PaymentSheet\n * @default The root `appearance.shapes.borderRadius`\n */\n borderRadius: number;\n /** The border width used for the primary button in your PaymentSheet\n * @default The root `appearance.shapes.borderWidth`\n */\n borderWidth: number;\n /** iOS only. The shadow used for the primary button in your PaymentSheet\n * @default The root `appearance.shapes.shadow`\n */\n shadow: ShadowConfig;\n };\n};\n\nexport type PrimaryButtonColorConfig = {\n /** The background color used for the primary button in your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The root `appearance.colors.primary`\n */\n background: string;\n /** The color of the text for the primary button in your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default White or black, depending on the color of the button.\n */\n text: string;\n /** The border color used for the primary button in your PaymentSheet, represented as a hex string with format #RRGGBB or #AARRGGBB.\n * @default The System quaternary label on iOS, transparent on Android.\n */\n border: string;\n};\n\ntype RecursivePartial<T> = {\n [P in keyof T]?: T[P] extends (infer U)[]\n ? RecursivePartial<U>[]\n : T[P] extends object\n ? RecursivePartial<T[P]>\n : T[P];\n};\nexport interface PaymentOption {\n label: string;\n image: string;\n}\n\nexport type PresentOptions = {\n /** The number of milliseconds (after presenting) before the Payment Sheet closes automatically, at which point\n *`presentPaymentSheet` will resolve with an `error.code` of `PaymentSheetError.Timeout`. The default is no timeout.\n */\n timeout?: number;\n};\n\nexport type BillingDetailsCollectionConfiguration = {\n /** How to collect the name field. Defaults to `CollectionMode.automatic`. */\n name?: CollectionMode;\n /** How to collect the phone field. Defaults to `CollectionMode.automatic`. */\n phone?: CollectionMode;\n /** How to collect the email field. Defaults to `CollectionMode.automatic`. */\n email?: CollectionMode;\n /** How to collect the billing address. Defaults to `CollectionMode.automatic`. */\n address?: AddressCollectionMode;\n /** 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. */\n attachDefaultsToPaymentMethod?: Boolean;\n};\n\nexport enum CollectionMode {\n /** The field may or may not be collected depending on the Payment Method's requirements. */\n AUTOMATIC = 'automatic',\n /** The field will never be collected. If this field is required by the Payment Method, you must provide it as part of `defaultBillingDetails`. */\n NEVER = 'never',\n /** The field will always be collected, even if it isn't required for the Payment Method. */\n ALWAYS = 'always',\n}\n\nexport enum AddressCollectionMode {\n /** Only the fields required by the Payment Method will be collected, which may be none. */\n AUTOMATIC = 'automatic',\n /** Billing address will never be collected. If the Payment Method requires a billing address, you must provide it as part of `defaultBillingDetails`. */\n NEVER = 'never',\n /** Collect the full billing address, regardless of the Payment Method's requirements. */\n FULL = 'full',\n}\n"],"mappings":"wHAwRYA,eAAc,iDAAdA,cAAc,EAAdA,cAAc,0BAAdA,cAAc,kBAAdA,cAAc,uBAAdA,cAAc,0BAAdA,cAAc,SASdC,sBAAqB,+DAArBA,qBAAqB,EAArBA,qBAAqB,0BAArBA,qBAAqB,kBAArBA,qBAAqB,mBAArBA,qBAAqB,iCAArBA,qBAAqB"}
|