@stripe/stripe-react-native 0.37.2 → 0.38.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 +19 -2
- package/android/build.gradle +1 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +26 -15
- package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetFragment.kt +8 -2
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +6 -0
- package/ios/CustomerSheet/CustomerSheetUtils.swift +6 -2
- package/ios/StripeSdk+CustomerSheet.swift +2 -1
- package/ios/StripeSdk+PaymentSheet.swift +9 -1
- package/lib/commonjs/types/CustomerSheet.js.map +1 -1
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/module/types/CustomerSheet.js.map +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/typescript/src/types/CustomerSheet.d.ts +5 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts +12 -0
- package/package.json +3 -3
- package/src/types/CustomerSheet.ts +5 -0
- package/src/types/PaymentSheet.ts +12 -0
- package/stripe-react-native.podspec +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,17 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.38.0 - 2024-05-24
|
|
6
|
+
|
|
7
|
+
**Features**
|
|
8
|
+
|
|
9
|
+
- Adds support for `paymentMethodOrder` in PaymentSheet, which provides client side sorting of payment methods.
|
|
10
|
+
- Updated `stripe-android` to 20.44.\*
|
|
11
|
+
|
|
12
|
+
## 0.37.3 - 2024-04-19
|
|
13
|
+
|
|
14
|
+
**Fixes**
|
|
15
|
+
|
|
16
|
+
- Fixed an issue with generating App Privacy reports.
|
|
17
|
+
- Updated `stripe-ios` to 23.27.\*
|
|
18
|
+
- Updated `stripe-android` to 20.41.\*
|
|
19
|
+
|
|
5
20
|
## 0.37.2 - 2024-04-02
|
|
6
21
|
|
|
7
22
|
**Fixes**
|
|
8
23
|
|
|
9
|
-
-
|
|
24
|
+
- Updated `stripe-ios` to 23.26.\*
|
|
25
|
+
- Updated `stripe-android` to 20.40.\*
|
|
10
26
|
|
|
11
27
|
## 0.37.1 - 2024-03-15
|
|
12
28
|
|
|
13
29
|
**Fixes**
|
|
14
30
|
|
|
15
|
-
-
|
|
31
|
+
- Updated `stripe-ios` to 23.25.\*
|
|
32
|
+
- Updated `stripe-android` to 20.39.\*
|
|
16
33
|
|
|
17
34
|
## 0.37.0 - 2024-02-16
|
|
18
35
|
|
package/android/build.gradle
CHANGED
|
@@ -148,7 +148,7 @@ dependencies {
|
|
|
148
148
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0'
|
|
149
149
|
|
|
150
150
|
// play-services-wallet is already included in stripe-android
|
|
151
|
-
compileOnly "com.google.android.gms:play-services-wallet:19.
|
|
151
|
+
compileOnly "com.google.android.gms:play-services-wallet:19.3.0"
|
|
152
152
|
|
|
153
153
|
// Users need to declare this dependency on their own, otherwise all methods are a no-op
|
|
154
154
|
compileOnly 'com.stripe:stripe-android-issuing-push-provisioning:1.1.0'
|
|
@@ -284,7 +284,8 @@ class PaymentLauncherFragment(
|
|
|
284
284
|
StripeIntent.NextActionType.DisplayOxxoDetails,
|
|
285
285
|
StripeIntent.NextActionType.DisplayBoletoDetails,
|
|
286
286
|
StripeIntent.NextActionType.DisplayKonbiniDetails,
|
|
287
|
-
StripeIntent.NextActionType.VerifyWithMicrodeposits
|
|
287
|
+
StripeIntent.NextActionType.VerifyWithMicrodeposits,
|
|
288
|
+
StripeIntent.NextActionType.DisplayMultibancoDetails -> true
|
|
288
289
|
StripeIntent.NextActionType.RedirectToUrl,
|
|
289
290
|
StripeIntent.NextActionType.UseStripeSdk,
|
|
290
291
|
StripeIntent.NextActionType.AlipayRedirect,
|
|
@@ -23,11 +23,13 @@ import com.reactnativestripesdk.addresssheet.AddressSheetView
|
|
|
23
23
|
import com.reactnativestripesdk.utils.*
|
|
24
24
|
import com.reactnativestripesdk.utils.createError
|
|
25
25
|
import com.reactnativestripesdk.utils.createResult
|
|
26
|
+
import com.stripe.android.ExperimentalAllowsRemovalOfLastSavedPaymentMethodApi
|
|
26
27
|
import com.stripe.android.paymentsheet.*
|
|
27
28
|
import kotlinx.coroutines.CompletableDeferred
|
|
28
29
|
import java.io.ByteArrayOutputStream
|
|
29
30
|
import kotlin.Exception
|
|
30
31
|
|
|
32
|
+
@OptIn(ExperimentalAllowsRemovalOfLastSavedPaymentMethodApi::class)
|
|
31
33
|
class PaymentSheetFragment(
|
|
32
34
|
private val context: ReactApplicationContext,
|
|
33
35
|
private val initPromise: Promise
|
|
@@ -67,6 +69,8 @@ class PaymentSheetFragment(
|
|
|
67
69
|
val allowsDelayedPaymentMethods = arguments?.getBoolean("allowsDelayedPaymentMethods")
|
|
68
70
|
val billingDetailsBundle = arguments?.getBundle("defaultBillingDetails")
|
|
69
71
|
val billingConfigParams = arguments?.getBundle("billingDetailsCollectionConfiguration")
|
|
72
|
+
val paymentMethodOrder = arguments?.getStringArrayList("paymentMethodOrder")
|
|
73
|
+
val allowsRemovalOfLastSavedPaymentMethod = arguments?.getBoolean("allowsRemovalOfLastSavedPaymentMethod")
|
|
70
74
|
paymentIntentClientSecret = arguments?.getString("paymentIntentClientSecret").orEmpty()
|
|
71
75
|
setupIntentClientSecret = arguments?.getString("setupIntentClientSecret").orEmpty()
|
|
72
76
|
intentConfiguration = try {
|
|
@@ -181,22 +185,29 @@ class PaymentSheetFragment(
|
|
|
181
185
|
billingDetailsBundle.getString("name"),
|
|
182
186
|
billingDetailsBundle.getString("phone"))
|
|
183
187
|
}
|
|
188
|
+
val configurationBuilder = PaymentSheet.Configuration.Builder(merchantDisplayName)
|
|
189
|
+
.allowsDelayedPaymentMethods(allowsDelayedPaymentMethods ?: false)
|
|
190
|
+
.defaultBillingDetails(defaultBillingDetails)
|
|
191
|
+
.customer(
|
|
192
|
+
if (customerId.isNotEmpty() && customerEphemeralKeySecret.isNotEmpty()) PaymentSheet.CustomerConfiguration(
|
|
193
|
+
id = customerId,
|
|
194
|
+
ephemeralKeySecret = customerEphemeralKeySecret
|
|
195
|
+
) else null
|
|
196
|
+
)
|
|
197
|
+
.googlePay(googlePayConfig)
|
|
198
|
+
.appearance(appearance)
|
|
199
|
+
.shippingDetails(shippingDetails)
|
|
200
|
+
.billingDetailsCollectionConfiguration(billingDetailsConfig)
|
|
201
|
+
.preferredNetworks(mapToPreferredNetworks(arguments?.getIntegerArrayList("preferredNetworks")))
|
|
202
|
+
.allowsRemovalOfLastSavedPaymentMethod(allowsRemovalOfLastSavedPaymentMethod ?: true)
|
|
203
|
+
primaryButtonLabel?.let {
|
|
204
|
+
configurationBuilder.primaryButtonLabel(it)
|
|
205
|
+
}
|
|
206
|
+
paymentMethodOrder?.let {
|
|
207
|
+
configurationBuilder.paymentMethodOrder(it)
|
|
208
|
+
}
|
|
184
209
|
|
|
185
|
-
paymentSheetConfiguration =
|
|
186
|
-
merchantDisplayName = merchantDisplayName,
|
|
187
|
-
allowsDelayedPaymentMethods = allowsDelayedPaymentMethods ?: false,
|
|
188
|
-
defaultBillingDetails=defaultBillingDetails,
|
|
189
|
-
customer = if (customerId.isNotEmpty() && customerEphemeralKeySecret.isNotEmpty()) PaymentSheet.CustomerConfiguration(
|
|
190
|
-
id = customerId,
|
|
191
|
-
ephemeralKeySecret = customerEphemeralKeySecret
|
|
192
|
-
) else null,
|
|
193
|
-
googlePay = googlePayConfig,
|
|
194
|
-
appearance = appearance,
|
|
195
|
-
shippingDetails = shippingDetails,
|
|
196
|
-
primaryButtonLabel = primaryButtonLabel,
|
|
197
|
-
billingDetailsCollectionConfiguration = billingDetailsConfig,
|
|
198
|
-
preferredNetworks = mapToPreferredNetworks(arguments?.getIntegerArrayList("preferredNetworks"))
|
|
199
|
-
)
|
|
210
|
+
paymentSheetConfiguration = configurationBuilder.build()
|
|
200
211
|
|
|
201
212
|
if (arguments?.getBoolean("customFlow") == true) {
|
|
202
213
|
flowController = if (intentConfiguration != null) {
|
package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetFragment.kt
CHANGED
|
@@ -15,6 +15,7 @@ import androidx.fragment.app.Fragment
|
|
|
15
15
|
import com.facebook.react.bridge.*
|
|
16
16
|
import com.reactnativestripesdk.customersheet.ReactNativeCustomerAdapter
|
|
17
17
|
import com.reactnativestripesdk.utils.*
|
|
18
|
+
import com.stripe.android.ExperimentalAllowsRemovalOfLastSavedPaymentMethodApi
|
|
18
19
|
import com.stripe.android.customersheet.CustomerAdapter
|
|
19
20
|
import com.stripe.android.customersheet.CustomerEphemeralKey
|
|
20
21
|
import com.stripe.android.customersheet.CustomerSheet
|
|
@@ -28,7 +29,7 @@ import kotlinx.coroutines.Dispatchers
|
|
|
28
29
|
import kotlinx.coroutines.launch
|
|
29
30
|
|
|
30
31
|
|
|
31
|
-
@OptIn(ExperimentalCustomerSheetApi::class)
|
|
32
|
+
@OptIn(ExperimentalCustomerSheetApi::class, ExperimentalAllowsRemovalOfLastSavedPaymentMethodApi::class)
|
|
32
33
|
class CustomerSheetFragment : Fragment() {
|
|
33
34
|
private var customerSheet: CustomerSheet? = null
|
|
34
35
|
internal var customerAdapter: ReactNativeCustomerAdapter? = null
|
|
@@ -67,7 +68,8 @@ class CustomerSheetFragment : Fragment() {
|
|
|
67
68
|
val customerId = arguments?.getString("customerId")
|
|
68
69
|
val customerEphemeralKeySecret = arguments?.getString("customerEphemeralKeySecret")
|
|
69
70
|
val customerAdapterOverrideParams = arguments?.getBundle("customerAdapter")
|
|
70
|
-
|
|
71
|
+
val allowsRemovalOfLastSavedPaymentMethod = arguments?.getBoolean("allowsRemovalOfLastSavedPaymentMethod")
|
|
72
|
+
val paymentMethodOrder = arguments?.getStringArrayList("paymentMethodOrder")
|
|
71
73
|
if (customerId == null) {
|
|
72
74
|
initPromise.resolve(createError(ErrorType.Failed.toString(), "You must provide a value for `customerId`"))
|
|
73
75
|
return
|
|
@@ -89,7 +91,11 @@ class CustomerSheetFragment : Fragment() {
|
|
|
89
91
|
.googlePayEnabled(googlePayEnabled)
|
|
90
92
|
.headerTextForSelectionScreen(headerTextForSelectionScreen)
|
|
91
93
|
.preferredNetworks(mapToPreferredNetworks(arguments?.getIntegerArrayList("preferredNetworks")))
|
|
94
|
+
.allowsRemovalOfLastSavedPaymentMethod(allowsRemovalOfLastSavedPaymentMethod ?: true)
|
|
92
95
|
|
|
96
|
+
paymentMethodOrder?.let {
|
|
97
|
+
configuration.paymentMethodOrder(it)
|
|
98
|
+
}
|
|
93
99
|
billingDetailsBundle?.let {
|
|
94
100
|
configuration.defaultBillingDetails(createDefaultBillingDetails(billingDetailsBundle))
|
|
95
101
|
}
|
|
@@ -513,6 +513,12 @@ internal fun mapNextAction(type: NextActionType?, data: NextActionData?): Writab
|
|
|
513
513
|
nextActionMap.putString("mobileAuthUrl", it.mobileAuthUrl)
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
+
NextActionType.DisplayMultibancoDetails -> {
|
|
517
|
+
(data as? NextActionData.DisplayMultibancoDetails)?.let {
|
|
518
|
+
nextActionMap.putString("type", "multibanco")
|
|
519
|
+
nextActionMap.putString("voucherURL", it.hostedVoucherUrl)
|
|
520
|
+
}
|
|
521
|
+
}
|
|
516
522
|
}
|
|
517
523
|
return nextActionMap
|
|
518
524
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import Foundation
|
|
9
|
-
@_spi(PrivateBetaCustomerSheet) import StripePaymentSheet
|
|
9
|
+
@_spi(PrivateBetaCustomerSheet) @_spi(STP) import StripePaymentSheet
|
|
10
10
|
|
|
11
11
|
class CustomerSheetUtils {
|
|
12
12
|
internal class func buildCustomerSheetConfiguration(
|
|
@@ -19,7 +19,8 @@ class CustomerSheetUtils {
|
|
|
19
19
|
merchantDisplayName: String?,
|
|
20
20
|
billingDetailsCollectionConfiguration: NSDictionary?,
|
|
21
21
|
defaultBillingDetails: NSDictionary?,
|
|
22
|
-
preferredNetworks: Array<Int
|
|
22
|
+
preferredNetworks: Array<Int>?,
|
|
23
|
+
allowsRemovalOfLastSavedPaymentMethod: Bool?
|
|
23
24
|
) -> CustomerSheet.Configuration {
|
|
24
25
|
var config = CustomerSheet.Configuration()
|
|
25
26
|
config.appearance = appearance
|
|
@@ -54,6 +55,9 @@ class CustomerSheetUtils {
|
|
|
54
55
|
state: address["state"])
|
|
55
56
|
}
|
|
56
57
|
}
|
|
58
|
+
if let allowsRemovalOfLastSavedPaymentMethod = allowsRemovalOfLastSavedPaymentMethod {
|
|
59
|
+
config.allowsRemovalOfLastSavedPaymentMethod = allowsRemovalOfLastSavedPaymentMethod
|
|
60
|
+
}
|
|
57
61
|
return config
|
|
58
62
|
}
|
|
59
63
|
|
|
@@ -23,7 +23,8 @@ extension StripeSdk {
|
|
|
23
23
|
merchantDisplayName: params["merchantDisplayName"] as? String,
|
|
24
24
|
billingDetailsCollectionConfiguration: params["billingDetailsCollectionConfiguration"] as? NSDictionary,
|
|
25
25
|
defaultBillingDetails: params["defaultBillingDetails"] as? NSDictionary,
|
|
26
|
-
preferredNetworks: params["preferredNetworks"] as? Array<Int
|
|
26
|
+
preferredNetworks: params["preferredNetworks"] as? Array<Int>,
|
|
27
|
+
allowsRemovalOfLastSavedPaymentMethod: params["allowsRemovalOfLastSavedPaymentMethod"] as? Bool
|
|
27
28
|
)
|
|
28
29
|
} catch {
|
|
29
30
|
resolve(
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import Foundation
|
|
9
|
-
import StripePaymentSheet
|
|
9
|
+
@_spi(ExperimentalAllowsRemovalOfLastSavedPaymentMethodAPI) @_spi(STP) import StripePaymentSheet
|
|
10
10
|
|
|
11
11
|
extension StripeSdk {
|
|
12
12
|
internal func buildPaymentSheetConfiguration(
|
|
@@ -103,6 +103,14 @@ extension StripeSdk {
|
|
|
103
103
|
configuration.preferredNetworks = preferredNetworksAsInts.map(Mappers.intToCardBrand).compactMap { $0 }
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
if let allowsRemovalOfLastSavedPaymentMethod = params["allowsRemovalOfLastSavedPaymentMethod"] as? Bool {
|
|
107
|
+
configuration.allowsRemovalOfLastSavedPaymentMethod = allowsRemovalOfLastSavedPaymentMethod
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if let paymentMethodOrder = params["paymentMethodOrder"] as? Array<String> {
|
|
111
|
+
configuration.paymentMethodOrder = paymentMethodOrder
|
|
112
|
+
}
|
|
113
|
+
|
|
106
114
|
return (nil, configuration)
|
|
107
115
|
}
|
|
108
116
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["CustomerSheet.ts"],"sourcesContent":["import type {\n PaymentSheet,\n StripeError,\n CustomerSheetError,\n BillingDetails,\n PaymentMethod,\n CardBrand,\n} from '../types';\n\nexport type CustomerSheetInitParams = {\n /** The color styling to use for PaymentSheet UI. Defaults to 'automatic'. iOS only. */\n style?: 'alwaysLight' | 'alwaysDark' | 'automatic';\n /** Configuration for the look and feel of the UI. */\n appearance?: PaymentSheet.AppearanceParams;\n /** Optional but recommended for cards, required for other payment methods. The SetupIntent client secret that will be used to confirm a new payment method. If this is missing, you will only be able to add cards without authentication steps. */\n setupIntentClientSecret?: 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 /** Your customer-facing business name. The default value is the name of your app. */\n merchantDisplayName?: string;\n /** Optional configuration for setting the header text of the Payment Method selection screen */\n headerTextForSelectionScreen?: string;\n /** CustomerSheet pre-populates fields with the values provided. If `billingDetailsCollectionConfiguration.attachDefaultsToPaymentMethod` is `true`, these values will be attached to the payment method even if they are not collected by the CustomerSheet UI. */\n defaultBillingDetails?: BillingDetails;\n /** Describes how billing details should be collected. All values default to `AUTOMATIC`. If `NEVER` is used for a required field for the Payment Method, you must provide an appropriate value as part of `defaultBillingDetails`. */\n billingDetailsCollectionConfiguration?: PaymentSheet.BillingDetailsCollectionConfiguration;\n /** A URL that redirects back to your app that CustomerSheet can use to auto-dismiss web views used for additional authentication, e.g. 3DS2 */\n returnURL?: string;\n /** Optional configuration to display a custom message when a saved payment method is removed. iOS only. */\n removeSavedPaymentMethodMessage?: string;\n /** Whether to show Apple Pay as an option. Defaults to false. */\n applePayEnabled?: boolean;\n /** Whether to show Google Pay as an option. Defaults to false. */\n googlePayEnabled?: boolean;\n /** The list of preferred networks that should be used to process payments made with a co-branded card.\n * This value will only be used if your user hasn't selected a network themselves. */\n preferredNetworks?: Array<CardBrand>;\n /** Optional override. It is generally recommended to rely on the default behavior, but- provide a CustomerAdapter here if\n * you would prefer retrieving and updating your Stripe customer object via your own backend instead.\n * WARNING: When implementing your own CustomerAdapter, ensure your application complies with all applicable laws and regulations, including data privacy and consumer protection.\n */\n customerAdapter?: CustomerAdapter;\n};\n\nexport type CustomerSheetPresentParams = {\n /** Controls how the modal is presented (after animation). iOS only. Defaults to `popover`. See https://developer.apple.com/documentation/uikit/uimodalpresentationstyle for more info. */\n presentationStyle?:\n | 'fullscreen'\n | 'popover'\n | 'pageSheet'\n | 'formSheet'\n | 'automatic'\n | 'overFullScreen';\n /** Controls how the modal animates. iOS only. */\n animationStyle?: 'flip' | 'curl' | 'slide' | 'dissolve';\n /** Time (in milliseconds) before the Customer Sheet will automatically dismiss. */\n timeout?: number;\n};\n\nexport type CustomerSheetResult = {\n /** The users selected payment option, if one exists. */\n paymentOption?: PaymentSheet.PaymentOption;\n /** The Stripe PaymentMethod associated with the paymentOption, if it exists. */\n paymentMethod?: PaymentMethod.Result;\n /** The error that occurred. */\n error?: StripeError<CustomerSheetError>;\n};\n\nexport interface CustomerAdapter {\n /** Retrieves a list of Payment Methods attached to a customer.\n * If you are implementing your own CustomerAdapter:\n * Call the list method ( https://stripe.com/docs/api/payment_methods/list )\n * with the Stripe customer. Return the list of payment methods in JSON format.\n */\n fetchPaymentMethods?(): Promise<Array<object>>;\n /** Adds a Payment Method to a customer.\n * If you are implementing your own CustomerAdapter:\n * On your backend, retrieve the Stripe customer associated with your logged-in user.\n * Then, call the Attach method on the Payment Method with that customer's ID\n * ( https://stripe.com/docs/api/payment_methods/attach ).\n * - Parameters:\n * - paymentMethod: A valid Stripe Payment Method ID\n * Return the payment method in JSON format.\n */\n attachPaymentMethod?(paymentMethodId: string): Promise<object>;\n /** Deletes the given Payment Method from the customer.\n * If you are implementing your own CustomerAdapter:\n * Call the Detach method ( https://stripe.com/docs/api/payment_methods/detach )\n * on the Payment Method.\n * - Parameters:\n * - paymentMethod: The Stripe Payment Method ID to delete from the customer\n * Return the payment method in JSON format.\n */\n detachPaymentMethod?(paymentMethodId: String): Promise<object>;\n /** Set the last selected payment method for the customer.\n * To unset the default payment method, `null` is passed as the `paymentOption`.\n * If you are implementing your own CustomerAdapter:\n * Save a representation of the passed `paymentOption` as the customer's default payment method.\n */\n setSelectedPaymentOption?(\n paymentOption: CustomerPaymentOption | null\n ): Promise<void>;\n /** Retrieve the last selected payment method for the customer.\n * If you are implementing your own CustomerAdapter:\n * Return a CustomerPaymentOption for the customer's default selected payment method.\n * If no default payment method is selected, return null.\n */\n fetchSelectedPaymentOption?(): Promise<CustomerPaymentOption | null>;\n /** Creates a SetupIntent configured to attach a new payment method to a customer,\n * then returns the client secret for the created SetupIntent.\n */\n setupIntentClientSecretForCustomerAttach?(): Promise<String>;\n}\n\nexport type CustomerPaymentOption =\n | 'apple_pay'\n | 'google_pay'\n | 'link'\n | string;\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["CustomerSheet.ts"],"sourcesContent":["import type {\n PaymentSheet,\n StripeError,\n CustomerSheetError,\n BillingDetails,\n PaymentMethod,\n CardBrand,\n} from '../types';\n\nexport type CustomerSheetInitParams = {\n /** The color styling to use for PaymentSheet UI. Defaults to 'automatic'. iOS only. */\n style?: 'alwaysLight' | 'alwaysDark' | 'automatic';\n /** Configuration for the look and feel of the UI. */\n appearance?: PaymentSheet.AppearanceParams;\n /** Optional but recommended for cards, required for other payment methods. The SetupIntent client secret that will be used to confirm a new payment method. If this is missing, you will only be able to add cards without authentication steps. */\n setupIntentClientSecret?: 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 /** Your customer-facing business name. The default value is the name of your app. */\n merchantDisplayName?: string;\n /** Optional configuration for setting the header text of the Payment Method selection screen */\n headerTextForSelectionScreen?: string;\n /** CustomerSheet pre-populates fields with the values provided. If `billingDetailsCollectionConfiguration.attachDefaultsToPaymentMethod` is `true`, these values will be attached to the payment method even if they are not collected by the CustomerSheet UI. */\n defaultBillingDetails?: BillingDetails;\n /** Describes how billing details should be collected. All values default to `AUTOMATIC`. If `NEVER` is used for a required field for the Payment Method, you must provide an appropriate value as part of `defaultBillingDetails`. */\n billingDetailsCollectionConfiguration?: PaymentSheet.BillingDetailsCollectionConfiguration;\n /** A URL that redirects back to your app that CustomerSheet can use to auto-dismiss web views used for additional authentication, e.g. 3DS2 */\n returnURL?: string;\n /** Optional configuration to display a custom message when a saved payment method is removed. iOS only. */\n removeSavedPaymentMethodMessage?: string;\n /** Whether to show Apple Pay as an option. Defaults to false. */\n applePayEnabled?: boolean;\n /** Whether to show Google Pay as an option. Defaults to false. */\n googlePayEnabled?: boolean;\n /** The list of preferred networks that should be used to process payments made with a co-branded card.\n * This value will only be used if your user hasn't selected a network themselves. */\n preferredNetworks?: Array<CardBrand>;\n /** Optional override. It is generally recommended to rely on the default behavior, but- provide a CustomerAdapter here if\n * you would prefer retrieving and updating your Stripe customer object via your own backend instead.\n * WARNING: When implementing your own CustomerAdapter, ensure your application complies with all applicable laws and regulations, including data privacy and consumer protection.\n */\n customerAdapter?: CustomerAdapter;\n /** This is an experimental feature that may be removed at any time.\n * Defaults to true. If true, the customer can delete all saved payment methods.\n * If false, the customer can't delete if they only have one saved payment method remaining.\n */\n allowsRemovalOfLastSavedPaymentMethod?: boolean;\n};\n\nexport type CustomerSheetPresentParams = {\n /** Controls how the modal is presented (after animation). iOS only. Defaults to `popover`. See https://developer.apple.com/documentation/uikit/uimodalpresentationstyle for more info. */\n presentationStyle?:\n | 'fullscreen'\n | 'popover'\n | 'pageSheet'\n | 'formSheet'\n | 'automatic'\n | 'overFullScreen';\n /** Controls how the modal animates. iOS only. */\n animationStyle?: 'flip' | 'curl' | 'slide' | 'dissolve';\n /** Time (in milliseconds) before the Customer Sheet will automatically dismiss. */\n timeout?: number;\n};\n\nexport type CustomerSheetResult = {\n /** The users selected payment option, if one exists. */\n paymentOption?: PaymentSheet.PaymentOption;\n /** The Stripe PaymentMethod associated with the paymentOption, if it exists. */\n paymentMethod?: PaymentMethod.Result;\n /** The error that occurred. */\n error?: StripeError<CustomerSheetError>;\n};\n\nexport interface CustomerAdapter {\n /** Retrieves a list of Payment Methods attached to a customer.\n * If you are implementing your own CustomerAdapter:\n * Call the list method ( https://stripe.com/docs/api/payment_methods/list )\n * with the Stripe customer. Return the list of payment methods in JSON format.\n */\n fetchPaymentMethods?(): Promise<Array<object>>;\n /** Adds a Payment Method to a customer.\n * If you are implementing your own CustomerAdapter:\n * On your backend, retrieve the Stripe customer associated with your logged-in user.\n * Then, call the Attach method on the Payment Method with that customer's ID\n * ( https://stripe.com/docs/api/payment_methods/attach ).\n * - Parameters:\n * - paymentMethod: A valid Stripe Payment Method ID\n * Return the payment method in JSON format.\n */\n attachPaymentMethod?(paymentMethodId: string): Promise<object>;\n /** Deletes the given Payment Method from the customer.\n * If you are implementing your own CustomerAdapter:\n * Call the Detach method ( https://stripe.com/docs/api/payment_methods/detach )\n * on the Payment Method.\n * - Parameters:\n * - paymentMethod: The Stripe Payment Method ID to delete from the customer\n * Return the payment method in JSON format.\n */\n detachPaymentMethod?(paymentMethodId: String): Promise<object>;\n /** Set the last selected payment method for the customer.\n * To unset the default payment method, `null` is passed as the `paymentOption`.\n * If you are implementing your own CustomerAdapter:\n * Save a representation of the passed `paymentOption` as the customer's default payment method.\n */\n setSelectedPaymentOption?(\n paymentOption: CustomerPaymentOption | null\n ): Promise<void>;\n /** Retrieve the last selected payment method for the customer.\n * If you are implementing your own CustomerAdapter:\n * Return a CustomerPaymentOption for the customer's default selected payment method.\n * If no default payment method is selected, return null.\n */\n fetchSelectedPaymentOption?(): Promise<CustomerPaymentOption | null>;\n /** Creates a SetupIntent configured to attach a new payment method to a customer,\n * then returns the client secret for the created SetupIntent.\n */\n setupIntentClientSecretForCustomerAttach?(): Promise<String>;\n}\n\nexport type CustomerPaymentOption =\n | 'apple_pay'\n | 'google_pay'\n | 'link'\n | string;\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CollectionMode","AddressCollectionMode","CaptureMethod"],"sources":["PaymentSheet.ts"],"sourcesContent":["import type { BillingDetails, AddressDetails, CardBrand } from './Common';\nimport type { CartSummaryItem } from './ApplePay';\nimport type {\n ButtonType,\n RecurringPaymentRequest,\n AutomaticReloadPaymentRequest,\n MultiMerchantRequest,\n} from './PlatformPay';\nimport type { FutureUsage } from './PaymentIntent';\nimport type { Result } from './PaymentMethod';\nimport type { StripeError } from './Errors';\n\nexport type SetupParams = IntentParams & {\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 /** Optional configuration to display a custom message when a saved payment method is removed. iOS only. */\n removeSavedPaymentMethodMessage?: string;\n /** The list of preferred networks that should be used to process payments made with a co-branded card.\n * This value will only be used if your user hasn't selected a network themselves. */\n preferredNetworks?: Array<CardBrand>;\n};\n\nexport type IntentParams =\n | {\n paymentIntentClientSecret: string;\n setupIntentClientSecret?: undefined;\n intentConfiguration?: never;\n }\n | {\n setupIntentClientSecret: string;\n paymentIntentClientSecret?: undefined;\n intentConfiguration?: never;\n }\n | {\n setupIntentClientSecret?: never;\n paymentIntentClientSecret?: never;\n intentConfiguration: IntentConfiguration;\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 /** An optional label to display with the amount. Google Pay may or may not display this label depending on its own internal logic. Defaults to a generic label if none is provided. */\n label?: string;\n /** An optional amount to display for setup intents. Google Pay may or may not display this amount depending on its own internal logic. Defaults to 0 if none is provided. */\n amount?: string;\n /** The Google Pay button type to use. Set to \"Pay\" by default. See\n * [Google's documentation](https://developers.google.com/android/reference/com/google/android/gms/wallet/Wallet.WalletOptions#environment)\n * for more information on button types. */\n buttonType?: ButtonType;\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\nexport type IntentCreationError = StripeError<'Failed'>;\n\nexport type IntentCreationCallbackParams =\n | {\n clientSecret: string;\n error?: never;\n }\n | {\n clientSecret?: never;\n error: IntentCreationError;\n };\n\nexport type IntentConfiguration = {\n /*\n Called when the customer confirms payment. Your implementation should create a PaymentIntent or SetupIntent on your server and call the `intentCreationCallback` with its client secret or an error if one occurred.\n - Note: You must create the PaymentIntent or SetupIntent with the same values used as the `IntentConfiguration` e.g. the same amount, currency, etc.\n - Parameters:\n - paymentMethod: The PaymentMethod representing the customer's payment details.\n - shouldSavePaymentMethod: This is `true` if the customer selected the \"Save this payment method for future use\" checkbox. Set `setup_future_usage` on the PaymentIntent to `off_session` if this is `true`.\n - intentCreationCallback: Call this with the `client_secret` of the PaymentIntent or SetupIntent created by your server or the error that occurred. If you're using customFlow: false (default), the error's localizedMessage will be displayed to the customer in the sheet. If you're using customFlow: true, the `confirm` method fails with the error.\n */\n confirmHandler: (\n paymentMethod: Result,\n shouldSavePaymentMethod: boolean,\n intentCreationCallback: (result: IntentCreationCallbackParams) => void\n ) => void;\n /* Information about the payment (PaymentIntent) or setup (SetupIntent).*/\n mode: Mode;\n /* A list of payment method types to display to the customer. If undefined or empty, we dynamically determine the payment methods using your Stripe Dashboard settings. */\n paymentMethodTypes?: Array<string>;\n};\n\nexport type Mode = PaymentMode | SetupMode;\n\n/**\n * Controls when the funds will be captured. Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method\n */\nexport enum CaptureMethod {\n /** (Default) Stripe automatically captures funds when the customer authorizes the payment. */\n Automatic = 'Automatic',\n /** Place a hold on the funds when the customer authorizes the payment, but don’t capture the funds until later. (Not all payment methods support this.) */\n Manual = 'Manual',\n /** Asynchronously capture funds when the customer authorizes the payment.\n - Note: Recommended over `CaptureMethod.Automatic` due to improved latency, but may require additional integration changes.\n - Seealso: https://stripe.com/docs/payments/payment-intents/asynchronous-capture-automatic-async */\n AutomaticAsync = 'AutomaticAsync',\n}\n\n/* Use this if your integration creates a PaymentIntent */\nexport type PaymentMode = {\n /* Amount intended to be collected in the smallest currency unit (e.g. 100 cents to charge $1.00). Shown in Apple Pay, Google Pay, Buy now pay later UIs, the Pay button, and influences available payment methods.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-amount */\n amount: number;\n /* Three-letter ISO currency code. Filters out payment methods based on supported currency.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-currency */\n currencyCode: string;\n /* Indicates that you intend to make future payments.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage */\n setupFutureUsage?: FutureUsage;\n /* Controls when the funds will be captured.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method */\n captureMethod?: CaptureMethod;\n};\n\n/* Use this if your integration creates a SetupIntent */\nexport type SetupMode = {\n /* Three-letter ISO currency code. Filters out payment methods based on supported currency.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-currency */\n currencyCode?: string;\n /* Indicates that you intend to make future payments.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage */\n setupFutureUsage: FutureUsage;\n};\n"],"mappings":"8IA+SYA,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,SA8CrBC,cAAa,+CAAbA,aAAa,EAAbA,aAAa,0BAAbA,aAAa,oBAAbA,aAAa,uCAAbA,aAAa,yBAAbA,aAAa"}
|
|
1
|
+
{"version":3,"names":["CollectionMode","AddressCollectionMode","CaptureMethod"],"sources":["PaymentSheet.ts"],"sourcesContent":["import type { BillingDetails, AddressDetails, CardBrand } from './Common';\nimport type { CartSummaryItem } from './ApplePay';\nimport type {\n ButtonType,\n RecurringPaymentRequest,\n AutomaticReloadPaymentRequest,\n MultiMerchantRequest,\n} from './PlatformPay';\nimport type { FutureUsage } from './PaymentIntent';\nimport type { Result } from './PaymentMethod';\nimport type { StripeError } from './Errors';\n\nexport type SetupParams = IntentParams & {\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 /** Optional configuration to display a custom message when a saved payment method is removed. iOS only. */\n removeSavedPaymentMethodMessage?: string;\n /** The list of preferred networks that should be used to process payments made with a co-branded card.\n * This value will only be used if your user hasn't selected a network themselves. */\n preferredNetworks?: Array<CardBrand>;\n /** By default, PaymentSheet will use a dynamic ordering that optimizes payment method display for the customer.\n * You can override the default order in which payment methods are displayed in PaymentSheet with a list of payment method types.\n * See https://stripe.com/docs/api/payment_methods/object#payment_method_object-type for the list of valid types. You may also pass external payment methods.\n * - Example: [\"card\", \"external_paypal\", \"klarna\"]\n * - Note: If you omit payment methods from this list, they’ll be automatically ordered by Stripe after the ones you provide. Invalid payment methods are ignored.\n */\n paymentMethodOrder?: Array<String>;\n /** This is an experimental feature that may be removed at any time.\n * Defaults to true. If true, the customer can delete all saved payment methods.\n * If false, the customer can't delete if they only have one saved payment method remaining.\n */\n allowsRemovalOfLastSavedPaymentMethod?: boolean;\n};\n\nexport type IntentParams =\n | {\n paymentIntentClientSecret: string;\n setupIntentClientSecret?: undefined;\n intentConfiguration?: never;\n }\n | {\n setupIntentClientSecret: string;\n paymentIntentClientSecret?: undefined;\n intentConfiguration?: never;\n }\n | {\n setupIntentClientSecret?: never;\n paymentIntentClientSecret?: never;\n intentConfiguration: IntentConfiguration;\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 /** An optional label to display with the amount. Google Pay may or may not display this label depending on its own internal logic. Defaults to a generic label if none is provided. */\n label?: string;\n /** An optional amount to display for setup intents. Google Pay may or may not display this amount depending on its own internal logic. Defaults to 0 if none is provided. */\n amount?: string;\n /** The Google Pay button type to use. Set to \"Pay\" by default. See\n * [Google's documentation](https://developers.google.com/android/reference/com/google/android/gms/wallet/Wallet.WalletOptions#environment)\n * for more information on button types. */\n buttonType?: ButtonType;\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\nexport type IntentCreationError = StripeError<'Failed'>;\n\nexport type IntentCreationCallbackParams =\n | {\n clientSecret: string;\n error?: never;\n }\n | {\n clientSecret?: never;\n error: IntentCreationError;\n };\n\nexport type IntentConfiguration = {\n /*\n Called when the customer confirms payment. Your implementation should create a PaymentIntent or SetupIntent on your server and call the `intentCreationCallback` with its client secret or an error if one occurred.\n - Note: You must create the PaymentIntent or SetupIntent with the same values used as the `IntentConfiguration` e.g. the same amount, currency, etc.\n - Parameters:\n - paymentMethod: The PaymentMethod representing the customer's payment details.\n - shouldSavePaymentMethod: This is `true` if the customer selected the \"Save this payment method for future use\" checkbox. Set `setup_future_usage` on the PaymentIntent to `off_session` if this is `true`.\n - intentCreationCallback: Call this with the `client_secret` of the PaymentIntent or SetupIntent created by your server or the error that occurred. If you're using customFlow: false (default), the error's localizedMessage will be displayed to the customer in the sheet. If you're using customFlow: true, the `confirm` method fails with the error.\n */\n confirmHandler: (\n paymentMethod: Result,\n shouldSavePaymentMethod: boolean,\n intentCreationCallback: (result: IntentCreationCallbackParams) => void\n ) => void;\n /* Information about the payment (PaymentIntent) or setup (SetupIntent).*/\n mode: Mode;\n /* A list of payment method types to display to the customer. If undefined or empty, we dynamically determine the payment methods using your Stripe Dashboard settings. */\n paymentMethodTypes?: Array<string>;\n};\n\nexport type Mode = PaymentMode | SetupMode;\n\n/**\n * Controls when the funds will be captured. Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method\n */\nexport enum CaptureMethod {\n /** (Default) Stripe automatically captures funds when the customer authorizes the payment. */\n Automatic = 'Automatic',\n /** Place a hold on the funds when the customer authorizes the payment, but don’t capture the funds until later. (Not all payment methods support this.) */\n Manual = 'Manual',\n /** Asynchronously capture funds when the customer authorizes the payment.\n - Note: Recommended over `CaptureMethod.Automatic` due to improved latency, but may require additional integration changes.\n - Seealso: https://stripe.com/docs/payments/payment-intents/asynchronous-capture-automatic-async */\n AutomaticAsync = 'AutomaticAsync',\n}\n\n/* Use this if your integration creates a PaymentIntent */\nexport type PaymentMode = {\n /* Amount intended to be collected in the smallest currency unit (e.g. 100 cents to charge $1.00). Shown in Apple Pay, Google Pay, Buy now pay later UIs, the Pay button, and influences available payment methods.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-amount */\n amount: number;\n /* Three-letter ISO currency code. Filters out payment methods based on supported currency.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-currency */\n currencyCode: string;\n /* Indicates that you intend to make future payments.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage */\n setupFutureUsage?: FutureUsage;\n /* Controls when the funds will be captured.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method */\n captureMethod?: CaptureMethod;\n};\n\n/* Use this if your integration creates a SetupIntent */\nexport type SetupMode = {\n /* Three-letter ISO currency code. Filters out payment methods based on supported currency.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-currency */\n currencyCode?: string;\n /* Indicates that you intend to make future payments.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage */\n setupFutureUsage: FutureUsage;\n};\n"],"mappings":"8IA2TYA,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,SA8CrBC,cAAa,+CAAbA,aAAa,EAAbA,aAAa,0BAAbA,aAAa,oBAAbA,aAAa,uCAAbA,aAAa,yBAAbA,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["CustomerSheet.ts"],"sourcesContent":["import type {\n PaymentSheet,\n StripeError,\n CustomerSheetError,\n BillingDetails,\n PaymentMethod,\n CardBrand,\n} from '../types';\n\nexport type CustomerSheetInitParams = {\n /** The color styling to use for PaymentSheet UI. Defaults to 'automatic'. iOS only. */\n style?: 'alwaysLight' | 'alwaysDark' | 'automatic';\n /** Configuration for the look and feel of the UI. */\n appearance?: PaymentSheet.AppearanceParams;\n /** Optional but recommended for cards, required for other payment methods. The SetupIntent client secret that will be used to confirm a new payment method. If this is missing, you will only be able to add cards without authentication steps. */\n setupIntentClientSecret?: 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 /** Your customer-facing business name. The default value is the name of your app. */\n merchantDisplayName?: string;\n /** Optional configuration for setting the header text of the Payment Method selection screen */\n headerTextForSelectionScreen?: string;\n /** CustomerSheet pre-populates fields with the values provided. If `billingDetailsCollectionConfiguration.attachDefaultsToPaymentMethod` is `true`, these values will be attached to the payment method even if they are not collected by the CustomerSheet UI. */\n defaultBillingDetails?: BillingDetails;\n /** Describes how billing details should be collected. All values default to `AUTOMATIC`. If `NEVER` is used for a required field for the Payment Method, you must provide an appropriate value as part of `defaultBillingDetails`. */\n billingDetailsCollectionConfiguration?: PaymentSheet.BillingDetailsCollectionConfiguration;\n /** A URL that redirects back to your app that CustomerSheet can use to auto-dismiss web views used for additional authentication, e.g. 3DS2 */\n returnURL?: string;\n /** Optional configuration to display a custom message when a saved payment method is removed. iOS only. */\n removeSavedPaymentMethodMessage?: string;\n /** Whether to show Apple Pay as an option. Defaults to false. */\n applePayEnabled?: boolean;\n /** Whether to show Google Pay as an option. Defaults to false. */\n googlePayEnabled?: boolean;\n /** The list of preferred networks that should be used to process payments made with a co-branded card.\n * This value will only be used if your user hasn't selected a network themselves. */\n preferredNetworks?: Array<CardBrand>;\n /** Optional override. It is generally recommended to rely on the default behavior, but- provide a CustomerAdapter here if\n * you would prefer retrieving and updating your Stripe customer object via your own backend instead.\n * WARNING: When implementing your own CustomerAdapter, ensure your application complies with all applicable laws and regulations, including data privacy and consumer protection.\n */\n customerAdapter?: CustomerAdapter;\n};\n\nexport type CustomerSheetPresentParams = {\n /** Controls how the modal is presented (after animation). iOS only. Defaults to `popover`. See https://developer.apple.com/documentation/uikit/uimodalpresentationstyle for more info. */\n presentationStyle?:\n | 'fullscreen'\n | 'popover'\n | 'pageSheet'\n | 'formSheet'\n | 'automatic'\n | 'overFullScreen';\n /** Controls how the modal animates. iOS only. */\n animationStyle?: 'flip' | 'curl' | 'slide' | 'dissolve';\n /** Time (in milliseconds) before the Customer Sheet will automatically dismiss. */\n timeout?: number;\n};\n\nexport type CustomerSheetResult = {\n /** The users selected payment option, if one exists. */\n paymentOption?: PaymentSheet.PaymentOption;\n /** The Stripe PaymentMethod associated with the paymentOption, if it exists. */\n paymentMethod?: PaymentMethod.Result;\n /** The error that occurred. */\n error?: StripeError<CustomerSheetError>;\n};\n\nexport interface CustomerAdapter {\n /** Retrieves a list of Payment Methods attached to a customer.\n * If you are implementing your own CustomerAdapter:\n * Call the list method ( https://stripe.com/docs/api/payment_methods/list )\n * with the Stripe customer. Return the list of payment methods in JSON format.\n */\n fetchPaymentMethods?(): Promise<Array<object>>;\n /** Adds a Payment Method to a customer.\n * If you are implementing your own CustomerAdapter:\n * On your backend, retrieve the Stripe customer associated with your logged-in user.\n * Then, call the Attach method on the Payment Method with that customer's ID\n * ( https://stripe.com/docs/api/payment_methods/attach ).\n * - Parameters:\n * - paymentMethod: A valid Stripe Payment Method ID\n * Return the payment method in JSON format.\n */\n attachPaymentMethod?(paymentMethodId: string): Promise<object>;\n /** Deletes the given Payment Method from the customer.\n * If you are implementing your own CustomerAdapter:\n * Call the Detach method ( https://stripe.com/docs/api/payment_methods/detach )\n * on the Payment Method.\n * - Parameters:\n * - paymentMethod: The Stripe Payment Method ID to delete from the customer\n * Return the payment method in JSON format.\n */\n detachPaymentMethod?(paymentMethodId: String): Promise<object>;\n /** Set the last selected payment method for the customer.\n * To unset the default payment method, `null` is passed as the `paymentOption`.\n * If you are implementing your own CustomerAdapter:\n * Save a representation of the passed `paymentOption` as the customer's default payment method.\n */\n setSelectedPaymentOption?(\n paymentOption: CustomerPaymentOption | null\n ): Promise<void>;\n /** Retrieve the last selected payment method for the customer.\n * If you are implementing your own CustomerAdapter:\n * Return a CustomerPaymentOption for the customer's default selected payment method.\n * If no default payment method is selected, return null.\n */\n fetchSelectedPaymentOption?(): Promise<CustomerPaymentOption | null>;\n /** Creates a SetupIntent configured to attach a new payment method to a customer,\n * then returns the client secret for the created SetupIntent.\n */\n setupIntentClientSecretForCustomerAttach?(): Promise<String>;\n}\n\nexport type CustomerPaymentOption =\n | 'apple_pay'\n | 'google_pay'\n | 'link'\n | string;\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["CustomerSheet.ts"],"sourcesContent":["import type {\n PaymentSheet,\n StripeError,\n CustomerSheetError,\n BillingDetails,\n PaymentMethod,\n CardBrand,\n} from '../types';\n\nexport type CustomerSheetInitParams = {\n /** The color styling to use for PaymentSheet UI. Defaults to 'automatic'. iOS only. */\n style?: 'alwaysLight' | 'alwaysDark' | 'automatic';\n /** Configuration for the look and feel of the UI. */\n appearance?: PaymentSheet.AppearanceParams;\n /** Optional but recommended for cards, required for other payment methods. The SetupIntent client secret that will be used to confirm a new payment method. If this is missing, you will only be able to add cards without authentication steps. */\n setupIntentClientSecret?: 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 /** Your customer-facing business name. The default value is the name of your app. */\n merchantDisplayName?: string;\n /** Optional configuration for setting the header text of the Payment Method selection screen */\n headerTextForSelectionScreen?: string;\n /** CustomerSheet pre-populates fields with the values provided. If `billingDetailsCollectionConfiguration.attachDefaultsToPaymentMethod` is `true`, these values will be attached to the payment method even if they are not collected by the CustomerSheet UI. */\n defaultBillingDetails?: BillingDetails;\n /** Describes how billing details should be collected. All values default to `AUTOMATIC`. If `NEVER` is used for a required field for the Payment Method, you must provide an appropriate value as part of `defaultBillingDetails`. */\n billingDetailsCollectionConfiguration?: PaymentSheet.BillingDetailsCollectionConfiguration;\n /** A URL that redirects back to your app that CustomerSheet can use to auto-dismiss web views used for additional authentication, e.g. 3DS2 */\n returnURL?: string;\n /** Optional configuration to display a custom message when a saved payment method is removed. iOS only. */\n removeSavedPaymentMethodMessage?: string;\n /** Whether to show Apple Pay as an option. Defaults to false. */\n applePayEnabled?: boolean;\n /** Whether to show Google Pay as an option. Defaults to false. */\n googlePayEnabled?: boolean;\n /** The list of preferred networks that should be used to process payments made with a co-branded card.\n * This value will only be used if your user hasn't selected a network themselves. */\n preferredNetworks?: Array<CardBrand>;\n /** Optional override. It is generally recommended to rely on the default behavior, but- provide a CustomerAdapter here if\n * you would prefer retrieving and updating your Stripe customer object via your own backend instead.\n * WARNING: When implementing your own CustomerAdapter, ensure your application complies with all applicable laws and regulations, including data privacy and consumer protection.\n */\n customerAdapter?: CustomerAdapter;\n /** This is an experimental feature that may be removed at any time.\n * Defaults to true. If true, the customer can delete all saved payment methods.\n * If false, the customer can't delete if they only have one saved payment method remaining.\n */\n allowsRemovalOfLastSavedPaymentMethod?: boolean;\n};\n\nexport type CustomerSheetPresentParams = {\n /** Controls how the modal is presented (after animation). iOS only. Defaults to `popover`. See https://developer.apple.com/documentation/uikit/uimodalpresentationstyle for more info. */\n presentationStyle?:\n | 'fullscreen'\n | 'popover'\n | 'pageSheet'\n | 'formSheet'\n | 'automatic'\n | 'overFullScreen';\n /** Controls how the modal animates. iOS only. */\n animationStyle?: 'flip' | 'curl' | 'slide' | 'dissolve';\n /** Time (in milliseconds) before the Customer Sheet will automatically dismiss. */\n timeout?: number;\n};\n\nexport type CustomerSheetResult = {\n /** The users selected payment option, if one exists. */\n paymentOption?: PaymentSheet.PaymentOption;\n /** The Stripe PaymentMethod associated with the paymentOption, if it exists. */\n paymentMethod?: PaymentMethod.Result;\n /** The error that occurred. */\n error?: StripeError<CustomerSheetError>;\n};\n\nexport interface CustomerAdapter {\n /** Retrieves a list of Payment Methods attached to a customer.\n * If you are implementing your own CustomerAdapter:\n * Call the list method ( https://stripe.com/docs/api/payment_methods/list )\n * with the Stripe customer. Return the list of payment methods in JSON format.\n */\n fetchPaymentMethods?(): Promise<Array<object>>;\n /** Adds a Payment Method to a customer.\n * If you are implementing your own CustomerAdapter:\n * On your backend, retrieve the Stripe customer associated with your logged-in user.\n * Then, call the Attach method on the Payment Method with that customer's ID\n * ( https://stripe.com/docs/api/payment_methods/attach ).\n * - Parameters:\n * - paymentMethod: A valid Stripe Payment Method ID\n * Return the payment method in JSON format.\n */\n attachPaymentMethod?(paymentMethodId: string): Promise<object>;\n /** Deletes the given Payment Method from the customer.\n * If you are implementing your own CustomerAdapter:\n * Call the Detach method ( https://stripe.com/docs/api/payment_methods/detach )\n * on the Payment Method.\n * - Parameters:\n * - paymentMethod: The Stripe Payment Method ID to delete from the customer\n * Return the payment method in JSON format.\n */\n detachPaymentMethod?(paymentMethodId: String): Promise<object>;\n /** Set the last selected payment method for the customer.\n * To unset the default payment method, `null` is passed as the `paymentOption`.\n * If you are implementing your own CustomerAdapter:\n * Save a representation of the passed `paymentOption` as the customer's default payment method.\n */\n setSelectedPaymentOption?(\n paymentOption: CustomerPaymentOption | null\n ): Promise<void>;\n /** Retrieve the last selected payment method for the customer.\n * If you are implementing your own CustomerAdapter:\n * Return a CustomerPaymentOption for the customer's default selected payment method.\n * If no default payment method is selected, return null.\n */\n fetchSelectedPaymentOption?(): Promise<CustomerPaymentOption | null>;\n /** Creates a SetupIntent configured to attach a new payment method to a customer,\n * then returns the client secret for the created SetupIntent.\n */\n setupIntentClientSecretForCustomerAttach?(): Promise<String>;\n}\n\nexport type CustomerPaymentOption =\n | 'apple_pay'\n | 'google_pay'\n | 'link'\n | string;\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CollectionMode","AddressCollectionMode","CaptureMethod"],"sources":["PaymentSheet.ts"],"sourcesContent":["import type { BillingDetails, AddressDetails, CardBrand } from './Common';\nimport type { CartSummaryItem } from './ApplePay';\nimport type {\n ButtonType,\n RecurringPaymentRequest,\n AutomaticReloadPaymentRequest,\n MultiMerchantRequest,\n} from './PlatformPay';\nimport type { FutureUsage } from './PaymentIntent';\nimport type { Result } from './PaymentMethod';\nimport type { StripeError } from './Errors';\n\nexport type SetupParams = IntentParams & {\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 /** Optional configuration to display a custom message when a saved payment method is removed. iOS only. */\n removeSavedPaymentMethodMessage?: string;\n /** The list of preferred networks that should be used to process payments made with a co-branded card.\n * This value will only be used if your user hasn't selected a network themselves. */\n preferredNetworks?: Array<CardBrand>;\n};\n\nexport type IntentParams =\n | {\n paymentIntentClientSecret: string;\n setupIntentClientSecret?: undefined;\n intentConfiguration?: never;\n }\n | {\n setupIntentClientSecret: string;\n paymentIntentClientSecret?: undefined;\n intentConfiguration?: never;\n }\n | {\n setupIntentClientSecret?: never;\n paymentIntentClientSecret?: never;\n intentConfiguration: IntentConfiguration;\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 /** An optional label to display with the amount. Google Pay may or may not display this label depending on its own internal logic. Defaults to a generic label if none is provided. */\n label?: string;\n /** An optional amount to display for setup intents. Google Pay may or may not display this amount depending on its own internal logic. Defaults to 0 if none is provided. */\n amount?: string;\n /** The Google Pay button type to use. Set to \"Pay\" by default. See\n * [Google's documentation](https://developers.google.com/android/reference/com/google/android/gms/wallet/Wallet.WalletOptions#environment)\n * for more information on button types. */\n buttonType?: ButtonType;\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\nexport type IntentCreationError = StripeError<'Failed'>;\n\nexport type IntentCreationCallbackParams =\n | {\n clientSecret: string;\n error?: never;\n }\n | {\n clientSecret?: never;\n error: IntentCreationError;\n };\n\nexport type IntentConfiguration = {\n /*\n Called when the customer confirms payment. Your implementation should create a PaymentIntent or SetupIntent on your server and call the `intentCreationCallback` with its client secret or an error if one occurred.\n - Note: You must create the PaymentIntent or SetupIntent with the same values used as the `IntentConfiguration` e.g. the same amount, currency, etc.\n - Parameters:\n - paymentMethod: The PaymentMethod representing the customer's payment details.\n - shouldSavePaymentMethod: This is `true` if the customer selected the \"Save this payment method for future use\" checkbox. Set `setup_future_usage` on the PaymentIntent to `off_session` if this is `true`.\n - intentCreationCallback: Call this with the `client_secret` of the PaymentIntent or SetupIntent created by your server or the error that occurred. If you're using customFlow: false (default), the error's localizedMessage will be displayed to the customer in the sheet. If you're using customFlow: true, the `confirm` method fails with the error.\n */\n confirmHandler: (\n paymentMethod: Result,\n shouldSavePaymentMethod: boolean,\n intentCreationCallback: (result: IntentCreationCallbackParams) => void\n ) => void;\n /* Information about the payment (PaymentIntent) or setup (SetupIntent).*/\n mode: Mode;\n /* A list of payment method types to display to the customer. If undefined or empty, we dynamically determine the payment methods using your Stripe Dashboard settings. */\n paymentMethodTypes?: Array<string>;\n};\n\nexport type Mode = PaymentMode | SetupMode;\n\n/**\n * Controls when the funds will be captured. Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method\n */\nexport enum CaptureMethod {\n /** (Default) Stripe automatically captures funds when the customer authorizes the payment. */\n Automatic = 'Automatic',\n /** Place a hold on the funds when the customer authorizes the payment, but don’t capture the funds until later. (Not all payment methods support this.) */\n Manual = 'Manual',\n /** Asynchronously capture funds when the customer authorizes the payment.\n - Note: Recommended over `CaptureMethod.Automatic` due to improved latency, but may require additional integration changes.\n - Seealso: https://stripe.com/docs/payments/payment-intents/asynchronous-capture-automatic-async */\n AutomaticAsync = 'AutomaticAsync',\n}\n\n/* Use this if your integration creates a PaymentIntent */\nexport type PaymentMode = {\n /* Amount intended to be collected in the smallest currency unit (e.g. 100 cents to charge $1.00). Shown in Apple Pay, Google Pay, Buy now pay later UIs, the Pay button, and influences available payment methods.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-amount */\n amount: number;\n /* Three-letter ISO currency code. Filters out payment methods based on supported currency.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-currency */\n currencyCode: string;\n /* Indicates that you intend to make future payments.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage */\n setupFutureUsage?: FutureUsage;\n /* Controls when the funds will be captured.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method */\n captureMethod?: CaptureMethod;\n};\n\n/* Use this if your integration creates a SetupIntent */\nexport type SetupMode = {\n /* Three-letter ISO currency code. Filters out payment methods based on supported currency.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-currency */\n currencyCode?: string;\n /* Indicates that you intend to make future payments.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage */\n setupFutureUsage: FutureUsage;\n};\n"],"mappings":"8IA+SYA,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,SA8CrBC,cAAa,+CAAbA,aAAa,EAAbA,aAAa,0BAAbA,aAAa,oBAAbA,aAAa,uCAAbA,aAAa,yBAAbA,aAAa"}
|
|
1
|
+
{"version":3,"names":["CollectionMode","AddressCollectionMode","CaptureMethod"],"sources":["PaymentSheet.ts"],"sourcesContent":["import type { BillingDetails, AddressDetails, CardBrand } from './Common';\nimport type { CartSummaryItem } from './ApplePay';\nimport type {\n ButtonType,\n RecurringPaymentRequest,\n AutomaticReloadPaymentRequest,\n MultiMerchantRequest,\n} from './PlatformPay';\nimport type { FutureUsage } from './PaymentIntent';\nimport type { Result } from './PaymentMethod';\nimport type { StripeError } from './Errors';\n\nexport type SetupParams = IntentParams & {\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 /** Optional configuration to display a custom message when a saved payment method is removed. iOS only. */\n removeSavedPaymentMethodMessage?: string;\n /** The list of preferred networks that should be used to process payments made with a co-branded card.\n * This value will only be used if your user hasn't selected a network themselves. */\n preferredNetworks?: Array<CardBrand>;\n /** By default, PaymentSheet will use a dynamic ordering that optimizes payment method display for the customer.\n * You can override the default order in which payment methods are displayed in PaymentSheet with a list of payment method types.\n * See https://stripe.com/docs/api/payment_methods/object#payment_method_object-type for the list of valid types. You may also pass external payment methods.\n * - Example: [\"card\", \"external_paypal\", \"klarna\"]\n * - Note: If you omit payment methods from this list, they’ll be automatically ordered by Stripe after the ones you provide. Invalid payment methods are ignored.\n */\n paymentMethodOrder?: Array<String>;\n /** This is an experimental feature that may be removed at any time.\n * Defaults to true. If true, the customer can delete all saved payment methods.\n * If false, the customer can't delete if they only have one saved payment method remaining.\n */\n allowsRemovalOfLastSavedPaymentMethod?: boolean;\n};\n\nexport type IntentParams =\n | {\n paymentIntentClientSecret: string;\n setupIntentClientSecret?: undefined;\n intentConfiguration?: never;\n }\n | {\n setupIntentClientSecret: string;\n paymentIntentClientSecret?: undefined;\n intentConfiguration?: never;\n }\n | {\n setupIntentClientSecret?: never;\n paymentIntentClientSecret?: never;\n intentConfiguration: IntentConfiguration;\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 /** An optional label to display with the amount. Google Pay may or may not display this label depending on its own internal logic. Defaults to a generic label if none is provided. */\n label?: string;\n /** An optional amount to display for setup intents. Google Pay may or may not display this amount depending on its own internal logic. Defaults to 0 if none is provided. */\n amount?: string;\n /** The Google Pay button type to use. Set to \"Pay\" by default. See\n * [Google's documentation](https://developers.google.com/android/reference/com/google/android/gms/wallet/Wallet.WalletOptions#environment)\n * for more information on button types. */\n buttonType?: ButtonType;\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\nexport type IntentCreationError = StripeError<'Failed'>;\n\nexport type IntentCreationCallbackParams =\n | {\n clientSecret: string;\n error?: never;\n }\n | {\n clientSecret?: never;\n error: IntentCreationError;\n };\n\nexport type IntentConfiguration = {\n /*\n Called when the customer confirms payment. Your implementation should create a PaymentIntent or SetupIntent on your server and call the `intentCreationCallback` with its client secret or an error if one occurred.\n - Note: You must create the PaymentIntent or SetupIntent with the same values used as the `IntentConfiguration` e.g. the same amount, currency, etc.\n - Parameters:\n - paymentMethod: The PaymentMethod representing the customer's payment details.\n - shouldSavePaymentMethod: This is `true` if the customer selected the \"Save this payment method for future use\" checkbox. Set `setup_future_usage` on the PaymentIntent to `off_session` if this is `true`.\n - intentCreationCallback: Call this with the `client_secret` of the PaymentIntent or SetupIntent created by your server or the error that occurred. If you're using customFlow: false (default), the error's localizedMessage will be displayed to the customer in the sheet. If you're using customFlow: true, the `confirm` method fails with the error.\n */\n confirmHandler: (\n paymentMethod: Result,\n shouldSavePaymentMethod: boolean,\n intentCreationCallback: (result: IntentCreationCallbackParams) => void\n ) => void;\n /* Information about the payment (PaymentIntent) or setup (SetupIntent).*/\n mode: Mode;\n /* A list of payment method types to display to the customer. If undefined or empty, we dynamically determine the payment methods using your Stripe Dashboard settings. */\n paymentMethodTypes?: Array<string>;\n};\n\nexport type Mode = PaymentMode | SetupMode;\n\n/**\n * Controls when the funds will be captured. Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method\n */\nexport enum CaptureMethod {\n /** (Default) Stripe automatically captures funds when the customer authorizes the payment. */\n Automatic = 'Automatic',\n /** Place a hold on the funds when the customer authorizes the payment, but don’t capture the funds until later. (Not all payment methods support this.) */\n Manual = 'Manual',\n /** Asynchronously capture funds when the customer authorizes the payment.\n - Note: Recommended over `CaptureMethod.Automatic` due to improved latency, but may require additional integration changes.\n - Seealso: https://stripe.com/docs/payments/payment-intents/asynchronous-capture-automatic-async */\n AutomaticAsync = 'AutomaticAsync',\n}\n\n/* Use this if your integration creates a PaymentIntent */\nexport type PaymentMode = {\n /* Amount intended to be collected in the smallest currency unit (e.g. 100 cents to charge $1.00). Shown in Apple Pay, Google Pay, Buy now pay later UIs, the Pay button, and influences available payment methods.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-amount */\n amount: number;\n /* Three-letter ISO currency code. Filters out payment methods based on supported currency.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-currency */\n currencyCode: string;\n /* Indicates that you intend to make future payments.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage */\n setupFutureUsage?: FutureUsage;\n /* Controls when the funds will be captured.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-capture_method */\n captureMethod?: CaptureMethod;\n};\n\n/* Use this if your integration creates a SetupIntent */\nexport type SetupMode = {\n /* Three-letter ISO currency code. Filters out payment methods based on supported currency.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-currency */\n currencyCode?: string;\n /* Indicates that you intend to make future payments.\n Seealso: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage */\n setupFutureUsage: FutureUsage;\n};\n"],"mappings":"8IA2TYA,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,SA8CrBC,cAAa,+CAAbA,aAAa,EAAbA,aAAa,0BAAbA,aAAa,oBAAbA,aAAa,uCAAbA,aAAa,yBAAbA,aAAa"}
|
|
@@ -34,6 +34,11 @@ export declare type CustomerSheetInitParams = {
|
|
|
34
34
|
* WARNING: When implementing your own CustomerAdapter, ensure your application complies with all applicable laws and regulations, including data privacy and consumer protection.
|
|
35
35
|
*/
|
|
36
36
|
customerAdapter?: CustomerAdapter;
|
|
37
|
+
/** This is an experimental feature that may be removed at any time.
|
|
38
|
+
* Defaults to true. If true, the customer can delete all saved payment methods.
|
|
39
|
+
* If false, the customer can't delete if they only have one saved payment method remaining.
|
|
40
|
+
*/
|
|
41
|
+
allowsRemovalOfLastSavedPaymentMethod?: boolean;
|
|
37
42
|
};
|
|
38
43
|
export declare type CustomerSheetPresentParams = {
|
|
39
44
|
/** Controls how the modal is presented (after animation). iOS only. Defaults to `popover`. See https://developer.apple.com/documentation/uikit/uimodalpresentationstyle for more info. */
|
|
@@ -49,6 +49,18 @@ export declare type SetupParams = IntentParams & {
|
|
|
49
49
|
/** The list of preferred networks that should be used to process payments made with a co-branded card.
|
|
50
50
|
* This value will only be used if your user hasn't selected a network themselves. */
|
|
51
51
|
preferredNetworks?: Array<CardBrand>;
|
|
52
|
+
/** By default, PaymentSheet will use a dynamic ordering that optimizes payment method display for the customer.
|
|
53
|
+
* You can override the default order in which payment methods are displayed in PaymentSheet with a list of payment method types.
|
|
54
|
+
* See https://stripe.com/docs/api/payment_methods/object#payment_method_object-type for the list of valid types. You may also pass external payment methods.
|
|
55
|
+
* - Example: ["card", "external_paypal", "klarna"]
|
|
56
|
+
* - Note: If you omit payment methods from this list, they’ll be automatically ordered by Stripe after the ones you provide. Invalid payment methods are ignored.
|
|
57
|
+
*/
|
|
58
|
+
paymentMethodOrder?: Array<String>;
|
|
59
|
+
/** This is an experimental feature that may be removed at any time.
|
|
60
|
+
* Defaults to true. If true, the customer can delete all saved payment methods.
|
|
61
|
+
* If false, the customer can't delete if they only have one saved payment method remaining.
|
|
62
|
+
*/
|
|
63
|
+
allowsRemovalOfLastSavedPaymentMethod?: boolean;
|
|
52
64
|
};
|
|
53
65
|
export declare type IntentParams = {
|
|
54
66
|
paymentIntentClientSecret: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripe/stripe-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"author": "Stripe",
|
|
5
5
|
"description": "Stripe SDK for React Native",
|
|
6
6
|
"main": "lib/commonjs/index",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"run-example-android": "cd example;react-native run-android --variant=release",
|
|
25
25
|
"test:e2e:ios": "bash ./scripts/run-maestro-tests ios",
|
|
26
26
|
"test:e2e:android": "bash ./scripts/run-maestro-tests android",
|
|
27
|
-
"test:unit:ios": "xcodebuild test -workspace example/ios/StripeSdkExample.xcworkspace -destination 'platform=iOS Simulator,name=iPhone
|
|
27
|
+
"test:unit:ios": "xcodebuild test -workspace example/ios/StripeSdkExample.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 15' -scheme UnitTests",
|
|
28
28
|
"test:unit:android": "cd example/android && ./gradlew connectedAndroidTest",
|
|
29
29
|
"test-ios": "maestro test -e APP_ID=com.stripe.react.native",
|
|
30
30
|
"test-android": "maestro test -e APP_ID=com.example.reactnativestripesdk"
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"metro-react-native-babel-preset": "^0.70.3",
|
|
59
59
|
"prettier": "^2.0.5",
|
|
60
60
|
"react": "18.0.0",
|
|
61
|
-
"react-native": "0.69.
|
|
61
|
+
"react-native": "0.69.12",
|
|
62
62
|
"ts-node": "^9.1.1",
|
|
63
63
|
"typedoc": "^0.22.12",
|
|
64
64
|
"typescript": "~4.4.4"
|
|
@@ -42,6 +42,11 @@ export type CustomerSheetInitParams = {
|
|
|
42
42
|
* WARNING: When implementing your own CustomerAdapter, ensure your application complies with all applicable laws and regulations, including data privacy and consumer protection.
|
|
43
43
|
*/
|
|
44
44
|
customerAdapter?: CustomerAdapter;
|
|
45
|
+
/** This is an experimental feature that may be removed at any time.
|
|
46
|
+
* Defaults to true. If true, the customer can delete all saved payment methods.
|
|
47
|
+
* If false, the customer can't delete if they only have one saved payment method remaining.
|
|
48
|
+
*/
|
|
49
|
+
allowsRemovalOfLastSavedPaymentMethod?: boolean;
|
|
45
50
|
};
|
|
46
51
|
|
|
47
52
|
export type CustomerSheetPresentParams = {
|
|
@@ -55,6 +55,18 @@ export type SetupParams = IntentParams & {
|
|
|
55
55
|
/** The list of preferred networks that should be used to process payments made with a co-branded card.
|
|
56
56
|
* This value will only be used if your user hasn't selected a network themselves. */
|
|
57
57
|
preferredNetworks?: Array<CardBrand>;
|
|
58
|
+
/** By default, PaymentSheet will use a dynamic ordering that optimizes payment method display for the customer.
|
|
59
|
+
* You can override the default order in which payment methods are displayed in PaymentSheet with a list of payment method types.
|
|
60
|
+
* See https://stripe.com/docs/api/payment_methods/object#payment_method_object-type for the list of valid types. You may also pass external payment methods.
|
|
61
|
+
* - Example: ["card", "external_paypal", "klarna"]
|
|
62
|
+
* - Note: If you omit payment methods from this list, they’ll be automatically ordered by Stripe after the ones you provide. Invalid payment methods are ignored.
|
|
63
|
+
*/
|
|
64
|
+
paymentMethodOrder?: Array<String>;
|
|
65
|
+
/** This is an experimental feature that may be removed at any time.
|
|
66
|
+
* Defaults to true. If true, the customer can delete all saved payment methods.
|
|
67
|
+
* If false, the customer can't delete if they only have one saved payment method remaining.
|
|
68
|
+
*/
|
|
69
|
+
allowsRemovalOfLastSavedPaymentMethod?: boolean;
|
|
58
70
|
};
|
|
59
71
|
|
|
60
72
|
export type IntentParams =
|
|
@@ -2,7 +2,7 @@ require 'json'
|
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
4
|
# Keep stripe_version in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/stripe-identity-react-native.podspec
|
|
5
|
-
stripe_version = '~> 23.
|
|
5
|
+
stripe_version = '~> 23.27.0'
|
|
6
6
|
|
|
7
7
|
Pod::Spec.new do |s|
|
|
8
8
|
s.name = 'stripe-react-native'
|