@stripe/stripe-react-native 0.40.0 → 0.42.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +19 -2
  2. package/README.md +3 -0
  3. package/android/.project +11 -0
  4. package/android/.settings/org.eclipse.buildship.core.prefs +3 -3
  5. package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +21 -0
  6. package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +20 -0
  7. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +114 -35
  8. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +50 -0
  9. package/ios/FinancialConnections.swift +14 -2
  10. package/ios/Mappers.swift +23 -0
  11. package/ios/PaymentMethodFactory.swift +31 -29
  12. package/ios/StripeSdk.swift +50 -19
  13. package/lib/commonjs/NativeStripeSdk.js.map +1 -1
  14. package/lib/commonjs/functions.js +1 -1
  15. package/lib/commonjs/functions.js.map +1 -1
  16. package/lib/commonjs/hooks/useFinancialConnectionsSheet.js +1 -1
  17. package/lib/commonjs/hooks/useFinancialConnectionsSheet.js.map +1 -1
  18. package/lib/commonjs/hooks/useStripe.js +1 -1
  19. package/lib/commonjs/hooks/useStripe.js.map +1 -1
  20. package/lib/commonjs/types/FinancialConnections.js +1 -1
  21. package/lib/commonjs/types/FinancialConnections.js.map +1 -1
  22. package/lib/commonjs/types/PaymentIntent.js.map +1 -1
  23. package/lib/commonjs/types/PaymentMethod.js.map +1 -1
  24. package/lib/commonjs/types/PaymentSheet.js.map +1 -1
  25. package/lib/module/NativeStripeSdk.js.map +1 -1
  26. package/lib/module/functions.js +1 -1
  27. package/lib/module/functions.js.map +1 -1
  28. package/lib/module/hooks/useFinancialConnectionsSheet.js +1 -1
  29. package/lib/module/hooks/useFinancialConnectionsSheet.js.map +1 -1
  30. package/lib/module/hooks/useStripe.js +1 -1
  31. package/lib/module/hooks/useStripe.js.map +1 -1
  32. package/lib/module/types/FinancialConnections.js +1 -1
  33. package/lib/module/types/FinancialConnections.js.map +1 -1
  34. package/lib/module/types/PaymentIntent.js.map +1 -1
  35. package/lib/module/types/PaymentMethod.js.map +1 -1
  36. package/lib/module/types/PaymentSheet.js.map +1 -1
  37. package/lib/typescript/src/NativeStripeSdk.d.ts +1 -1
  38. package/lib/typescript/src/functions.d.ts +6 -2
  39. package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts +4 -2
  40. package/lib/typescript/src/hooks/useStripe.d.ts +2 -2
  41. package/lib/typescript/src/types/FinancialConnections.d.ts +64 -0
  42. package/lib/typescript/src/types/PaymentIntent.d.ts +26 -0
  43. package/lib/typescript/src/types/PaymentMethod.d.ts +7 -0
  44. package/lib/typescript/src/types/PaymentSheet.d.ts +1 -1
  45. package/package.json +2 -2
  46. package/src/NativeStripeSdk.tsx +1 -1
  47. package/src/functions.ts +57 -2
  48. package/src/hooks/useFinancialConnectionsSheet.tsx +12 -4
  49. package/src/hooks/useStripe.tsx +10 -4
  50. package/src/types/FinancialConnections.ts +69 -0
  51. package/src/types/PaymentIntent.ts +30 -1
  52. package/src/types/PaymentMethod.ts +8 -0
  53. package/src/types/PaymentSheet.ts +1 -1
  54. package/stripe-react-native.podspec +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["CollectionMode","AddressCollectionMode","CaptureMethod","PaymentMethodLayout"],"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\ntype SetupParamsBase = 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 /** 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 * Defines the layout orientations available for displaying payment methods in PaymentSheet.\n * - Note: Defaults to `Automatic` if not set\n */\n paymentMethodLayout?: PaymentMethodLayout;\n};\n\nexport type SetupParams =\n | (SetupParamsBase & {\n /** A short-lived token that allows the SDK to access a Customer’s payment methods. */\n customerEphemeralKeySecret: string;\n customerSessionClientSecret?: never;\n })\n | (SetupParamsBase & {\n customerEphemeralKeySecret?: never;\n /** (Experimental) This parameter can be changed or removed at any time (use at your own risk).\n * The client secret of this Customer Session. Used on the client to set up secure access to the given customer.\n */\n customerSessionClientSecret: string;\n })\n | SetupParamsBase;\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\nexport enum PaymentMethodLayout {\n /**\n * Payment methods are arranged horizontally.\n * Users can swipe left or right to navigate through different payment methods.\n */\n Horizontal = 'Horizontal',\n\n /**\n * Payment methods are arranged vertically.\n * Users can scroll up or down to navigate through different payment methods.\n */\n Vertical = 'Vertical',\n\n /**\n * This lets Stripe choose the best layout for payment methods in the sheet.\n */\n Automatic = 'Automatic',\n}\n"],"mappings":"0KA6UYA,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,SAqCbC,oBAAmB,2DAAnBA,mBAAmB,EAAnBA,mBAAmB,4BAAnBA,mBAAmB,wBAAnBA,mBAAmB,6BAAnBA,mBAAmB,+BAAnBA,mBAAmB"}
1
+ {"version":3,"names":["CollectionMode","AddressCollectionMode","CaptureMethod","PaymentMethodLayout"],"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 SetupParamsBase = 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 /** 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 * Defines the layout orientations available for displaying payment methods in PaymentSheet.\n * - Note: Defaults to `Automatic` if not set\n */\n paymentMethodLayout?: PaymentMethodLayout;\n};\n\nexport type SetupParams =\n | (SetupParamsBase & {\n /** A short-lived token that allows the SDK to access a Customer’s payment methods. */\n customerEphemeralKeySecret: string;\n customerSessionClientSecret?: never;\n })\n | (SetupParamsBase & {\n customerEphemeralKeySecret?: never;\n /** (Experimental) This parameter can be changed or removed at any time (use at your own risk).\n * The client secret of this Customer Session. Used on the client to set up secure access to the given customer.\n */\n customerSessionClientSecret: string;\n })\n | SetupParamsBase;\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\nexport enum PaymentMethodLayout {\n /**\n * Payment methods are arranged horizontally.\n * Users can swipe left or right to navigate through different payment methods.\n */\n Horizontal = 'Horizontal',\n\n /**\n * Payment methods are arranged vertically.\n * Users can scroll up or down to navigate through different payment methods.\n */\n Vertical = 'Vertical',\n\n /**\n * This lets Stripe choose the best layout for payment methods in the sheet.\n */\n Automatic = 'Automatic',\n}\n"],"mappings":"0KA6UYA,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,SAqCbC,oBAAmB,2DAAnBA,mBAAmB,EAAnBA,mBAAmB,4BAAnBA,mBAAmB,wBAAnBA,mBAAmB,6BAAnBA,mBAAmB,+BAAnBA,mBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"names":["StripeSdk","NativeModules"],"sources":["NativeStripeSdk.tsx"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport type {\n PaymentMethod,\n PaymentIntent,\n PlatformPay,\n PaymentSheet,\n SetupIntent,\n InitialiseParams,\n CreatePaymentMethodResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n ConfirmPaymentResult,\n HandleNextActionResult,\n HandleNextActionForSetupResult,\n ConfirmSetupIntentResult,\n CreateTokenForCVCUpdateResult,\n InitPaymentSheetResult,\n PresentPaymentSheetResult,\n ConfirmPaymentSheetPaymentResult,\n CreateTokenResult,\n OpenApplePaySetupResult,\n Token,\n VerifyMicrodepositsParams,\n IsCardInWalletResult,\n CanAddCardToWalletParams,\n CanAddCardToWalletResult,\n FinancialConnections,\n CustomerSheetInitParams,\n CustomerSheetPresentParams,\n CustomerSheetResult,\n CustomerSheetError,\n StripeError,\n CustomerPaymentOption,\n CustomerAdapter,\n} from './types';\n\ntype NativeStripeSdkType = {\n initialise(params: InitialiseParams): Promise<void>;\n createPaymentMethod(\n params: PaymentMethod.CreateParams,\n options: PaymentMethod.CreateOptions\n ): Promise<CreatePaymentMethodResult>;\n handleNextAction(\n paymentIntentClientSecret: string,\n returnURL?: string | null\n ): Promise<HandleNextActionResult>;\n handleNextActionForSetup(\n setupIntentClientSecret: string,\n returnURL?: string | null\n ): Promise<HandleNextActionForSetupResult>;\n confirmPayment(\n paymentIntentClientSecret: string,\n params?: PaymentIntent.ConfirmParams,\n options?: PaymentIntent.ConfirmOptions\n ): Promise<ConfirmPaymentResult>;\n confirmSetupIntent(\n paymentIntentClientSecret: string,\n params: SetupIntent.ConfirmParams,\n options: SetupIntent.ConfirmOptions\n ): Promise<ConfirmSetupIntentResult>;\n retrievePaymentIntent(\n clientSecret: string\n ): Promise<RetrievePaymentIntentResult>;\n retrieveSetupIntent(clientSecret: string): Promise<RetrieveSetupIntentResult>;\n initPaymentSheet(\n params: PaymentSheet.SetupParams\n ): Promise<InitPaymentSheetResult>;\n intentCreationCallback(\n result: PaymentSheet.IntentCreationCallbackParams\n ): void;\n presentPaymentSheet(\n options: PaymentSheet.PresentOptions\n ): Promise<PresentPaymentSheetResult>;\n confirmPaymentSheetPayment(): Promise<ConfirmPaymentSheetPaymentResult>;\n createTokenForCVCUpdate(cvc: string): Promise<CreateTokenForCVCUpdateResult>;\n handleURLCallback(url: string): Promise<boolean>;\n createToken(params: Token.CreateParams): Promise<CreateTokenResult>;\n openApplePaySetup(): Promise<OpenApplePaySetupResult>;\n verifyMicrodeposits(\n isPaymentIntent: boolean,\n clientSecret: string,\n params: VerifyMicrodepositsParams\n ): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;\n collectBankAccount(\n isPaymentIntent: boolean,\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n ): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;\n getConstants(): { API_VERSIONS: { CORE: string; ISSUING: string } };\n canAddCardToWallet(\n params: CanAddCardToWalletParams\n ): Promise<CanAddCardToWalletResult>;\n isCardInWallet(params: {\n cardLastFour: string;\n }): Promise<IsCardInWalletResult>;\n collectBankAccountToken(\n clientSecret: string\n ): Promise<FinancialConnections.TokenResult>;\n collectFinancialConnectionsAccounts(\n clientSecret: string\n ): Promise<FinancialConnections.SessionResult>;\n resetPaymentSheetCustomer(): Promise<null>;\n isPlatformPaySupported(params: {\n googlePay?: PlatformPay.IsGooglePaySupportedParams;\n }): Promise<boolean>;\n createPlatformPayPaymentMethod(\n params: PlatformPay.PaymentMethodParams,\n usesDeprecatedTokenFlow: boolean\n ): Promise<PlatformPay.PaymentMethodResult | PlatformPay.TokenResult>;\n dismissPlatformPay(): Promise<boolean>;\n updatePlatformPaySheet(\n summaryItems: Array<PlatformPay.CartSummaryItem>,\n shippingMethods: Array<PlatformPay.ShippingMethod>,\n errors: Array<PlatformPay.ApplePaySheetError>\n ): Promise<void>;\n confirmPlatformPay(\n clientSecret: string,\n params: PlatformPay.ConfirmParams,\n isPaymentIntent: boolean\n ): Promise<\n PlatformPay.ConfirmPaymentResult | PlatformPay.ConfirmSetupIntentResult\n >;\n configureOrderTracking(\n orderTypeIdentifier: string,\n orderIdentifier: string,\n webServiceUrl: string,\n authenticationToken: string\n ): Promise<void>;\n initCustomerSheet(\n params: CustomerSheetInitParams,\n customerAdapterOverrides: { [Property in keyof CustomerAdapter]: boolean }\n ): Promise<{ error?: StripeError<CustomerSheetError> }>;\n presentCustomerSheet(\n params: CustomerSheetPresentParams\n ): Promise<CustomerSheetResult>;\n retrieveCustomerSheetPaymentOptionSelection(): Promise<CustomerSheetResult>;\n customerAdapterFetchPaymentMethodsCallback(\n paymentMethods: Array<object>\n ): Promise<void>;\n customerAdapterAttachPaymentMethodCallback(\n paymentMethod: object\n ): Promise<void>;\n customerAdapterDetachPaymentMethodCallback(\n paymentMethod: object\n ): Promise<void>;\n customerAdapterSetSelectedPaymentOptionCallback(): Promise<void>;\n customerAdapterFetchSelectedPaymentOptionCallback(\n paymentOption: CustomerPaymentOption | null\n ): Promise<void>;\n customerAdapterSetupIntentClientSecretForCustomerAttachCallback(\n clientSecret: String\n ): Promise<void>;\n};\n\nconst { StripeSdk } = NativeModules;\n\nexport default StripeSdk as NativeStripeSdkType;\n"],"mappings":"gFAAA,yCA0JA,GAAQA,UAAS,CAAKC,0BAAa,CAA3BD,SAAS,CAAmB,aAErBA,SAAS"}
1
+ {"version":3,"names":["StripeSdk","NativeModules"],"sources":["NativeStripeSdk.tsx"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport type {\n PaymentMethod,\n PaymentIntent,\n PlatformPay,\n PaymentSheet,\n SetupIntent,\n InitialiseParams,\n CreatePaymentMethodResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n ConfirmPaymentResult,\n HandleNextActionResult,\n HandleNextActionForSetupResult,\n ConfirmSetupIntentResult,\n CreateTokenForCVCUpdateResult,\n InitPaymentSheetResult,\n PresentPaymentSheetResult,\n ConfirmPaymentSheetPaymentResult,\n CreateTokenResult,\n OpenApplePaySetupResult,\n Token,\n VerifyMicrodepositsParams,\n IsCardInWalletResult,\n CanAddCardToWalletParams,\n CanAddCardToWalletResult,\n FinancialConnections,\n CustomerSheetInitParams,\n CustomerSheetPresentParams,\n CustomerSheetResult,\n CustomerSheetError,\n StripeError,\n CustomerPaymentOption,\n CustomerAdapter,\n} from './types';\n\ntype NativeStripeSdkType = {\n initialise(params: InitialiseParams): Promise<void>;\n createPaymentMethod(\n params: PaymentMethod.CreateParams,\n options: PaymentMethod.CreateOptions\n ): Promise<CreatePaymentMethodResult>;\n handleNextAction(\n paymentIntentClientSecret: string,\n returnURL?: string | null\n ): Promise<HandleNextActionResult>;\n handleNextActionForSetup(\n setupIntentClientSecret: string,\n returnURL?: string | null\n ): Promise<HandleNextActionForSetupResult>;\n confirmPayment(\n paymentIntentClientSecret: string,\n params?: PaymentIntent.ConfirmParams,\n options?: PaymentIntent.ConfirmOptions\n ): Promise<ConfirmPaymentResult>;\n confirmSetupIntent(\n paymentIntentClientSecret: string,\n params: SetupIntent.ConfirmParams,\n options: SetupIntent.ConfirmOptions\n ): Promise<ConfirmSetupIntentResult>;\n retrievePaymentIntent(\n clientSecret: string\n ): Promise<RetrievePaymentIntentResult>;\n retrieveSetupIntent(clientSecret: string): Promise<RetrieveSetupIntentResult>;\n initPaymentSheet(\n params: PaymentSheet.SetupParams\n ): Promise<InitPaymentSheetResult>;\n intentCreationCallback(\n result: PaymentSheet.IntentCreationCallbackParams\n ): void;\n presentPaymentSheet(\n options: PaymentSheet.PresentOptions\n ): Promise<PresentPaymentSheetResult>;\n confirmPaymentSheetPayment(): Promise<ConfirmPaymentSheetPaymentResult>;\n createTokenForCVCUpdate(cvc: string): Promise<CreateTokenForCVCUpdateResult>;\n handleURLCallback(url: string): Promise<boolean>;\n createToken(params: Token.CreateParams): Promise<CreateTokenResult>;\n openApplePaySetup(): Promise<OpenApplePaySetupResult>;\n verifyMicrodeposits(\n isPaymentIntent: boolean,\n clientSecret: string,\n params: VerifyMicrodepositsParams\n ): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;\n collectBankAccount(\n isPaymentIntent: boolean,\n clientSecret: string,\n params: Omit<PaymentMethod.CollectBankAccountParams, 'onEvent'>\n ): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;\n getConstants(): { API_VERSIONS: { CORE: string; ISSUING: string } };\n canAddCardToWallet(\n params: CanAddCardToWalletParams\n ): Promise<CanAddCardToWalletResult>;\n isCardInWallet(params: {\n cardLastFour: string;\n }): Promise<IsCardInWalletResult>;\n collectBankAccountToken(\n clientSecret: string\n ): Promise<FinancialConnections.TokenResult>;\n collectFinancialConnectionsAccounts(\n clientSecret: string\n ): Promise<FinancialConnections.SessionResult>;\n resetPaymentSheetCustomer(): Promise<null>;\n isPlatformPaySupported(params: {\n googlePay?: PlatformPay.IsGooglePaySupportedParams;\n }): Promise<boolean>;\n createPlatformPayPaymentMethod(\n params: PlatformPay.PaymentMethodParams,\n usesDeprecatedTokenFlow: boolean\n ): Promise<PlatformPay.PaymentMethodResult | PlatformPay.TokenResult>;\n dismissPlatformPay(): Promise<boolean>;\n updatePlatformPaySheet(\n summaryItems: Array<PlatformPay.CartSummaryItem>,\n shippingMethods: Array<PlatformPay.ShippingMethod>,\n errors: Array<PlatformPay.ApplePaySheetError>\n ): Promise<void>;\n confirmPlatformPay(\n clientSecret: string,\n params: PlatformPay.ConfirmParams,\n isPaymentIntent: boolean\n ): Promise<\n PlatformPay.ConfirmPaymentResult | PlatformPay.ConfirmSetupIntentResult\n >;\n configureOrderTracking(\n orderTypeIdentifier: string,\n orderIdentifier: string,\n webServiceUrl: string,\n authenticationToken: string\n ): Promise<void>;\n initCustomerSheet(\n params: CustomerSheetInitParams,\n customerAdapterOverrides: { [Property in keyof CustomerAdapter]: boolean }\n ): Promise<{ error?: StripeError<CustomerSheetError> }>;\n presentCustomerSheet(\n params: CustomerSheetPresentParams\n ): Promise<CustomerSheetResult>;\n retrieveCustomerSheetPaymentOptionSelection(): Promise<CustomerSheetResult>;\n customerAdapterFetchPaymentMethodsCallback(\n paymentMethods: Array<object>\n ): Promise<void>;\n customerAdapterAttachPaymentMethodCallback(\n paymentMethod: object\n ): Promise<void>;\n customerAdapterDetachPaymentMethodCallback(\n paymentMethod: object\n ): Promise<void>;\n customerAdapterSetSelectedPaymentOptionCallback(): Promise<void>;\n customerAdapterFetchSelectedPaymentOptionCallback(\n paymentOption: CustomerPaymentOption | null\n ): Promise<void>;\n customerAdapterSetupIntentClientSecretForCustomerAttachCallback(\n clientSecret: String\n ): Promise<void>;\n};\n\nconst { StripeSdk } = NativeModules;\n\nexport default StripeSdk as NativeStripeSdkType;\n"],"mappings":"gFAAA,yCA0JA,GAAQA,UAAS,CAAKC,0BAAa,CAA3BD,SAAS,CAAmB,aAErBA,SAAS"}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.verifyMicrodepositsForSetup=exports.verifyMicrodepositsForPayment=exports.updatePlatformPaySheet=exports.retrieveSetupIntent=exports.retrievePaymentIntent=exports.resetPaymentSheetCustomer=exports.presentPaymentSheet=exports.openPlatformPaySetup=exports.isPlatformPaySupported=exports.isCardInWallet=exports.initPaymentSheet=exports.handleURLCallback=exports.handleNextActionForSetup=exports.handleNextAction=exports.dismissPlatformPay=exports.createTokenForCVCUpdate=exports.createToken=exports.createPlatformPayToken=exports.createPlatformPayPaymentMethod=exports.createPaymentMethod=exports.confirmSetupIntent=exports.confirmPlatformPaySetupIntent=exports.confirmPlatformPayPayment=exports.confirmPaymentSheetPayment=exports.confirmPayment=exports.collectFinancialConnectionsAccounts=exports.collectBankAccountToken=exports.collectBankAccountForSetup=exports.collectBankAccountForPayment=exports.canAddCardToWallet=exports.Constants=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _helpers=require("./helpers");var _Errors=require("./types/Errors");var _NativeStripeSdk=_interopRequireDefault(require("./NativeStripeSdk"));var _reactNative=require("react-native");var createPaymentMethod=function(){var _ref=(0,_asyncToGenerator2.default)(function*(params){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};try{var _yield$NativeStripeSd=yield _NativeStripeSdk.default.createPaymentMethod(params,options),paymentMethod=_yield$NativeStripeSd.paymentMethod,error=_yield$NativeStripeSd.error;if(error){return{error:error};}return{paymentMethod:paymentMethod};}catch(error){return{error:error};}});return function createPaymentMethod(_x){return _ref.apply(this,arguments);};}();exports.createPaymentMethod=createPaymentMethod;var createToken=function(){var _ref2=(0,_asyncToGenerator2.default)(function*(params){var _params$country;if(params.type==='BankAccount'&&((_params$country=params.country)==null?void 0:_params$country.toLowerCase())==='us'&&!params.routingNumber){return{error:_Errors.MissingRoutingNumber};}try{var _yield$NativeStripeSd2=yield _NativeStripeSdk.default.createToken(params),token=_yield$NativeStripeSd2.token,error=_yield$NativeStripeSd2.error;if(error){return{error:error};}return{token:token};}catch(error){return{error:error};}});return function createToken(_x2){return _ref2.apply(this,arguments);};}();exports.createToken=createToken;var retrievePaymentIntent=function(){var _ref3=(0,_asyncToGenerator2.default)(function*(clientSecret){try{var _yield$NativeStripeSd3=yield _NativeStripeSdk.default.retrievePaymentIntent(clientSecret),paymentIntent=_yield$NativeStripeSd3.paymentIntent,error=_yield$NativeStripeSd3.error;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:error};}});return function retrievePaymentIntent(_x3){return _ref3.apply(this,arguments);};}();exports.retrievePaymentIntent=retrievePaymentIntent;var retrieveSetupIntent=function(){var _ref4=(0,_asyncToGenerator2.default)(function*(clientSecret){try{var _yield$NativeStripeSd4=yield _NativeStripeSdk.default.retrieveSetupIntent(clientSecret),setupIntent=_yield$NativeStripeSd4.setupIntent,error=_yield$NativeStripeSd4.error;if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){return{error:error};}});return function retrieveSetupIntent(_x4){return _ref4.apply(this,arguments);};}();exports.retrieveSetupIntent=retrieveSetupIntent;var confirmPayment=function(){var _ref5=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,params){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};try{var _yield$NativeStripeSd5=yield _NativeStripeSdk.default.confirmPayment(paymentIntentClientSecret,params,options),paymentIntent=_yield$NativeStripeSd5.paymentIntent,error=_yield$NativeStripeSd5.error;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:error};}});return function confirmPayment(_x5,_x6){return _ref5.apply(this,arguments);};}();exports.confirmPayment=confirmPayment;var handleNextAction=function(){var _ref6=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,returnURL){try{var _ref7=_reactNative.Platform.OS==='ios'?yield _NativeStripeSdk.default.handleNextAction(paymentIntentClientSecret,returnURL!=null?returnURL:null):yield _NativeStripeSdk.default.handleNextAction(paymentIntentClientSecret),paymentIntent=_ref7.paymentIntent,error=_ref7.error;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function handleNextAction(_x7,_x8){return _ref6.apply(this,arguments);};}();exports.handleNextAction=handleNextAction;var handleNextActionForSetup=function(){var _ref8=(0,_asyncToGenerator2.default)(function*(setupIntentClientSecret,returnURL){try{var _ref9=_reactNative.Platform.OS==='ios'?yield _NativeStripeSdk.default.handleNextActionForSetup(setupIntentClientSecret,returnURL!=null?returnURL:null):yield _NativeStripeSdk.default.handleNextActionForSetup(setupIntentClientSecret),setupIntent=_ref9.setupIntent,error=_ref9.error;if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function handleNextActionForSetup(_x9,_x10){return _ref8.apply(this,arguments);};}();exports.handleNextActionForSetup=handleNextActionForSetup;var confirmSetupIntent=function(){var _ref10=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,params){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};try{var _yield$NativeStripeSd6=yield _NativeStripeSdk.default.confirmSetupIntent(paymentIntentClientSecret,params,options),setupIntent=_yield$NativeStripeSd6.setupIntent,error=_yield$NativeStripeSd6.error;if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){return{error:error};}});return function confirmSetupIntent(_x11,_x12){return _ref10.apply(this,arguments);};}();exports.confirmSetupIntent=confirmSetupIntent;var createTokenForCVCUpdate=function(){var _ref11=(0,_asyncToGenerator2.default)(function*(cvc){try{var _yield$NativeStripeSd7=yield _NativeStripeSdk.default.createTokenForCVCUpdate(cvc),tokenId=_yield$NativeStripeSd7.tokenId,error=_yield$NativeStripeSd7.error;if(error){return{error:error};}return{tokenId:tokenId};}catch(error){return{error:error};}});return function createTokenForCVCUpdate(_x13){return _ref11.apply(this,arguments);};}();exports.createTokenForCVCUpdate=createTokenForCVCUpdate;var handleURLCallback=function(){var _ref12=(0,_asyncToGenerator2.default)(function*(url){var stripeHandled=_reactNative.Platform.OS==='ios'?yield _NativeStripeSdk.default.handleURLCallback(url):false;return stripeHandled;});return function handleURLCallback(_x14){return _ref12.apply(this,arguments);};}();exports.handleURLCallback=handleURLCallback;var verifyMicrodepositsForPayment=function(){var _ref13=(0,_asyncToGenerator2.default)(function*(clientSecret,params){try{var _ref14=yield _NativeStripeSdk.default.verifyMicrodeposits(true,clientSecret,params),paymentIntent=_ref14.paymentIntent,error=_ref14.error;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function verifyMicrodepositsForPayment(_x15,_x16){return _ref13.apply(this,arguments);};}();exports.verifyMicrodepositsForPayment=verifyMicrodepositsForPayment;var verifyMicrodepositsForSetup=function(){var _ref15=(0,_asyncToGenerator2.default)(function*(clientSecret,params){try{var _ref16=yield _NativeStripeSdk.default.verifyMicrodeposits(false,clientSecret,params),setupIntent=_ref16.setupIntent,error=_ref16.error;if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function verifyMicrodepositsForSetup(_x17,_x18){return _ref15.apply(this,arguments);};}();exports.verifyMicrodepositsForSetup=verifyMicrodepositsForSetup;var eventEmitter=new _reactNative.NativeEventEmitter(_reactNative.NativeModules.StripeSdk);var confirmHandlerCallback=null;var orderTrackingCallbackListener=null;var initPaymentSheet=function(){var _ref17=(0,_asyncToGenerator2.default)(function*(params){var _params$intentConfigu,_params$applePay;var result;var confirmHandler=params==null?void 0:(_params$intentConfigu=params.intentConfiguration)==null?void 0:_params$intentConfigu.confirmHandler;if(confirmHandler){var _confirmHandlerCallba;(_confirmHandlerCallba=confirmHandlerCallback)==null?void 0:_confirmHandlerCallba.remove();confirmHandlerCallback=eventEmitter.addListener('onConfirmHandlerCallback',function(_ref18){var paymentMethod=_ref18.paymentMethod,shouldSavePaymentMethod=_ref18.shouldSavePaymentMethod;confirmHandler(paymentMethod,shouldSavePaymentMethod,_NativeStripeSdk.default.intentCreationCallback);});}var orderTrackingCallback=params==null?void 0:(_params$applePay=params.applePay)==null?void 0:_params$applePay.setOrderTracking;if(orderTrackingCallback){var _orderTrackingCallbac;(_orderTrackingCallbac=orderTrackingCallbackListener)==null?void 0:_orderTrackingCallbac.remove();orderTrackingCallbackListener=eventEmitter.addListener('onOrderTrackingCallback',function(){orderTrackingCallback(_NativeStripeSdk.default.configureOrderTracking);});}try{if(_reactNative.Platform.OS==='ios'&&!params.returnURL){console.warn("[@stripe/stripe-react-native] You have not provided the 'returnURL' field to 'initPaymentSheet', so payment methods that require redirects will not be shown in your iOS Payment Sheet. Visit https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#react-native-set-up-return-url to learn more.");}result=yield _NativeStripeSdk.default.initPaymentSheet(params);if(result.error){return{error:result.error};}return{paymentOption:result.paymentOption};}catch(error){return{error:error};}});return function initPaymentSheet(_x19){return _ref17.apply(this,arguments);};}();exports.initPaymentSheet=initPaymentSheet;var presentPaymentSheet=function(){var _ref19=(0,_asyncToGenerator2.default)(function*(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};try{var _yield$NativeStripeSd8=yield _NativeStripeSdk.default.presentPaymentSheet(options),paymentOption=_yield$NativeStripeSd8.paymentOption,error=_yield$NativeStripeSd8.error;if(error){return{error:error};}return{paymentOption:paymentOption};}catch(error){return{error:error};}});return function presentPaymentSheet(){return _ref19.apply(this,arguments);};}();exports.presentPaymentSheet=presentPaymentSheet;var confirmPaymentSheetPayment=function(){var _ref20=(0,_asyncToGenerator2.default)(function*(){try{var _yield$NativeStripeSd9=yield _NativeStripeSdk.default.confirmPaymentSheetPayment(),error=_yield$NativeStripeSd9.error;if(error){return{error:error};}return{};}catch(error){return{error:error};}});return function confirmPaymentSheetPayment(){return _ref20.apply(this,arguments);};}();exports.confirmPaymentSheetPayment=confirmPaymentSheetPayment;var resetPaymentSheetCustomer=function(){var _ref21=(0,_asyncToGenerator2.default)(function*(){return yield _NativeStripeSdk.default.resetPaymentSheetCustomer();});return function resetPaymentSheetCustomer(){return _ref21.apply(this,arguments);};}();exports.resetPaymentSheetCustomer=resetPaymentSheetCustomer;var collectBankAccountForPayment=function(){var _ref22=(0,_asyncToGenerator2.default)(function*(clientSecret,params){try{var _ref23=yield _NativeStripeSdk.default.collectBankAccount(true,clientSecret,params),paymentIntent=_ref23.paymentIntent,error=_ref23.error;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function collectBankAccountForPayment(_x20,_x21){return _ref22.apply(this,arguments);};}();exports.collectBankAccountForPayment=collectBankAccountForPayment;var collectBankAccountForSetup=function(){var _ref24=(0,_asyncToGenerator2.default)(function*(clientSecret,params){try{var _ref25=yield _NativeStripeSdk.default.collectBankAccount(false,clientSecret,params),setupIntent=_ref25.setupIntent,error=_ref25.error;if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function collectBankAccountForSetup(_x22,_x23){return _ref24.apply(this,arguments);};}();exports.collectBankAccountForSetup=collectBankAccountForSetup;var collectBankAccountToken=function(){var _ref26=(0,_asyncToGenerator2.default)(function*(clientSecret){try{var _yield$NativeStripeSd10=yield _NativeStripeSdk.default.collectBankAccountToken(clientSecret),session=_yield$NativeStripeSd10.session,token=_yield$NativeStripeSd10.token,error=_yield$NativeStripeSd10.error;if(error){return{error:error};}return{session:session,token:token};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function collectBankAccountToken(_x24){return _ref26.apply(this,arguments);};}();exports.collectBankAccountToken=collectBankAccountToken;var collectFinancialConnectionsAccounts=function(){var _ref27=(0,_asyncToGenerator2.default)(function*(clientSecret){try{var _yield$NativeStripeSd11=yield _NativeStripeSdk.default.collectFinancialConnectionsAccounts(clientSecret),session=_yield$NativeStripeSd11.session,error=_yield$NativeStripeSd11.error;if(error){return{error:error};}return{session:session};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function collectFinancialConnectionsAccounts(_x25){return _ref27.apply(this,arguments);};}();exports.collectFinancialConnectionsAccounts=collectFinancialConnectionsAccounts;var canAddCardToWallet=function(){var _ref28=(0,_asyncToGenerator2.default)(function*(params){try{var _yield$NativeStripeSd12=yield _NativeStripeSdk.default.canAddCardToWallet(params),canAddCard=_yield$NativeStripeSd12.canAddCard,details=_yield$NativeStripeSd12.details,error=_yield$NativeStripeSd12.error;if(error){return{error:error};}return{canAddCard:canAddCard,details:details};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function canAddCardToWallet(_x26){return _ref28.apply(this,arguments);};}();exports.canAddCardToWallet=canAddCardToWallet;var isCardInWallet=function(){var _ref29=(0,_asyncToGenerator2.default)(function*(params){try{var _yield$NativeStripeSd13=yield _NativeStripeSdk.default.isCardInWallet(params),isInWallet=_yield$NativeStripeSd13.isInWallet,token=_yield$NativeStripeSd13.token,error=_yield$NativeStripeSd13.error;if(error){return{error:error};}return{isInWallet:isInWallet,token:token};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function isCardInWallet(_x27){return _ref29.apply(this,arguments);};}();exports.isCardInWallet=isCardInWallet;var Constants=_NativeStripeSdk.default.getConstants();exports.Constants=Constants;var isPlatformPaySupported=function(){var _ref30=(0,_asyncToGenerator2.default)(function*(params){return yield _NativeStripeSdk.default.isPlatformPaySupported(params!=null?params:{});});return function isPlatformPaySupported(_x28){return _ref30.apply(this,arguments);};}();exports.isPlatformPaySupported=isPlatformPaySupported;var confirmPlatformPaySetupIntent=function(){var _ref31=(0,_asyncToGenerator2.default)(function*(clientSecret,params){try{var _ref32=yield _NativeStripeSdk.default.confirmPlatformPay(clientSecret,params,false),error=_ref32.error,setupIntent=_ref32.setupIntent;if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){return{error:error};}});return function confirmPlatformPaySetupIntent(_x29,_x30){return _ref31.apply(this,arguments);};}();exports.confirmPlatformPaySetupIntent=confirmPlatformPaySetupIntent;var confirmPlatformPayPayment=function(){var _ref33=(0,_asyncToGenerator2.default)(function*(clientSecret,params){try{var _ref34=yield _NativeStripeSdk.default.confirmPlatformPay(clientSecret,params,true),error=_ref34.error,paymentIntent=_ref34.paymentIntent;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:error};}});return function confirmPlatformPayPayment(_x31,_x32){return _ref33.apply(this,arguments);};}();exports.confirmPlatformPayPayment=confirmPlatformPayPayment;var dismissPlatformPay=function(){var _ref35=(0,_asyncToGenerator2.default)(function*(){if(_reactNative.Platform.OS!=='ios'){return false;}try{var didDismiss=yield _NativeStripeSdk.default.dismissPlatformPay();return didDismiss;}catch(error){return false;}});return function dismissPlatformPay(){return _ref35.apply(this,arguments);};}();exports.dismissPlatformPay=dismissPlatformPay;var createPlatformPayPaymentMethod=function(){var _ref36=(0,_asyncToGenerator2.default)(function*(params){try{var _ref37=yield _NativeStripeSdk.default.createPlatformPayPaymentMethod(params,false),error=_ref37.error,paymentMethod=_ref37.paymentMethod,shippingContact=_ref37.shippingContact;if(error){return{error:error};}return{paymentMethod:paymentMethod,shippingContact:shippingContact};}catch(error){return{error:error};}});return function createPlatformPayPaymentMethod(_x33){return _ref36.apply(this,arguments);};}();exports.createPlatformPayPaymentMethod=createPlatformPayPaymentMethod;var createPlatformPayToken=function(){var _ref38=(0,_asyncToGenerator2.default)(function*(params){try{var _ref39=yield _NativeStripeSdk.default.createPlatformPayPaymentMethod(params,true),error=_ref39.error,token=_ref39.token,shippingContact=_ref39.shippingContact;if(error){return{error:error};}return{token:token,shippingContact:shippingContact};}catch(error){return{error:error};}});return function createPlatformPayToken(_x34){return _ref38.apply(this,arguments);};}();exports.createPlatformPayToken=createPlatformPayToken;var updatePlatformPaySheet=function(){var _ref40=(0,_asyncToGenerator2.default)(function*(params){if(_reactNative.Platform.OS!=='ios'){return{};}try{yield _NativeStripeSdk.default.updatePlatformPaySheet(params.applePay.cartItems,params.applePay.shippingMethods,params.applePay.errors);return{};}catch(error){return{error:error};}});return function updatePlatformPaySheet(_x35){return _ref40.apply(this,arguments);};}();exports.updatePlatformPaySheet=updatePlatformPaySheet;var openPlatformPaySetup=function(){var _ref41=(0,_asyncToGenerator2.default)(function*(){if(_reactNative.Platform.OS==='ios'){yield _NativeStripeSdk.default.openApplePaySetup();}});return function openPlatformPaySetup(){return _ref41.apply(this,arguments);};}();exports.openPlatformPaySetup=openPlatformPaySetup;
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.verifyMicrodepositsForSetup=exports.verifyMicrodepositsForPayment=exports.updatePlatformPaySheet=exports.retrieveSetupIntent=exports.retrievePaymentIntent=exports.resetPaymentSheetCustomer=exports.presentPaymentSheet=exports.openPlatformPaySetup=exports.isPlatformPaySupported=exports.isCardInWallet=exports.initPaymentSheet=exports.handleURLCallback=exports.handleNextActionForSetup=exports.handleNextAction=exports.dismissPlatformPay=exports.createTokenForCVCUpdate=exports.createToken=exports.createPlatformPayToken=exports.createPlatformPayPaymentMethod=exports.createPaymentMethod=exports.confirmSetupIntent=exports.confirmPlatformPaySetupIntent=exports.confirmPlatformPayPayment=exports.confirmPaymentSheetPayment=exports.confirmPayment=exports.collectFinancialConnectionsAccounts=exports.collectBankAccountToken=exports.collectBankAccountForSetup=exports.collectBankAccountForPayment=exports.canAddCardToWallet=exports.Constants=void 0;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _helpers=require("./helpers");var _Errors=require("./types/Errors");var _NativeStripeSdk=_interopRequireDefault(require("./NativeStripeSdk"));var _reactNative=require("react-native");var createPaymentMethod=function(){var _ref=(0,_asyncToGenerator2.default)(function*(params){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};try{var _yield$NativeStripeSd=yield _NativeStripeSdk.default.createPaymentMethod(params,options),paymentMethod=_yield$NativeStripeSd.paymentMethod,error=_yield$NativeStripeSd.error;if(error){return{error:error};}return{paymentMethod:paymentMethod};}catch(error){return{error:error};}});return function createPaymentMethod(_x){return _ref.apply(this,arguments);};}();exports.createPaymentMethod=createPaymentMethod;var createToken=function(){var _ref2=(0,_asyncToGenerator2.default)(function*(params){var _params$country;if(params.type==='BankAccount'&&((_params$country=params.country)==null?void 0:_params$country.toLowerCase())==='us'&&!params.routingNumber){return{error:_Errors.MissingRoutingNumber};}try{var _yield$NativeStripeSd2=yield _NativeStripeSdk.default.createToken(params),token=_yield$NativeStripeSd2.token,error=_yield$NativeStripeSd2.error;if(error){return{error:error};}return{token:token};}catch(error){return{error:error};}});return function createToken(_x2){return _ref2.apply(this,arguments);};}();exports.createToken=createToken;var retrievePaymentIntent=function(){var _ref3=(0,_asyncToGenerator2.default)(function*(clientSecret){try{var _yield$NativeStripeSd3=yield _NativeStripeSdk.default.retrievePaymentIntent(clientSecret),paymentIntent=_yield$NativeStripeSd3.paymentIntent,error=_yield$NativeStripeSd3.error;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:error};}});return function retrievePaymentIntent(_x3){return _ref3.apply(this,arguments);};}();exports.retrievePaymentIntent=retrievePaymentIntent;var retrieveSetupIntent=function(){var _ref4=(0,_asyncToGenerator2.default)(function*(clientSecret){try{var _yield$NativeStripeSd4=yield _NativeStripeSdk.default.retrieveSetupIntent(clientSecret),setupIntent=_yield$NativeStripeSd4.setupIntent,error=_yield$NativeStripeSd4.error;if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){return{error:error};}});return function retrieveSetupIntent(_x4){return _ref4.apply(this,arguments);};}();exports.retrieveSetupIntent=retrieveSetupIntent;var confirmPayment=function(){var _ref5=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,params){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};try{var _yield$NativeStripeSd5=yield _NativeStripeSdk.default.confirmPayment(paymentIntentClientSecret,params,options),paymentIntent=_yield$NativeStripeSd5.paymentIntent,error=_yield$NativeStripeSd5.error;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:error};}});return function confirmPayment(_x5,_x6){return _ref5.apply(this,arguments);};}();exports.confirmPayment=confirmPayment;var handleNextAction=function(){var _ref6=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,returnURL){try{var _ref7=_reactNative.Platform.OS==='ios'?yield _NativeStripeSdk.default.handleNextAction(paymentIntentClientSecret,returnURL!=null?returnURL:null):yield _NativeStripeSdk.default.handleNextAction(paymentIntentClientSecret),paymentIntent=_ref7.paymentIntent,error=_ref7.error;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function handleNextAction(_x7,_x8){return _ref6.apply(this,arguments);};}();exports.handleNextAction=handleNextAction;var handleNextActionForSetup=function(){var _ref8=(0,_asyncToGenerator2.default)(function*(setupIntentClientSecret,returnURL){try{var _ref9=_reactNative.Platform.OS==='ios'?yield _NativeStripeSdk.default.handleNextActionForSetup(setupIntentClientSecret,returnURL!=null?returnURL:null):yield _NativeStripeSdk.default.handleNextActionForSetup(setupIntentClientSecret),setupIntent=_ref9.setupIntent,error=_ref9.error;if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function handleNextActionForSetup(_x9,_x10){return _ref8.apply(this,arguments);};}();exports.handleNextActionForSetup=handleNextActionForSetup;var confirmSetupIntent=function(){var _ref10=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,params){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};try{var _yield$NativeStripeSd6=yield _NativeStripeSdk.default.confirmSetupIntent(paymentIntentClientSecret,params,options),setupIntent=_yield$NativeStripeSd6.setupIntent,error=_yield$NativeStripeSd6.error;if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){return{error:error};}});return function confirmSetupIntent(_x11,_x12){return _ref10.apply(this,arguments);};}();exports.confirmSetupIntent=confirmSetupIntent;var createTokenForCVCUpdate=function(){var _ref11=(0,_asyncToGenerator2.default)(function*(cvc){try{var _yield$NativeStripeSd7=yield _NativeStripeSdk.default.createTokenForCVCUpdate(cvc),tokenId=_yield$NativeStripeSd7.tokenId,error=_yield$NativeStripeSd7.error;if(error){return{error:error};}return{tokenId:tokenId};}catch(error){return{error:error};}});return function createTokenForCVCUpdate(_x13){return _ref11.apply(this,arguments);};}();exports.createTokenForCVCUpdate=createTokenForCVCUpdate;var handleURLCallback=function(){var _ref12=(0,_asyncToGenerator2.default)(function*(url){var stripeHandled=_reactNative.Platform.OS==='ios'?yield _NativeStripeSdk.default.handleURLCallback(url):false;return stripeHandled;});return function handleURLCallback(_x14){return _ref12.apply(this,arguments);};}();exports.handleURLCallback=handleURLCallback;var verifyMicrodepositsForPayment=function(){var _ref13=(0,_asyncToGenerator2.default)(function*(clientSecret,params){try{var _ref14=yield _NativeStripeSdk.default.verifyMicrodeposits(true,clientSecret,params),paymentIntent=_ref14.paymentIntent,error=_ref14.error;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function verifyMicrodepositsForPayment(_x15,_x16){return _ref13.apply(this,arguments);};}();exports.verifyMicrodepositsForPayment=verifyMicrodepositsForPayment;var verifyMicrodepositsForSetup=function(){var _ref15=(0,_asyncToGenerator2.default)(function*(clientSecret,params){try{var _ref16=yield _NativeStripeSdk.default.verifyMicrodeposits(false,clientSecret,params),setupIntent=_ref16.setupIntent,error=_ref16.error;if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function verifyMicrodepositsForSetup(_x17,_x18){return _ref15.apply(this,arguments);};}();exports.verifyMicrodepositsForSetup=verifyMicrodepositsForSetup;var eventEmitter=new _reactNative.NativeEventEmitter(_reactNative.NativeModules.StripeSdk);var confirmHandlerCallback=null;var orderTrackingCallbackListener=null;var financialConnectionsEventListener=null;var initPaymentSheet=function(){var _ref17=(0,_asyncToGenerator2.default)(function*(params){var _params$intentConfigu,_params$applePay;var result;var confirmHandler=params==null?void 0:(_params$intentConfigu=params.intentConfiguration)==null?void 0:_params$intentConfigu.confirmHandler;if(confirmHandler){var _confirmHandlerCallba;(_confirmHandlerCallba=confirmHandlerCallback)==null?void 0:_confirmHandlerCallba.remove();confirmHandlerCallback=eventEmitter.addListener('onConfirmHandlerCallback',function(_ref18){var paymentMethod=_ref18.paymentMethod,shouldSavePaymentMethod=_ref18.shouldSavePaymentMethod;confirmHandler(paymentMethod,shouldSavePaymentMethod,_NativeStripeSdk.default.intentCreationCallback);});}var orderTrackingCallback=params==null?void 0:(_params$applePay=params.applePay)==null?void 0:_params$applePay.setOrderTracking;if(orderTrackingCallback){var _orderTrackingCallbac;(_orderTrackingCallbac=orderTrackingCallbackListener)==null?void 0:_orderTrackingCallbac.remove();orderTrackingCallbackListener=eventEmitter.addListener('onOrderTrackingCallback',function(){orderTrackingCallback(_NativeStripeSdk.default.configureOrderTracking);});}try{if(_reactNative.Platform.OS==='ios'&&!params.returnURL){console.warn("[@stripe/stripe-react-native] You have not provided the 'returnURL' field to 'initPaymentSheet', so payment methods that require redirects will not be shown in your iOS Payment Sheet. Visit https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#react-native-set-up-return-url to learn more.");}result=yield _NativeStripeSdk.default.initPaymentSheet(params);if(result.error){return{error:result.error};}return{paymentOption:result.paymentOption};}catch(error){return{error:error};}});return function initPaymentSheet(_x19){return _ref17.apply(this,arguments);};}();exports.initPaymentSheet=initPaymentSheet;var presentPaymentSheet=function(){var _ref19=(0,_asyncToGenerator2.default)(function*(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};try{var _yield$NativeStripeSd8=yield _NativeStripeSdk.default.presentPaymentSheet(options),paymentOption=_yield$NativeStripeSd8.paymentOption,error=_yield$NativeStripeSd8.error;if(error){return{error:error};}return{paymentOption:paymentOption};}catch(error){return{error:error};}});return function presentPaymentSheet(){return _ref19.apply(this,arguments);};}();exports.presentPaymentSheet=presentPaymentSheet;var confirmPaymentSheetPayment=function(){var _ref20=(0,_asyncToGenerator2.default)(function*(){try{var _yield$NativeStripeSd9=yield _NativeStripeSdk.default.confirmPaymentSheetPayment(),error=_yield$NativeStripeSd9.error;if(error){return{error:error};}return{};}catch(error){return{error:error};}});return function confirmPaymentSheetPayment(){return _ref20.apply(this,arguments);};}();exports.confirmPaymentSheetPayment=confirmPaymentSheetPayment;var resetPaymentSheetCustomer=function(){var _ref21=(0,_asyncToGenerator2.default)(function*(){return yield _NativeStripeSdk.default.resetPaymentSheetCustomer();});return function resetPaymentSheetCustomer(){return _ref21.apply(this,arguments);};}();exports.resetPaymentSheetCustomer=resetPaymentSheetCustomer;var collectBankAccountForPayment=function(){var _ref22=(0,_asyncToGenerator2.default)(function*(clientSecret,params){var _financialConnections;(_financialConnections=financialConnectionsEventListener)==null?void 0:_financialConnections.remove();if(params.onEvent){financialConnectionsEventListener=eventEmitter.addListener('onFinancialConnectionsEvent',params.onEvent);}try{var _financialConnections2;var _ref23=yield _NativeStripeSdk.default.collectBankAccount(true,clientSecret,params),paymentIntent=_ref23.paymentIntent,error=_ref23.error;(_financialConnections2=financialConnectionsEventListener)==null?void 0:_financialConnections2.remove();if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){var _financialConnections3;(_financialConnections3=financialConnectionsEventListener)==null?void 0:_financialConnections3.remove();return{error:(0,_helpers.createError)(error)};}});return function collectBankAccountForPayment(_x20,_x21){return _ref22.apply(this,arguments);};}();exports.collectBankAccountForPayment=collectBankAccountForPayment;var collectBankAccountForSetup=function(){var _ref24=(0,_asyncToGenerator2.default)(function*(clientSecret,params){var _financialConnections4;(_financialConnections4=financialConnectionsEventListener)==null?void 0:_financialConnections4.remove();if(params.onEvent){financialConnectionsEventListener=eventEmitter.addListener('onFinancialConnectionsEvent',params.onEvent);}try{var _financialConnections5;var _ref25=yield _NativeStripeSdk.default.collectBankAccount(false,clientSecret,params),setupIntent=_ref25.setupIntent,error=_ref25.error;(_financialConnections5=financialConnectionsEventListener)==null?void 0:_financialConnections5.remove();if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){var _financialConnections6;(_financialConnections6=financialConnectionsEventListener)==null?void 0:_financialConnections6.remove();return{error:(0,_helpers.createError)(error)};}});return function collectBankAccountForSetup(_x22,_x23){return _ref24.apply(this,arguments);};}();exports.collectBankAccountForSetup=collectBankAccountForSetup;var collectBankAccountToken=function(){var _ref26=(0,_asyncToGenerator2.default)(function*(clientSecret){var _financialConnections7;var params=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};(_financialConnections7=financialConnectionsEventListener)==null?void 0:_financialConnections7.remove();if(params.onEvent){financialConnectionsEventListener=eventEmitter.addListener('onFinancialConnectionsEvent',params.onEvent);}try{var _financialConnections8;var _yield$NativeStripeSd10=yield _NativeStripeSdk.default.collectBankAccountToken(clientSecret),session=_yield$NativeStripeSd10.session,token=_yield$NativeStripeSd10.token,error=_yield$NativeStripeSd10.error;(_financialConnections8=financialConnectionsEventListener)==null?void 0:_financialConnections8.remove();if(error){return{error:error};}return{session:session,token:token};}catch(error){var _financialConnections9;(_financialConnections9=financialConnectionsEventListener)==null?void 0:_financialConnections9.remove();return{error:(0,_helpers.createError)(error)};}});return function collectBankAccountToken(_x24){return _ref26.apply(this,arguments);};}();exports.collectBankAccountToken=collectBankAccountToken;var collectFinancialConnectionsAccounts=function(){var _ref27=(0,_asyncToGenerator2.default)(function*(clientSecret){var _financialConnections10;var params=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};(_financialConnections10=financialConnectionsEventListener)==null?void 0:_financialConnections10.remove();if(params.onEvent){financialConnectionsEventListener=eventEmitter.addListener('onFinancialConnectionsEvent',params.onEvent);}try{var _financialConnections11;var _yield$NativeStripeSd11=yield _NativeStripeSdk.default.collectFinancialConnectionsAccounts(clientSecret),session=_yield$NativeStripeSd11.session,error=_yield$NativeStripeSd11.error;(_financialConnections11=financialConnectionsEventListener)==null?void 0:_financialConnections11.remove();if(error){return{error:error};}return{session:session};}catch(error){var _financialConnections12;(_financialConnections12=financialConnectionsEventListener)==null?void 0:_financialConnections12.remove();return{error:(0,_helpers.createError)(error)};}});return function collectFinancialConnectionsAccounts(_x25){return _ref27.apply(this,arguments);};}();exports.collectFinancialConnectionsAccounts=collectFinancialConnectionsAccounts;var canAddCardToWallet=function(){var _ref28=(0,_asyncToGenerator2.default)(function*(params){try{var _yield$NativeStripeSd12=yield _NativeStripeSdk.default.canAddCardToWallet(params),canAddCard=_yield$NativeStripeSd12.canAddCard,details=_yield$NativeStripeSd12.details,error=_yield$NativeStripeSd12.error;if(error){return{error:error};}return{canAddCard:canAddCard,details:details};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function canAddCardToWallet(_x26){return _ref28.apply(this,arguments);};}();exports.canAddCardToWallet=canAddCardToWallet;var isCardInWallet=function(){var _ref29=(0,_asyncToGenerator2.default)(function*(params){try{var _yield$NativeStripeSd13=yield _NativeStripeSdk.default.isCardInWallet(params),isInWallet=_yield$NativeStripeSd13.isInWallet,token=_yield$NativeStripeSd13.token,error=_yield$NativeStripeSd13.error;if(error){return{error:error};}return{isInWallet:isInWallet,token:token};}catch(error){return{error:(0,_helpers.createError)(error)};}});return function isCardInWallet(_x27){return _ref29.apply(this,arguments);};}();exports.isCardInWallet=isCardInWallet;var Constants=_NativeStripeSdk.default.getConstants();exports.Constants=Constants;var isPlatformPaySupported=function(){var _ref30=(0,_asyncToGenerator2.default)(function*(params){return yield _NativeStripeSdk.default.isPlatformPaySupported(params!=null?params:{});});return function isPlatformPaySupported(_x28){return _ref30.apply(this,arguments);};}();exports.isPlatformPaySupported=isPlatformPaySupported;var confirmPlatformPaySetupIntent=function(){var _ref31=(0,_asyncToGenerator2.default)(function*(clientSecret,params){try{var _ref32=yield _NativeStripeSdk.default.confirmPlatformPay(clientSecret,params,false),error=_ref32.error,setupIntent=_ref32.setupIntent;if(error){return{error:error};}return{setupIntent:setupIntent};}catch(error){return{error:error};}});return function confirmPlatformPaySetupIntent(_x29,_x30){return _ref31.apply(this,arguments);};}();exports.confirmPlatformPaySetupIntent=confirmPlatformPaySetupIntent;var confirmPlatformPayPayment=function(){var _ref33=(0,_asyncToGenerator2.default)(function*(clientSecret,params){try{var _ref34=yield _NativeStripeSdk.default.confirmPlatformPay(clientSecret,params,true),error=_ref34.error,paymentIntent=_ref34.paymentIntent;if(error){return{error:error};}return{paymentIntent:paymentIntent};}catch(error){return{error:error};}});return function confirmPlatformPayPayment(_x31,_x32){return _ref33.apply(this,arguments);};}();exports.confirmPlatformPayPayment=confirmPlatformPayPayment;var dismissPlatformPay=function(){var _ref35=(0,_asyncToGenerator2.default)(function*(){if(_reactNative.Platform.OS!=='ios'){return false;}try{var didDismiss=yield _NativeStripeSdk.default.dismissPlatformPay();return didDismiss;}catch(error){return false;}});return function dismissPlatformPay(){return _ref35.apply(this,arguments);};}();exports.dismissPlatformPay=dismissPlatformPay;var createPlatformPayPaymentMethod=function(){var _ref36=(0,_asyncToGenerator2.default)(function*(params){try{var _ref37=yield _NativeStripeSdk.default.createPlatformPayPaymentMethod(params,false),error=_ref37.error,paymentMethod=_ref37.paymentMethod,shippingContact=_ref37.shippingContact;if(error){return{error:error};}return{paymentMethod:paymentMethod,shippingContact:shippingContact};}catch(error){return{error:error};}});return function createPlatformPayPaymentMethod(_x33){return _ref36.apply(this,arguments);};}();exports.createPlatformPayPaymentMethod=createPlatformPayPaymentMethod;var createPlatformPayToken=function(){var _ref38=(0,_asyncToGenerator2.default)(function*(params){try{var _ref39=yield _NativeStripeSdk.default.createPlatformPayPaymentMethod(params,true),error=_ref39.error,token=_ref39.token,shippingContact=_ref39.shippingContact;if(error){return{error:error};}return{token:token,shippingContact:shippingContact};}catch(error){return{error:error};}});return function createPlatformPayToken(_x34){return _ref38.apply(this,arguments);};}();exports.createPlatformPayToken=createPlatformPayToken;var updatePlatformPaySheet=function(){var _ref40=(0,_asyncToGenerator2.default)(function*(params){if(_reactNative.Platform.OS!=='ios'){return{};}try{yield _NativeStripeSdk.default.updatePlatformPaySheet(params.applePay.cartItems,params.applePay.shippingMethods,params.applePay.errors);return{};}catch(error){return{error:error};}});return function updatePlatformPaySheet(_x35){return _ref40.apply(this,arguments);};}();exports.updatePlatformPaySheet=updatePlatformPaySheet;var openPlatformPaySetup=function(){var _ref41=(0,_asyncToGenerator2.default)(function*(){if(_reactNative.Platform.OS==='ios'){yield _NativeStripeSdk.default.openApplePaySetup();}});return function openPlatformPaySetup(){return _ref41.apply(this,arguments);};}();exports.openPlatformPaySetup=openPlatformPaySetup;
2
2
  //# sourceMappingURL=functions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createPaymentMethod","params","options","NativeStripeSdk","paymentMethod","error","createToken","type","country","toLowerCase","routingNumber","MissingRoutingNumber","token","retrievePaymentIntent","clientSecret","paymentIntent","retrieveSetupIntent","setupIntent","confirmPayment","paymentIntentClientSecret","handleNextAction","returnURL","Platform","OS","createError","handleNextActionForSetup","setupIntentClientSecret","confirmSetupIntent","createTokenForCVCUpdate","cvc","tokenId","handleURLCallback","url","stripeHandled","verifyMicrodepositsForPayment","verifyMicrodeposits","verifyMicrodepositsForSetup","eventEmitter","NativeEventEmitter","NativeModules","StripeSdk","confirmHandlerCallback","orderTrackingCallbackListener","initPaymentSheet","result","confirmHandler","intentConfiguration","remove","addListener","shouldSavePaymentMethod","intentCreationCallback","orderTrackingCallback","applePay","setOrderTracking","configureOrderTracking","console","warn","paymentOption","presentPaymentSheet","confirmPaymentSheetPayment","resetPaymentSheetCustomer","collectBankAccountForPayment","collectBankAccount","collectBankAccountForSetup","collectBankAccountToken","session","collectFinancialConnectionsAccounts","canAddCardToWallet","canAddCard","details","isCardInWallet","isInWallet","Constants","getConstants","isPlatformPaySupported","confirmPlatformPaySetupIntent","confirmPlatformPay","confirmPlatformPayPayment","dismissPlatformPay","didDismiss","createPlatformPayPaymentMethod","shippingContact","createPlatformPayToken","updatePlatformPaySheet","cartItems","shippingMethods","errors","openPlatformPaySetup","openApplePaySetup"],"sources":["functions.ts"],"sourcesContent":["import { createError } from './helpers';\nimport { MissingRoutingNumber } from './types/Errors';\nimport NativeStripeSdk from './NativeStripeSdk';\nimport type {\n PlatformPayError,\n ConfirmPaymentResult,\n ConfirmPaymentSheetPaymentResult,\n SetupIntent,\n PaymentIntent,\n ConfirmSetupIntentResult,\n CreatePaymentMethodResult,\n CreateTokenForCVCUpdateResult,\n CreateTokenResult,\n HandleNextActionResult,\n HandleNextActionForSetupResult,\n InitPaymentSheetResult,\n PaymentMethod,\n PaymentSheet,\n PresentPaymentSheetResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n StripeError,\n Token,\n VerifyMicrodepositsParams,\n VerifyMicrodepositsForPaymentResult,\n VerifyMicrodepositsForSetupResult,\n CollectBankAccountForPaymentResult,\n CollectBankAccountForSetupResult,\n IsCardInWalletResult,\n CanAddCardToWalletParams,\n CanAddCardToWalletResult,\n FinancialConnections,\n PlatformPay,\n} from './types';\nimport {\n Platform,\n NativeEventEmitter,\n NativeModules,\n EmitterSubscription,\n} from 'react-native';\n\nexport const createPaymentMethod = async (\n params: PaymentMethod.CreateParams,\n options: PaymentMethod.CreateOptions = {}\n): Promise<CreatePaymentMethodResult> => {\n try {\n const { paymentMethod, error } = await NativeStripeSdk.createPaymentMethod(\n params,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentMethod: paymentMethod!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const createToken = async (\n params: Token.CreateParams\n): Promise<CreateTokenResult> => {\n if (\n params.type === 'BankAccount' &&\n params.country?.toLowerCase() === 'us' &&\n !params.routingNumber\n ) {\n return {\n error: MissingRoutingNumber,\n };\n }\n\n try {\n const { token, error } = await NativeStripeSdk.createToken(params);\n\n if (error) {\n return {\n error,\n };\n }\n return {\n token: token!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const retrievePaymentIntent = async (\n clientSecret: string\n): Promise<RetrievePaymentIntentResult> => {\n try {\n const { paymentIntent, error } =\n await NativeStripeSdk.retrievePaymentIntent(clientSecret);\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const retrieveSetupIntent = async (\n clientSecret: string\n): Promise<RetrieveSetupIntentResult> => {\n try {\n const { setupIntent, error } = await NativeStripeSdk.retrieveSetupIntent(\n clientSecret\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/**\n * Confirm and, if necessary, authenticate a PaymentIntent.\n *\n * @param {string} paymentIntentClientSecret The client_secret of the associated [PaymentIntent](https://stripe.com/docs/api/payment_intents).\n * @param {object=} params An optional object that contains data related to the payment method used to confirm this payment. If no object is provided (undefined), then it is assumed that the payment method has already been [attached to the Payment Intent](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method).\n * @param {object=} options An optional object that contains options for this payment method.\n * @returns A promise that resolves to an object containing either a `paymentIntent` field, or an `error` field.\n */\nexport const confirmPayment = async (\n paymentIntentClientSecret: string,\n params?: PaymentIntent.ConfirmParams,\n options: PaymentIntent.ConfirmOptions = {}\n): Promise<ConfirmPaymentResult> => {\n try {\n const { paymentIntent, error } = await NativeStripeSdk.confirmPayment(\n paymentIntentClientSecret,\n params,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/** Handles any nextAction required to authenticate the PaymentIntent.\n * Call this method if you are using manual confirmation. See https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=custom\n *\n * @param {string} paymentIntentClientSecret The client secret associated with the PaymentIntent.\n * @param {string=} returnURL An optional return URL so the Stripe SDK can redirect back to your app after authentication. This should match the `return_url` you specified during PaymentIntent confirmation.\n * */\nexport const handleNextAction = async (\n paymentIntentClientSecret: string,\n returnURL?: string\n): Promise<HandleNextActionResult> => {\n try {\n const { paymentIntent, error } =\n Platform.OS === 'ios'\n ? await NativeStripeSdk.handleNextAction(\n paymentIntentClientSecret,\n returnURL ?? null\n )\n : await NativeStripeSdk.handleNextAction(paymentIntentClientSecret);\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\n/** Handles any nextAction required to authenticate the SetupIntent.\n * Call this method if you are confirming the SetupIntent on your backend and get a status of requires_action.\n *\n * @param {string} setupIntentClientSecret The client secret associated with the SetupIntent.\n * @param {string=} returnURL An optional return URL so the Stripe SDK can redirect back to your app after authentication. This should match the `return_url` you specified during PaymentIntent confirmation.\n * */\nexport const handleNextActionForSetup = async (\n setupIntentClientSecret: string,\n returnURL?: string\n): Promise<HandleNextActionForSetupResult> => {\n try {\n const { setupIntent, error } =\n Platform.OS === 'ios'\n ? await NativeStripeSdk.handleNextActionForSetup(\n setupIntentClientSecret,\n returnURL ?? null\n )\n : await NativeStripeSdk.handleNextActionForSetup(\n setupIntentClientSecret\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const confirmSetupIntent = async (\n paymentIntentClientSecret: string,\n params: SetupIntent.ConfirmParams,\n options: SetupIntent.ConfirmOptions = {}\n): Promise<ConfirmSetupIntentResult> => {\n try {\n const { setupIntent, error } = await NativeStripeSdk.confirmSetupIntent(\n paymentIntentClientSecret,\n params,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const createTokenForCVCUpdate = async (\n cvc: string\n): Promise<CreateTokenForCVCUpdateResult> => {\n try {\n const { tokenId, error } = await NativeStripeSdk.createTokenForCVCUpdate(\n cvc\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n tokenId: tokenId!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/**\n * Call this method in your app whenever you receive a URL for a Stripe callback.\n * For convenience, you can pass all URLs you receive to this method first, and\n * check the return value to easily determine whether it is a callback URL that Stripe will handle\n * or if your app should process it normally. This is iOS-only, and will always return false on Android.\n */\nexport const handleURLCallback = async (url: string): Promise<boolean> => {\n const stripeHandled =\n Platform.OS === 'ios'\n ? await NativeStripeSdk.handleURLCallback(url)\n : false;\n return stripeHandled;\n};\n\nexport const verifyMicrodepositsForPayment = async (\n clientSecret: string,\n params: VerifyMicrodepositsParams\n): Promise<VerifyMicrodepositsForPaymentResult> => {\n try {\n const { paymentIntent, error } = (await NativeStripeSdk.verifyMicrodeposits(\n true,\n clientSecret,\n params\n )) as VerifyMicrodepositsForPaymentResult;\n\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const verifyMicrodepositsForSetup = async (\n clientSecret: string,\n params: VerifyMicrodepositsParams\n): Promise<VerifyMicrodepositsForSetupResult> => {\n try {\n const { setupIntent, error } = (await NativeStripeSdk.verifyMicrodeposits(\n false,\n clientSecret,\n params\n )) as VerifyMicrodepositsForSetupResult;\n\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nconst eventEmitter = new NativeEventEmitter(NativeModules.StripeSdk);\nlet confirmHandlerCallback: EmitterSubscription | null = null;\nlet orderTrackingCallbackListener: EmitterSubscription | null = null;\n\nexport const initPaymentSheet = async (\n params: PaymentSheet.SetupParams\n): Promise<InitPaymentSheetResult> => {\n let result;\n const confirmHandler = params?.intentConfiguration?.confirmHandler;\n if (confirmHandler) {\n confirmHandlerCallback?.remove();\n confirmHandlerCallback = eventEmitter.addListener(\n 'onConfirmHandlerCallback',\n ({\n paymentMethod,\n shouldSavePaymentMethod,\n }: {\n paymentMethod: PaymentMethod.Result;\n shouldSavePaymentMethod: boolean;\n }) => {\n confirmHandler(\n paymentMethod,\n shouldSavePaymentMethod,\n NativeStripeSdk.intentCreationCallback\n );\n }\n );\n }\n\n const orderTrackingCallback = params?.applePay?.setOrderTracking;\n if (orderTrackingCallback) {\n orderTrackingCallbackListener?.remove();\n orderTrackingCallbackListener = eventEmitter.addListener(\n 'onOrderTrackingCallback',\n () => {\n orderTrackingCallback(NativeStripeSdk.configureOrderTracking);\n }\n );\n }\n\n try {\n if (Platform.OS === 'ios' && !params.returnURL) {\n console.warn(\n `[@stripe/stripe-react-native] You have not provided the 'returnURL' field to 'initPaymentSheet', so payment methods that require redirects will not be shown in your iOS Payment Sheet. Visit https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#react-native-set-up-return-url to learn more.`\n );\n }\n result = await NativeStripeSdk.initPaymentSheet(params);\n\n if (result.error) {\n return {\n error: result.error,\n };\n }\n return {\n paymentOption: result.paymentOption,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const presentPaymentSheet = async (\n options: PaymentSheet.PresentOptions = {}\n): Promise<PresentPaymentSheetResult> => {\n try {\n const { paymentOption, error } = await NativeStripeSdk.presentPaymentSheet(\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentOption: paymentOption!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const confirmPaymentSheetPayment =\n async (): Promise<ConfirmPaymentSheetPaymentResult> => {\n try {\n const { error } = await NativeStripeSdk.confirmPaymentSheetPayment();\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n };\n\n/**\n * You must call this method when the user logs out from your app. This will ensure that\n * any persisted authentication state in the PaymentSheet, such as authentication cookies,\n * is also cleared during logout.\n */\nexport const resetPaymentSheetCustomer = async (): Promise<null> => {\n return await NativeStripeSdk.resetPaymentSheetCustomer();\n};\n\nexport const collectBankAccountForPayment = async (\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n): Promise<CollectBankAccountForPaymentResult> => {\n try {\n const { paymentIntent, error } = (await NativeStripeSdk.collectBankAccount(\n true,\n clientSecret,\n params\n )) as CollectBankAccountForPaymentResult;\n\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const collectBankAccountForSetup = async (\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n): Promise<CollectBankAccountForSetupResult> => {\n try {\n const { setupIntent, error } = (await NativeStripeSdk.collectBankAccount(\n false,\n clientSecret,\n params\n )) as CollectBankAccountForSetupResult;\n\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\n/**\n * Use collectBankAccountToken in the [Add a Financial Connections Account to a US Custom Connect](https://stripe.com/docs/financial-connections/connect-payouts) account flow.\n * When called, it will load the Authentication Flow, an on-page modal UI which allows your user to securely link their external financial account for payouts.\n * @param {string} clientSecret The client_secret of the [Financial Connections Session](https://stripe.com/docs/api/financial_connections/session).\n * @returns A promise that resolves to an object containing either `session` and `token` fields, or an error field.\n */\nexport const collectBankAccountToken = async (\n clientSecret: string\n): Promise<FinancialConnections.TokenResult> => {\n try {\n const { session, token, error } =\n await NativeStripeSdk.collectBankAccountToken(clientSecret);\n\n if (error) {\n return {\n error,\n };\n }\n return {\n session: session!,\n token: token!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\n/**\n * Use collectFinancialConnectionsAccounts in the [Collect an account to build data-powered products](https://stripe.com/docs/financial-connections/other-data-powered-products) flow.\n * When called, it will load the Authentication Flow, an on-page modal UI which allows your user to securely link their external financial account.\n * @param {string} clientSecret The client_secret of the [Financial Connections Session](https://stripe.com/docs/api/financial_connections/session).\n * @returns A promise that resolves to an object containing either a `session` field, or an error field.\n */\nexport const collectFinancialConnectionsAccounts = async (\n clientSecret: string\n): Promise<FinancialConnections.SessionResult> => {\n try {\n const { session, error } =\n await NativeStripeSdk.collectFinancialConnectionsAccounts(clientSecret);\n\n if (error) {\n return {\n error,\n };\n }\n return {\n session: session!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\n/**\n * Check if the app & device support adding this card to the native wallet.\n * @param params An object containing fields for `primaryAccountIdentifier`, `cardLastFour`, and `testEnv`.\n *\n * @returns A promise resolving to an object of type CanAddCardToWalletResult. Check the `canAddCard` field, if it's true, you should show the `<AddToWalletButton />`\n */\nexport const canAddCardToWallet = async (\n params: CanAddCardToWalletParams\n): Promise<CanAddCardToWalletResult> => {\n try {\n const { canAddCard, details, error } =\n await NativeStripeSdk.canAddCardToWallet(params);\n\n if (error) {\n return {\n error,\n };\n }\n return {\n canAddCard: canAddCard as boolean,\n details: details,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\n/** @deprecated Please use `canAddCardToWallet` instead. */\nexport const isCardInWallet = async (params: {\n cardLastFour: string;\n}): Promise<IsCardInWalletResult> => {\n try {\n const { isInWallet, token, error } = await NativeStripeSdk.isCardInWallet(\n params\n );\n\n if (error) {\n return {\n error,\n };\n }\n return {\n isInWallet: isInWallet as boolean,\n token: token,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const Constants = NativeStripeSdk.getConstants();\n\n/**\n * Check if the relevant native wallet (Apple Pay on iOS, Google Pay on Android) is supported.\n * @returns A boolean indicating whether or not the native wallet is supported.\n */\nexport const isPlatformPaySupported = async (params?: {\n googlePay?: PlatformPay.IsGooglePaySupportedParams;\n}): Promise<boolean> => {\n return await NativeStripeSdk.isPlatformPaySupported(params ?? {});\n};\n\n/**\n * Launches the relevant native wallet sheet (Apple Pay on iOS, Google Pay on Android) in order to confirm a Stripe [SetupIntent](https://stripe.com/docs/api/setup_intents).\n * @param clientSecret The client secret of the SetupIntent.\n * @param params an object describing the Apple Pay and Google Pay configurations.\n * @returns An object with an error field if something went wrong or the flow was cancelled, otherwise an object with both `setupIntent` and `paymentMethod` fields.\n */\nexport const confirmPlatformPaySetupIntent = async (\n clientSecret: string,\n params: PlatformPay.ConfirmParams\n): Promise<PlatformPay.ConfirmSetupIntentResult> => {\n try {\n const { error, setupIntent } = (await NativeStripeSdk.confirmPlatformPay(\n clientSecret,\n params,\n false\n )) as PlatformPay.ConfirmSetupIntentResult;\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/**\n * Launches the relevant native wallet sheet (Apple Pay on iOS, Google Pay on Android) in order to confirm a Stripe [PaymentIntent](https://stripe.com/docs/api/payment_intents).\n * @param clientSecret The client secret of the PaymentIntent.\n * @param params an object describing the Apple Pay and Google Pay configurations.\n * @returns An object with an error field if something went wrong or the flow was cancelled, otherwise an object with both `paymentIntent` and `paymentMethod` fields.\n */\nexport const confirmPlatformPayPayment = async (\n clientSecret: string,\n params: PlatformPay.ConfirmParams\n): Promise<PlatformPay.ConfirmPaymentResult> => {\n try {\n const { error, paymentIntent } = (await NativeStripeSdk.confirmPlatformPay(\n clientSecret,\n params,\n true\n )) as PlatformPay.ConfirmPaymentResult;\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/**\n * iOS only, this will always return false on Android. Dismisses the Apple Pay sheet if it is open.\n * @returns A boolean indicating whether or not the sheet was successfully closed. Will return false if the Apple Pay sheet was not open.\n */\nexport const dismissPlatformPay = async (): Promise<boolean> => {\n if (Platform.OS !== 'ios') {\n return false;\n }\n try {\n const didDismiss = await NativeStripeSdk.dismissPlatformPay();\n return didDismiss;\n } catch (error: any) {\n return false;\n }\n};\n\n/**\n * Launches the relevant native wallet sheet (Apple Pay on iOS, Google Pay on Android) in order to create a Stripe [PaymentMethod](https://stripe.com/docs/api/payment_methods).\n * @param params an object describing the Apple Pay and Google Pay configurations.\n * @returns An object with an error field if something went wrong or the flow was cancelled, otherwise an object with a `paymentMethod` field.\n */\nexport const createPlatformPayPaymentMethod = async (\n params: PlatformPay.PaymentMethodParams\n): Promise<PlatformPay.PaymentMethodResult> => {\n try {\n const { error, paymentMethod, shippingContact } =\n (await NativeStripeSdk.createPlatformPayPaymentMethod(\n params,\n false\n )) as PlatformPay.PaymentMethodResult;\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentMethod: paymentMethod!,\n shippingContact,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/**\n * @deprecated The Tokens API is deprecated, you should use Payment Methods and `createPlatformPayPaymentMethod` instead. Launches the relevant native wallet sheet (Apple Pay on iOS, Google Pay on Android) in order to create a Stripe [token](https://stripe.com/docs/api/tokens).\n * @param params an object describing the Apple Pay and Google Pay configurations.\n * @returns An object with an error field if something went wrong or the flow was cancelled, otherwise an object with a `token` field.\n */\nexport const createPlatformPayToken = async (\n params: PlatformPay.PaymentMethodParams\n): Promise<PlatformPay.TokenResult> => {\n try {\n const { error, token, shippingContact } =\n (await NativeStripeSdk.createPlatformPayPaymentMethod(\n params,\n true\n )) as PlatformPay.TokenResult;\n if (error) {\n return {\n error,\n };\n }\n return {\n token: token!,\n shippingContact,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/**\n * iOS only. Update different items on the Apple Pay sheet, including the summary items, the shipping methods, and any errors shown. iOS only, this is a no-op on Android.\n * @param params an object describing the Apple Pay configuration, with the following fields:\n * - cartItems An array of payment summary items to display in the Apple Pay sheet.\n * - shippingMethods An array of shipping methods to display in the Apple Pay sheet.\n * - errors An array of errors associated with the user's input that must be corrected to proceed with payment. These errors will be shown in the Apple Pay sheet.\n *\n * @returns An object with an optional 'error' field, which is only populated if something went wrong.\n */\nexport const updatePlatformPaySheet = async (params: {\n applePay: {\n cartItems: Array<PlatformPay.CartSummaryItem>;\n shippingMethods: Array<PlatformPay.ShippingMethod>;\n errors: Array<PlatformPay.ApplePaySheetError>;\n };\n}): Promise<{\n error?: StripeError<PlatformPayError>;\n}> => {\n if (Platform.OS !== 'ios') {\n return {};\n }\n\n try {\n await NativeStripeSdk.updatePlatformPaySheet(\n params.applePay.cartItems,\n params.applePay.shippingMethods,\n params.applePay.errors\n );\n\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/**\n * iOS only, this is a no-op on Android. Use this method to move users to the interface for adding credit cards.\n * This method transfers control to the Wallet app on iPhone or to the Settings\n * app on iPad. For devices that don’t support Apple Pay, this method does nothing.\n */\nexport const openPlatformPaySetup = async (): Promise<void> => {\n if (Platform.OS === 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E,MAAOjF,KAAU,CAAE,CACnB,MAAO,CACLA,KAAK,CAALA,KACF,CAAC,CACH,CACF,CAAC,iBA1BY8E,uBAAsB,gDA0BlC,CAAC,sDAOK,GAAMI,qBAAoB,sDAAG,WAA2B,CAC7D,GAAIjE,qBAAQ,CAACC,EAAE,GAAK,KAAK,CAAE,CACzB,KAAMpB,yBAAe,CAACqF,iBAAiB,EAAE,CAC3C,CACF,CAAC,iBAJYD,qBAAoB,4CAIhC,CAAC"}
1
+ {"version":3,"names":["createPaymentMethod","params","options","NativeStripeSdk","paymentMethod","error","createToken","type","country","toLowerCase","routingNumber","MissingRoutingNumber","token","retrievePaymentIntent","clientSecret","paymentIntent","retrieveSetupIntent","setupIntent","confirmPayment","paymentIntentClientSecret","handleNextAction","returnURL","Platform","OS","createError","handleNextActionForSetup","setupIntentClientSecret","confirmSetupIntent","createTokenForCVCUpdate","cvc","tokenId","handleURLCallback","url","stripeHandled","verifyMicrodepositsForPayment","verifyMicrodeposits","verifyMicrodepositsForSetup","eventEmitter","NativeEventEmitter","NativeModules","StripeSdk","confirmHandlerCallback","orderTrackingCallbackListener","financialConnectionsEventListener","initPaymentSheet","result","confirmHandler","intentConfiguration","remove","addListener","shouldSavePaymentMethod","intentCreationCallback","orderTrackingCallback","applePay","setOrderTracking","configureOrderTracking","console","warn","paymentOption","presentPaymentSheet","confirmPaymentSheetPayment","resetPaymentSheetCustomer","collectBankAccountForPayment","onEvent","collectBankAccount","collectBankAccountForSetup","collectBankAccountToken","session","collectFinancialConnectionsAccounts","canAddCardToWallet","canAddCard","details","isCardInWallet","isInWallet","Constants","getConstants","isPlatformPaySupported","confirmPlatformPaySetupIntent","confirmPlatformPay","confirmPlatformPayPayment","dismissPlatformPay","didDismiss","createPlatformPayPaymentMethod","shippingContact","createPlatformPayToken","updatePlatformPaySheet","cartItems","shippingMethods","errors","openPlatformPaySetup","openApplePaySetup"],"sources":["functions.ts"],"sourcesContent":["import { createError } from './helpers';\nimport { MissingRoutingNumber } from './types/Errors';\nimport NativeStripeSdk from './NativeStripeSdk';\nimport type {\n PlatformPayError,\n ConfirmPaymentResult,\n ConfirmPaymentSheetPaymentResult,\n SetupIntent,\n PaymentIntent,\n ConfirmSetupIntentResult,\n CreatePaymentMethodResult,\n CreateTokenForCVCUpdateResult,\n CreateTokenResult,\n HandleNextActionResult,\n HandleNextActionForSetupResult,\n InitPaymentSheetResult,\n PaymentMethod,\n PaymentSheet,\n PresentPaymentSheetResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n StripeError,\n Token,\n VerifyMicrodepositsParams,\n VerifyMicrodepositsForPaymentResult,\n VerifyMicrodepositsForSetupResult,\n CollectBankAccountForPaymentResult,\n CollectBankAccountForSetupResult,\n IsCardInWalletResult,\n CanAddCardToWalletParams,\n CanAddCardToWalletResult,\n FinancialConnections,\n PlatformPay,\n} from './types';\nimport {\n Platform,\n NativeEventEmitter,\n NativeModules,\n EmitterSubscription,\n} from 'react-native';\nimport type { CollectFinancialConnectionsAccountsParams } from './types/FinancialConnections';\nimport type { CollectBankAccountTokenParams } from './types/PaymentMethod';\n\nexport const createPaymentMethod = async (\n params: PaymentMethod.CreateParams,\n options: PaymentMethod.CreateOptions = {}\n): Promise<CreatePaymentMethodResult> => {\n try {\n const { paymentMethod, error } = await NativeStripeSdk.createPaymentMethod(\n params,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentMethod: paymentMethod!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const createToken = async (\n params: Token.CreateParams\n): Promise<CreateTokenResult> => {\n if (\n params.type === 'BankAccount' &&\n params.country?.toLowerCase() === 'us' &&\n !params.routingNumber\n ) {\n return {\n error: MissingRoutingNumber,\n };\n }\n\n try {\n const { token, error } = await NativeStripeSdk.createToken(params);\n\n if (error) {\n return {\n error,\n };\n }\n return {\n token: token!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const retrievePaymentIntent = async (\n clientSecret: string\n): Promise<RetrievePaymentIntentResult> => {\n try {\n const { paymentIntent, error } =\n await NativeStripeSdk.retrievePaymentIntent(clientSecret);\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const retrieveSetupIntent = async (\n clientSecret: string\n): Promise<RetrieveSetupIntentResult> => {\n try {\n const { setupIntent, error } = await NativeStripeSdk.retrieveSetupIntent(\n clientSecret\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/**\n * Confirm and, if necessary, authenticate a PaymentIntent.\n *\n * @param {string} paymentIntentClientSecret The client_secret of the associated [PaymentIntent](https://stripe.com/docs/api/payment_intents).\n * @param {object=} params An optional object that contains data related to the payment method used to confirm this payment. If no object is provided (undefined), then it is assumed that the payment method has already been [attached to the Payment Intent](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method).\n * @param {object=} options An optional object that contains options for this payment method.\n * @returns A promise that resolves to an object containing either a `paymentIntent` field, or an `error` field.\n */\nexport const confirmPayment = async (\n paymentIntentClientSecret: string,\n params?: PaymentIntent.ConfirmParams,\n options: PaymentIntent.ConfirmOptions = {}\n): Promise<ConfirmPaymentResult> => {\n try {\n const { paymentIntent, error } = await NativeStripeSdk.confirmPayment(\n paymentIntentClientSecret,\n params,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/** Handles any nextAction required to authenticate the PaymentIntent.\n * Call this method if you are using manual confirmation. See https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=custom\n *\n * @param {string} paymentIntentClientSecret The client secret associated with the PaymentIntent.\n * @param {string=} returnURL An optional return URL so the Stripe SDK can redirect back to your app after authentication. This should match the `return_url` you specified during PaymentIntent confirmation.\n * */\nexport const handleNextAction = async (\n paymentIntentClientSecret: string,\n returnURL?: string\n): Promise<HandleNextActionResult> => {\n try {\n const { paymentIntent, error } =\n Platform.OS === 'ios'\n ? await NativeStripeSdk.handleNextAction(\n paymentIntentClientSecret,\n returnURL ?? null\n )\n : await NativeStripeSdk.handleNextAction(paymentIntentClientSecret);\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\n/** Handles any nextAction required to authenticate the SetupIntent.\n * Call this method if you are confirming the SetupIntent on your backend and get a status of requires_action.\n *\n * @param {string} setupIntentClientSecret The client secret associated with the SetupIntent.\n * @param {string=} returnURL An optional return URL so the Stripe SDK can redirect back to your app after authentication. This should match the `return_url` you specified during PaymentIntent confirmation.\n * */\nexport const handleNextActionForSetup = async (\n setupIntentClientSecret: string,\n returnURL?: string\n): Promise<HandleNextActionForSetupResult> => {\n try {\n const { setupIntent, error } =\n Platform.OS === 'ios'\n ? await NativeStripeSdk.handleNextActionForSetup(\n setupIntentClientSecret,\n returnURL ?? null\n )\n : await NativeStripeSdk.handleNextActionForSetup(\n setupIntentClientSecret\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const confirmSetupIntent = async (\n paymentIntentClientSecret: string,\n params: SetupIntent.ConfirmParams,\n options: SetupIntent.ConfirmOptions = {}\n): Promise<ConfirmSetupIntentResult> => {\n try {\n const { setupIntent, error } = await NativeStripeSdk.confirmSetupIntent(\n paymentIntentClientSecret,\n params,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const createTokenForCVCUpdate = async (\n cvc: string\n): Promise<CreateTokenForCVCUpdateResult> => {\n try {\n const { tokenId, error } = await NativeStripeSdk.createTokenForCVCUpdate(\n cvc\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n tokenId: tokenId!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/**\n * Call this method in your app whenever you receive a URL for a Stripe callback.\n * For convenience, you can pass all URLs you receive to this method first, and\n * check the return value to easily determine whether it is a callback URL that Stripe will handle\n * or if your app should process it normally. This is iOS-only, and will always return false on Android.\n */\nexport const handleURLCallback = async (url: string): Promise<boolean> => {\n const stripeHandled =\n Platform.OS === 'ios'\n ? await NativeStripeSdk.handleURLCallback(url)\n : false;\n return stripeHandled;\n};\n\nexport const verifyMicrodepositsForPayment = async (\n clientSecret: string,\n params: VerifyMicrodepositsParams\n): Promise<VerifyMicrodepositsForPaymentResult> => {\n try {\n const { paymentIntent, error } = (await NativeStripeSdk.verifyMicrodeposits(\n true,\n clientSecret,\n params\n )) as VerifyMicrodepositsForPaymentResult;\n\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const verifyMicrodepositsForSetup = async (\n clientSecret: string,\n params: VerifyMicrodepositsParams\n): Promise<VerifyMicrodepositsForSetupResult> => {\n try {\n const { setupIntent, error } = (await NativeStripeSdk.verifyMicrodeposits(\n false,\n clientSecret,\n params\n )) as VerifyMicrodepositsForSetupResult;\n\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nconst eventEmitter = new NativeEventEmitter(NativeModules.StripeSdk);\nlet confirmHandlerCallback: EmitterSubscription | null = null;\nlet orderTrackingCallbackListener: EmitterSubscription | null = null;\nlet financialConnectionsEventListener: EmitterSubscription | null = null;\n\nexport const initPaymentSheet = async (\n params: PaymentSheet.SetupParams\n): Promise<InitPaymentSheetResult> => {\n let result;\n const confirmHandler = params?.intentConfiguration?.confirmHandler;\n if (confirmHandler) {\n confirmHandlerCallback?.remove();\n confirmHandlerCallback = eventEmitter.addListener(\n 'onConfirmHandlerCallback',\n ({\n paymentMethod,\n shouldSavePaymentMethod,\n }: {\n paymentMethod: PaymentMethod.Result;\n shouldSavePaymentMethod: boolean;\n }) => {\n confirmHandler(\n paymentMethod,\n shouldSavePaymentMethod,\n NativeStripeSdk.intentCreationCallback\n );\n }\n );\n }\n\n const orderTrackingCallback = params?.applePay?.setOrderTracking;\n if (orderTrackingCallback) {\n orderTrackingCallbackListener?.remove();\n orderTrackingCallbackListener = eventEmitter.addListener(\n 'onOrderTrackingCallback',\n () => {\n orderTrackingCallback(NativeStripeSdk.configureOrderTracking);\n }\n );\n }\n\n try {\n if (Platform.OS === 'ios' && !params.returnURL) {\n console.warn(\n `[@stripe/stripe-react-native] You have not provided the 'returnURL' field to 'initPaymentSheet', so payment methods that require redirects will not be shown in your iOS Payment Sheet. Visit https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#react-native-set-up-return-url to learn more.`\n );\n }\n result = await NativeStripeSdk.initPaymentSheet(params);\n\n if (result.error) {\n return {\n error: result.error,\n };\n }\n return {\n paymentOption: result.paymentOption,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const presentPaymentSheet = async (\n options: PaymentSheet.PresentOptions = {}\n): Promise<PresentPaymentSheetResult> => {\n try {\n const { paymentOption, error } = await NativeStripeSdk.presentPaymentSheet(\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentOption: paymentOption!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const confirmPaymentSheetPayment =\n async (): Promise<ConfirmPaymentSheetPaymentResult> => {\n try {\n const { error } = await NativeStripeSdk.confirmPaymentSheetPayment();\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n };\n\n/**\n * You must call this method when the user logs out from your app. This will ensure that\n * any persisted authentication state in the PaymentSheet, such as authentication cookies,\n * is also cleared during logout.\n */\nexport const resetPaymentSheetCustomer = async (): Promise<null> => {\n return await NativeStripeSdk.resetPaymentSheetCustomer();\n};\n\nexport const collectBankAccountForPayment = async (\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n): Promise<CollectBankAccountForPaymentResult> => {\n financialConnectionsEventListener?.remove();\n\n if (params.onEvent) {\n financialConnectionsEventListener = eventEmitter.addListener(\n 'onFinancialConnectionsEvent',\n params.onEvent\n );\n }\n\n try {\n const { paymentIntent, error } = (await NativeStripeSdk.collectBankAccount(\n true,\n clientSecret,\n params\n )) as CollectBankAccountForPaymentResult;\n\n financialConnectionsEventListener?.remove();\n\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n financialConnectionsEventListener?.remove();\n return {\n error: createError(error),\n };\n }\n};\n\nexport const collectBankAccountForSetup = async (\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n): Promise<CollectBankAccountForSetupResult> => {\n financialConnectionsEventListener?.remove();\n\n if (params.onEvent) {\n financialConnectionsEventListener = eventEmitter.addListener(\n 'onFinancialConnectionsEvent',\n params.onEvent\n );\n }\n\n try {\n const { setupIntent, error } = (await NativeStripeSdk.collectBankAccount(\n false,\n clientSecret,\n params\n )) as CollectBankAccountForSetupResult;\n\n financialConnectionsEventListener?.remove();\n\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n financialConnectionsEventListener?.remove();\n return {\n error: createError(error),\n };\n }\n};\n\n/**\n * Use collectBankAccountToken in the [Add a Financial Connections Account to a US Custom Connect](https://stripe.com/docs/financial-connections/connect-payouts) account flow.\n * When called, it will load the Authentication Flow, an on-page modal UI which allows your user to securely link their external financial account for payouts.\n * @param {string} clientSecret The client_secret of the [Financial Connections Session](https://stripe.com/docs/api/financial_connections/session).\n * @param {CollectBankAccountTokenParams} params Optional parameters.\n * @returns A promise that resolves to an object containing either `session` and `token` fields, or an error field.\n */\nexport const collectBankAccountToken = async (\n clientSecret: string,\n params: CollectBankAccountTokenParams = {}\n): Promise<FinancialConnections.TokenResult> => {\n financialConnectionsEventListener?.remove();\n\n if (params.onEvent) {\n financialConnectionsEventListener = eventEmitter.addListener(\n 'onFinancialConnectionsEvent',\n params.onEvent\n );\n }\n\n try {\n const { session, token, error } =\n await NativeStripeSdk.collectBankAccountToken(clientSecret);\n\n financialConnectionsEventListener?.remove();\n\n if (error) {\n return {\n error,\n };\n }\n return {\n session: session!,\n token: token!,\n };\n } catch (error: any) {\n financialConnectionsEventListener?.remove();\n return {\n error: createError(error),\n };\n }\n};\n\n/**\n * Use collectFinancialConnectionsAccounts in the [Collect an account to build data-powered products](https://stripe.com/docs/financial-connections/other-data-powered-products) flow.\n * When called, it will load the Authentication Flow, an on-page modal UI which allows your user to securely link their external financial account.\n * @param {string} clientSecret The client_secret of the [Financial Connections Session](https://stripe.com/docs/api/financial_connections/session).\n * @param {CollectFinancialConnectionsAccountsParams} params Optional parameters.\n * @returns A promise that resolves to an object containing either a `session` field, or an error field.\n */\nexport const collectFinancialConnectionsAccounts = async (\n clientSecret: string,\n params: CollectFinancialConnectionsAccountsParams = {}\n): Promise<FinancialConnections.SessionResult> => {\n financialConnectionsEventListener?.remove();\n\n if (params.onEvent) {\n financialConnectionsEventListener = eventEmitter.addListener(\n 'onFinancialConnectionsEvent',\n params.onEvent\n );\n }\n\n try {\n const { session, error } =\n await NativeStripeSdk.collectFinancialConnectionsAccounts(clientSecret);\n\n financialConnectionsEventListener?.remove();\n\n if (error) {\n return {\n error,\n };\n }\n return {\n session: session!,\n };\n } catch (error: any) {\n financialConnectionsEventListener?.remove();\n return {\n error: createError(error),\n };\n }\n};\n\n/**\n * Check if the app & device support adding this card to the native wallet.\n * @param params An object containing fields for `primaryAccountIdentifier`, `cardLastFour`, and `testEnv`.\n *\n * @returns A promise resolving to an object of type CanAddCardToWalletResult. Check the `canAddCard` field, if it's true, you should show the `<AddToWalletButton />`\n */\nexport const canAddCardToWallet = async (\n params: CanAddCardToWalletParams\n): Promise<CanAddCardToWalletResult> => {\n try {\n const { canAddCard, details, error } =\n await NativeStripeSdk.canAddCardToWallet(params);\n\n if (error) {\n return {\n error,\n };\n }\n return {\n canAddCard: canAddCard as boolean,\n details: details,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\n/** @deprecated Please use `canAddCardToWallet` instead. */\nexport const isCardInWallet = async (params: {\n cardLastFour: string;\n}): Promise<IsCardInWalletResult> => {\n try {\n const { isInWallet, token, error } = await NativeStripeSdk.isCardInWallet(\n params\n );\n\n if (error) {\n return {\n error,\n };\n }\n return {\n isInWallet: isInWallet as boolean,\n token: token,\n };\n } catch (error: any) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const Constants = NativeStripeSdk.getConstants();\n\n/**\n * Check if the relevant native wallet (Apple Pay on iOS, Google Pay on Android) is supported.\n * @returns A boolean indicating whether or not the native wallet is supported.\n */\nexport const isPlatformPaySupported = async (params?: {\n googlePay?: PlatformPay.IsGooglePaySupportedParams;\n}): Promise<boolean> => {\n return await NativeStripeSdk.isPlatformPaySupported(params ?? {});\n};\n\n/**\n * Launches the relevant native wallet sheet (Apple Pay on iOS, Google Pay on Android) in order to confirm a Stripe [SetupIntent](https://stripe.com/docs/api/setup_intents).\n * @param clientSecret The client secret of the SetupIntent.\n * @param params an object describing the Apple Pay and Google Pay configurations.\n * @returns An object with an error field if something went wrong or the flow was cancelled, otherwise an object with both `setupIntent` and `paymentMethod` fields.\n */\nexport const confirmPlatformPaySetupIntent = async (\n clientSecret: string,\n params: PlatformPay.ConfirmParams\n): Promise<PlatformPay.ConfirmSetupIntentResult> => {\n try {\n const { error, setupIntent } = (await NativeStripeSdk.confirmPlatformPay(\n clientSecret,\n params,\n false\n )) as PlatformPay.ConfirmSetupIntentResult;\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/**\n * Launches the relevant native wallet sheet (Apple Pay on iOS, Google Pay on Android) in order to confirm a Stripe [PaymentIntent](https://stripe.com/docs/api/payment_intents).\n * @param clientSecret The client secret of the PaymentIntent.\n * @param params an object describing the Apple Pay and Google Pay configurations.\n * @returns An object with an error field if something went wrong or the flow was cancelled, otherwise an object with both `paymentIntent` and `paymentMethod` fields.\n */\nexport const confirmPlatformPayPayment = async (\n clientSecret: string,\n params: PlatformPay.ConfirmParams\n): Promise<PlatformPay.ConfirmPaymentResult> => {\n try {\n const { error, paymentIntent } = (await NativeStripeSdk.confirmPlatformPay(\n clientSecret,\n params,\n true\n )) as PlatformPay.ConfirmPaymentResult;\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/**\n * iOS only, this will always return false on Android. Dismisses the Apple Pay sheet if it is open.\n * @returns A boolean indicating whether or not the sheet was successfully closed. Will return false if the Apple Pay sheet was not open.\n */\nexport const dismissPlatformPay = async (): Promise<boolean> => {\n if (Platform.OS !== 'ios') {\n return false;\n }\n try {\n const didDismiss = await NativeStripeSdk.dismissPlatformPay();\n return didDismiss;\n } catch (error: any) {\n return false;\n }\n};\n\n/**\n * Launches the relevant native wallet sheet (Apple Pay on iOS, Google Pay on Android) in order to create a Stripe [PaymentMethod](https://stripe.com/docs/api/payment_methods).\n * @param params an object describing the Apple Pay and Google Pay configurations.\n * @returns An object with an error field if something went wrong or the flow was cancelled, otherwise an object with a `paymentMethod` field.\n */\nexport const createPlatformPayPaymentMethod = async (\n params: PlatformPay.PaymentMethodParams\n): Promise<PlatformPay.PaymentMethodResult> => {\n try {\n const { error, paymentMethod, shippingContact } =\n (await NativeStripeSdk.createPlatformPayPaymentMethod(\n params,\n false\n )) as PlatformPay.PaymentMethodResult;\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentMethod: paymentMethod!,\n shippingContact,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/**\n * @deprecated The Tokens API is deprecated, you should use Payment Methods and `createPlatformPayPaymentMethod` instead. Launches the relevant native wallet sheet (Apple Pay on iOS, Google Pay on Android) in order to create a Stripe [token](https://stripe.com/docs/api/tokens).\n * @param params an object describing the Apple Pay and Google Pay configurations.\n * @returns An object with an error field if something went wrong or the flow was cancelled, otherwise an object with a `token` field.\n */\nexport const createPlatformPayToken = async (\n params: PlatformPay.PaymentMethodParams\n): Promise<PlatformPay.TokenResult> => {\n try {\n const { error, token, shippingContact } =\n (await NativeStripeSdk.createPlatformPayPaymentMethod(\n params,\n true\n )) as PlatformPay.TokenResult;\n if (error) {\n return {\n error,\n };\n }\n return {\n token: token!,\n shippingContact,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/**\n * iOS only. Update different items on the Apple Pay sheet, including the summary items, the shipping methods, and any errors shown. iOS only, this is a no-op on Android.\n * @param params an object describing the Apple Pay configuration, with the following fields:\n * - cartItems An array of payment summary items to display in the Apple Pay sheet.\n * - shippingMethods An array of shipping methods to display in the Apple Pay sheet.\n * - errors An array of errors associated with the user's input that must be corrected to proceed with payment. These errors will be shown in the Apple Pay sheet.\n *\n * @returns An object with an optional 'error' field, which is only populated if something went wrong.\n */\nexport const updatePlatformPaySheet = async (params: {\n applePay: {\n cartItems: Array<PlatformPay.CartSummaryItem>;\n shippingMethods: Array<PlatformPay.ShippingMethod>;\n errors: Array<PlatformPay.ApplePaySheetError>;\n };\n}): Promise<{\n error?: StripeError<PlatformPayError>;\n}> => {\n if (Platform.OS !== 'ios') {\n return {};\n }\n\n try {\n await NativeStripeSdk.updatePlatformPaySheet(\n params.applePay.cartItems,\n params.applePay.shippingMethods,\n params.applePay.errors\n );\n\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/**\n * iOS only, this is a no-op on Android. Use this method to move users to the interface for adding credit cards.\n * This method transfers control to the Wallet app on iPhone or to the Settings\n * app on iPad. For devices that don’t support Apple Pay, this method does nothing.\n */\nexport const openPlatformPaySetup = async (): Promise<void> => {\n if (Platform.OS === 'ios') {\n await NativeStripeSdk.openApplePaySetup();\n }\n};\n"],"mappings":"qqCAAA,kCACA,sCACA,0EAgCA,yCASO,GAAM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,CAAC,CAAC,CACX,CAAE,MAAOnF,KAAU,CAAE,CACnB,MAAO,CACLA,KAAK,CAALA,KACF,CAAC,CACH,CACF,CAAC,iBA1BYgF,uBAAsB,gDA0BlC,CAAC,sDAOK,GAAMI,qBAAoB,sDAAG,WAA2B,CAC7D,GAAInE,qBAAQ,CAACC,EAAE,GAAK,KAAK,CAAE,CACzB,KAAMpB,yBAAe,CAACuF,iBAAiB,EAAE,CAC3C,CACF,CAAC,iBAJYD,qBAAoB,4CAIhC,CAAC"}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useFinancialConnectionsSheet=useFinancialConnectionsSheet;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _useStripe2=require("./useStripe");function useFinancialConnectionsSheet(){var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var _useStripe=(0,_useStripe2.useStripe)(),collectBankAccountToken=_useStripe.collectBankAccountToken,collectFinancialConnectionsAccounts=_useStripe.collectFinancialConnectionsAccounts;var _collectBankAccountToken=(0,_react.useCallback)(function(){var _ref=(0,_asyncToGenerator2.default)(function*(clientSecret){setLoading(true);var result=yield collectBankAccountToken(clientSecret);setLoading(false);return result;});return function(_x){return _ref.apply(this,arguments);};}(),[collectBankAccountToken]);var _collectFinancialConnectionsAccounts=(0,_react.useCallback)(function(){var _ref2=(0,_asyncToGenerator2.default)(function*(clientSecret){setLoading(true);var result=yield collectFinancialConnectionsAccounts(clientSecret);setLoading(false);return result;});return function(_x2){return _ref2.apply(this,arguments);};}(),[collectFinancialConnectionsAccounts]);return{collectBankAccountToken:_collectBankAccountToken,collectFinancialConnectionsAccounts:_collectFinancialConnectionsAccounts,loading:loading};}
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useFinancialConnectionsSheet=useFinancialConnectionsSheet;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _useStripe2=require("./useStripe");function useFinancialConnectionsSheet(){var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var _useStripe=(0,_useStripe2.useStripe)(),collectBankAccountToken=_useStripe.collectBankAccountToken,collectFinancialConnectionsAccounts=_useStripe.collectFinancialConnectionsAccounts;var _collectBankAccountToken=(0,_react.useCallback)(function(){var _ref=(0,_asyncToGenerator2.default)(function*(clientSecret,params){setLoading(true);var result=yield collectBankAccountToken(clientSecret,params);setLoading(false);return result;});return function(_x,_x2){return _ref.apply(this,arguments);};}(),[collectBankAccountToken]);var _collectFinancialConnectionsAccounts=(0,_react.useCallback)(function(){var _ref2=(0,_asyncToGenerator2.default)(function*(clientSecret,params){setLoading(true);var result=yield collectFinancialConnectionsAccounts(clientSecret,params);setLoading(false);return result;});return function(_x3,_x4){return _ref2.apply(this,arguments);};}(),[collectFinancialConnectionsAccounts]);return{collectBankAccountToken:_collectBankAccountToken,collectFinancialConnectionsAccounts:_collectFinancialConnectionsAccounts,loading:loading};}
2
2
  //# sourceMappingURL=useFinancialConnectionsSheet.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useFinancialConnectionsSheet","useState","loading","setLoading","useStripe","collectBankAccountToken","collectFinancialConnectionsAccounts","_collectBankAccountToken","useCallback","clientSecret","result","_collectFinancialConnectionsAccounts"],"sources":["useFinancialConnectionsSheet.tsx"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport { useStripe } from './useStripe';\n\n/**\n * React hook for accessing functions on the Financial Connections sheet.\n *\n * Retuns the `collectBankAccountToken` and `collectFinancialConnectionsAccounts` functions, and a `loading` boolean that you can use\n * to display loading state (like showing a spinner).\n */\nexport function useFinancialConnectionsSheet() {\n const [loading, setLoading] = useState(false);\n const { collectBankAccountToken, collectFinancialConnectionsAccounts } =\n useStripe();\n\n const _collectBankAccountToken = useCallback(\n async (clientSecret: string) => {\n setLoading(true);\n const result = await collectBankAccountToken(clientSecret);\n setLoading(false);\n return result;\n },\n [collectBankAccountToken]\n );\n\n const _collectFinancialConnectionsAccounts = useCallback(\n async (clientSecret: string) => {\n setLoading(true);\n const result = await collectFinancialConnectionsAccounts(clientSecret);\n setLoading(false);\n return result;\n },\n [collectFinancialConnectionsAccounts]\n );\n\n return {\n collectBankAccountToken: _collectBankAccountToken,\n collectFinancialConnectionsAccounts: _collectFinancialConnectionsAccounts,\n loading,\n };\n}\n"],"mappings":"4YAAA,4BACA,uCAQO,QAASA,6BAA4B,EAAG,CAC7C,cAA8B,GAAAC,eAAQ,EAAC,KAAK,CAAC,qDAAtCC,OAAO,eAAEC,UAAU,eAC1B,eACE,GAAAC,qBAAS,GAAE,CADLC,uBAAuB,YAAvBA,uBAAuB,CAAEC,mCAAmC,YAAnCA,mCAAmC,CAGpE,GAAMC,yBAAwB,CAAG,GAAAC,kBAAW,qDAC1C,UAAOC,YAAoB,CAAK,CAC9BN,UAAU,CAAC,IAAI,CAAC,CAChB,GAAMO,OAAM,MAASL,wBAAuB,CAACI,YAAY,CAAC,CAC1DN,UAAU,CAAC,KAAK,CAAC,CACjB,MAAOO,OAAM,CACf,CAAC,8DACD,CAACL,uBAAuB,CAAC,CAC1B,CAED,GAAMM,qCAAoC,CAAG,GAAAH,kBAAW,sDACtD,UAAOC,YAAoB,CAAK,CAC9BN,UAAU,CAAC,IAAI,CAAC,CAChB,GAAMO,OAAM,MAASJ,oCAAmC,CAACG,YAAY,CAAC,CACtEN,UAAU,CAAC,KAAK,CAAC,CACjB,MAAOO,OAAM,CACf,CAAC,gEACD,CAACJ,mCAAmC,CAAC,CACtC,CAED,MAAO,CACLD,uBAAuB,CAAEE,wBAAwB,CACjDD,mCAAmC,CAAEK,oCAAoC,CACzET,OAAO,CAAPA,OACF,CAAC,CACH"}
1
+ {"version":3,"names":["useFinancialConnectionsSheet","useState","loading","setLoading","useStripe","collectBankAccountToken","collectFinancialConnectionsAccounts","_collectBankAccountToken","useCallback","clientSecret","params","result","_collectFinancialConnectionsAccounts"],"sources":["useFinancialConnectionsSheet.tsx"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport { useStripe } from './useStripe';\nimport type { CollectFinancialConnectionsAccountsParams } from 'src/types/FinancialConnections';\nimport type { CollectBankAccountTokenParams } from 'src/types/PaymentMethod';\n\n/**\n * React hook for accessing functions on the Financial Connections sheet.\n *\n * Retuns the `collectBankAccountToken` and `collectFinancialConnectionsAccounts` functions, and a `loading` boolean that you can use\n * to display loading state (like showing a spinner).\n */\nexport function useFinancialConnectionsSheet() {\n const [loading, setLoading] = useState(false);\n const { collectBankAccountToken, collectFinancialConnectionsAccounts } =\n useStripe();\n\n const _collectBankAccountToken = useCallback(\n async (clientSecret: string, params?: CollectBankAccountTokenParams) => {\n setLoading(true);\n const result = await collectBankAccountToken(clientSecret, params);\n setLoading(false);\n return result;\n },\n [collectBankAccountToken]\n );\n\n const _collectFinancialConnectionsAccounts = useCallback(\n async (\n clientSecret: string,\n params?: CollectFinancialConnectionsAccountsParams\n ) => {\n setLoading(true);\n const result = await collectFinancialConnectionsAccounts(\n clientSecret,\n params\n );\n setLoading(false);\n return result;\n },\n [collectFinancialConnectionsAccounts]\n );\n\n return {\n collectBankAccountToken: _collectBankAccountToken,\n collectFinancialConnectionsAccounts: _collectFinancialConnectionsAccounts,\n loading,\n };\n}\n"],"mappings":"4YAAA,4BACA,uCAUO,QAASA,6BAA4B,EAAG,CAC7C,cAA8B,GAAAC,eAAQ,EAAC,KAAK,CAAC,qDAAtCC,OAAO,eAAEC,UAAU,eAC1B,eACE,GAAAC,qBAAS,GAAE,CADLC,uBAAuB,YAAvBA,uBAAuB,CAAEC,mCAAmC,YAAnCA,mCAAmC,CAGpE,GAAMC,yBAAwB,CAAG,GAAAC,kBAAW,qDAC1C,UAAOC,YAAoB,CAAEC,MAAsC,CAAK,CACtEP,UAAU,CAAC,IAAI,CAAC,CAChB,GAAMQ,OAAM,MAASN,wBAAuB,CAACI,YAAY,CAAEC,MAAM,CAAC,CAClEP,UAAU,CAAC,KAAK,CAAC,CACjB,MAAOQ,OAAM,CACf,CAAC,kEACD,CAACN,uBAAuB,CAAC,CAC1B,CAED,GAAMO,qCAAoC,CAAG,GAAAJ,kBAAW,sDACtD,UACEC,YAAoB,CACpBC,MAAkD,CAC/C,CACHP,UAAU,CAAC,IAAI,CAAC,CAChB,GAAMQ,OAAM,MAASL,oCAAmC,CACtDG,YAAY,CACZC,MAAM,CACP,CACDP,UAAU,CAAC,KAAK,CAAC,CACjB,MAAOQ,OAAM,CACf,CAAC,oEACD,CAACL,mCAAmC,CAAC,CACtC,CAED,MAAO,CACLD,uBAAuB,CAAEE,wBAAwB,CACjDD,mCAAmC,CAAEM,oCAAoC,CACzEV,OAAO,CAAPA,OACF,CAAC,CACH"}
@@ -1,2 +1,2 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useStripe=useStripe;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _react=require("react");var _functions=require("../functions");function useStripe(){var _createPaymentMethod=(0,_react.useCallback)(function(){var _ref=(0,_asyncToGenerator2.default)(function*(data){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return(0,_functions.createPaymentMethod)(data,options);});return function(_x){return _ref.apply(this,arguments);};}(),[]);var _createToken=(0,_react.useCallback)(function(){var _ref2=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.createToken)(params);});return function(_x2){return _ref2.apply(this,arguments);};}(),[]);var _retrievePaymentIntent=(0,_react.useCallback)(function(){var _ref3=(0,_asyncToGenerator2.default)(function*(clientSecret){return(0,_functions.retrievePaymentIntent)(clientSecret);});return function(_x3){return _ref3.apply(this,arguments);};}(),[]);var _retrieveSetupIntent=(0,_react.useCallback)(function(){var _ref4=(0,_asyncToGenerator2.default)(function*(clientSecret){return(0,_functions.retrieveSetupIntent)(clientSecret);});return function(_x4){return _ref4.apply(this,arguments);};}(),[]);var _confirmPayment=(0,_react.useCallback)(function(){var _ref5=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,data){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return(0,_functions.confirmPayment)(paymentIntentClientSecret,data,options);});return function(_x5,_x6){return _ref5.apply(this,arguments);};}(),[]);var _handleNextAction=(0,_react.useCallback)(function(){var _ref6=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,returnURL){return(0,_functions.handleNextAction)(paymentIntentClientSecret,returnURL);});return function(_x7,_x8){return _ref6.apply(this,arguments);};}(),[]);var _handleNextActionForSetup=(0,_react.useCallback)(function(){var _ref7=(0,_asyncToGenerator2.default)(function*(setupIntentClientSecret,returnURL){return(0,_functions.handleNextActionForSetup)(setupIntentClientSecret,returnURL);});return function(_x9,_x10){return _ref7.apply(this,arguments);};}(),[]);var _confirmSetupIntent=(0,_react.useCallback)(function(){var _ref8=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,data){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return(0,_functions.confirmSetupIntent)(paymentIntentClientSecret,data,options);});return function(_x11,_x12){return _ref8.apply(this,arguments);};}(),[]);var _createTokenForCVCUpdate=(0,_react.useCallback)(function(){var _ref9=(0,_asyncToGenerator2.default)(function*(cvc){return(0,_functions.createTokenForCVCUpdate)(cvc);});return function(_x13){return _ref9.apply(this,arguments);};}(),[]);var _initPaymentSheet=(0,_react.useCallback)(function(){var _ref10=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.initPaymentSheet)(params);});return function(_x14){return _ref10.apply(this,arguments);};}(),[]);var _presentPaymentSheet=(0,_react.useCallback)(function(){var _ref11=(0,_asyncToGenerator2.default)(function*(options){return(0,_functions.presentPaymentSheet)(options);});return function(_x15){return _ref11.apply(this,arguments);};}(),[]);var _confirmPaymentSheetPayment=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.confirmPaymentSheetPayment)();}),[]);var _handleURLCallback=(0,_react.useCallback)(function(){var _ref13=(0,_asyncToGenerator2.default)(function*(url){return(0,_functions.handleURLCallback)(url);});return function(_x16){return _ref13.apply(this,arguments);};}(),[]);var _collectBankAccountForPayment=(0,_react.useCallback)(function(){var _ref14=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.collectBankAccountForPayment)(clientSecret,params);});return function(_x17,_x18){return _ref14.apply(this,arguments);};}(),[]);var _collectBankAccountForSetup=(0,_react.useCallback)(function(){var _ref15=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.collectBankAccountForSetup)(clientSecret,params);});return function(_x19,_x20){return _ref15.apply(this,arguments);};}(),[]);var _verifyMicrodepositsForPayment=(0,_react.useCallback)(function(){var _ref16=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.verifyMicrodepositsForPayment)(clientSecret,params);});return function(_x21,_x22){return _ref16.apply(this,arguments);};}(),[]);var _verifyMicrodepositsForSetup=(0,_react.useCallback)(function(){var _ref17=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.verifyMicrodepositsForSetup)(clientSecret,params);});return function(_x23,_x24){return _ref17.apply(this,arguments);};}(),[]);var _canAddCardToWallet=(0,_react.useCallback)(function(){var _ref18=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.canAddCardToWallet)(params);});return function(_x25){return _ref18.apply(this,arguments);};}(),[]);var _collectBankAccountToken=(0,_react.useCallback)(function(){var _ref19=(0,_asyncToGenerator2.default)(function*(clientSecret){return(0,_functions.collectBankAccountToken)(clientSecret);});return function(_x26){return _ref19.apply(this,arguments);};}(),[]);var _collectFinancialConnectionsAccounts=(0,_react.useCallback)(function(){var _ref20=(0,_asyncToGenerator2.default)(function*(clientSecret){return(0,_functions.collectFinancialConnectionsAccounts)(clientSecret);});return function(_x27){return _ref20.apply(this,arguments);};}(),[]);var _resetPaymentSheetCustomer=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.resetPaymentSheetCustomer)();}),[]);var _isPlatformPaySupported=(0,_react.useCallback)(function(){var _ref22=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.isPlatformPaySupported)(params);});return function(_x28){return _ref22.apply(this,arguments);};}(),[]);var _confirmPlatformPaySetupIntent=(0,_react.useCallback)(function(){var _ref23=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.confirmPlatformPaySetupIntent)(clientSecret,params);});return function(_x29,_x30){return _ref23.apply(this,arguments);};}(),[]);var _confirmPlatformPayPayment=(0,_react.useCallback)(function(){var _ref24=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.confirmPlatformPayPayment)(clientSecret,params);});return function(_x31,_x32){return _ref24.apply(this,arguments);};}(),[]);var _dismissPlatformPay=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.dismissPlatformPay)();}),[]);var _createPlatformPayPaymentMethod=(0,_react.useCallback)(function(){var _ref26=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.createPlatformPayPaymentMethod)(params);});return function(_x33){return _ref26.apply(this,arguments);};}(),[]);var _createPlatformPayToken=(0,_react.useCallback)(function(){var _ref27=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.createPlatformPayToken)(params);});return function(_x34){return _ref27.apply(this,arguments);};}(),[]);var _updatePlatformPaySheet=(0,_react.useCallback)(function(){var _ref28=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.updatePlatformPaySheet)(params);});return function(_x35){return _ref28.apply(this,arguments);};}(),[]);var _openPlatformPaySetup=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.openPlatformPaySetup)();}),[]);return{retrievePaymentIntent:_retrievePaymentIntent,retrieveSetupIntent:_retrieveSetupIntent,confirmPayment:_confirmPayment,createPaymentMethod:_createPaymentMethod,handleNextAction:_handleNextAction,handleNextActionForSetup:_handleNextActionForSetup,confirmSetupIntent:_confirmSetupIntent,createTokenForCVCUpdate:_createTokenForCVCUpdate,handleURLCallback:_handleURLCallback,confirmPaymentSheetPayment:_confirmPaymentSheetPayment,presentPaymentSheet:_presentPaymentSheet,initPaymentSheet:_initPaymentSheet,createToken:_createToken,collectBankAccountForPayment:_collectBankAccountForPayment,collectBankAccountForSetup:_collectBankAccountForSetup,verifyMicrodepositsForPayment:_verifyMicrodepositsForPayment,verifyMicrodepositsForSetup:_verifyMicrodepositsForSetup,canAddCardToWallet:_canAddCardToWallet,collectBankAccountToken:_collectBankAccountToken,collectFinancialConnectionsAccounts:_collectFinancialConnectionsAccounts,resetPaymentSheetCustomer:_resetPaymentSheetCustomer,isPlatformPaySupported:_isPlatformPaySupported,confirmPlatformPaySetupIntent:_confirmPlatformPaySetupIntent,confirmPlatformPayPayment:_confirmPlatformPayPayment,dismissPlatformPay:_dismissPlatformPay,createPlatformPayPaymentMethod:_createPlatformPayPaymentMethod,createPlatformPayToken:_createPlatformPayToken,updatePlatformPaySheet:_updatePlatformPaySheet,openPlatformPaySetup:_openPlatformPaySetup};}
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useStripe=useStripe;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _react=require("react");var _functions=require("../functions");function useStripe(){var _createPaymentMethod=(0,_react.useCallback)(function(){var _ref=(0,_asyncToGenerator2.default)(function*(data){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return(0,_functions.createPaymentMethod)(data,options);});return function(_x){return _ref.apply(this,arguments);};}(),[]);var _createToken=(0,_react.useCallback)(function(){var _ref2=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.createToken)(params);});return function(_x2){return _ref2.apply(this,arguments);};}(),[]);var _retrievePaymentIntent=(0,_react.useCallback)(function(){var _ref3=(0,_asyncToGenerator2.default)(function*(clientSecret){return(0,_functions.retrievePaymentIntent)(clientSecret);});return function(_x3){return _ref3.apply(this,arguments);};}(),[]);var _retrieveSetupIntent=(0,_react.useCallback)(function(){var _ref4=(0,_asyncToGenerator2.default)(function*(clientSecret){return(0,_functions.retrieveSetupIntent)(clientSecret);});return function(_x4){return _ref4.apply(this,arguments);};}(),[]);var _confirmPayment=(0,_react.useCallback)(function(){var _ref5=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,data){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return(0,_functions.confirmPayment)(paymentIntentClientSecret,data,options);});return function(_x5,_x6){return _ref5.apply(this,arguments);};}(),[]);var _handleNextAction=(0,_react.useCallback)(function(){var _ref6=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,returnURL){return(0,_functions.handleNextAction)(paymentIntentClientSecret,returnURL);});return function(_x7,_x8){return _ref6.apply(this,arguments);};}(),[]);var _handleNextActionForSetup=(0,_react.useCallback)(function(){var _ref7=(0,_asyncToGenerator2.default)(function*(setupIntentClientSecret,returnURL){return(0,_functions.handleNextActionForSetup)(setupIntentClientSecret,returnURL);});return function(_x9,_x10){return _ref7.apply(this,arguments);};}(),[]);var _confirmSetupIntent=(0,_react.useCallback)(function(){var _ref8=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,data){var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return(0,_functions.confirmSetupIntent)(paymentIntentClientSecret,data,options);});return function(_x11,_x12){return _ref8.apply(this,arguments);};}(),[]);var _createTokenForCVCUpdate=(0,_react.useCallback)(function(){var _ref9=(0,_asyncToGenerator2.default)(function*(cvc){return(0,_functions.createTokenForCVCUpdate)(cvc);});return function(_x13){return _ref9.apply(this,arguments);};}(),[]);var _initPaymentSheet=(0,_react.useCallback)(function(){var _ref10=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.initPaymentSheet)(params);});return function(_x14){return _ref10.apply(this,arguments);};}(),[]);var _presentPaymentSheet=(0,_react.useCallback)(function(){var _ref11=(0,_asyncToGenerator2.default)(function*(options){return(0,_functions.presentPaymentSheet)(options);});return function(_x15){return _ref11.apply(this,arguments);};}(),[]);var _confirmPaymentSheetPayment=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.confirmPaymentSheetPayment)();}),[]);var _handleURLCallback=(0,_react.useCallback)(function(){var _ref13=(0,_asyncToGenerator2.default)(function*(url){return(0,_functions.handleURLCallback)(url);});return function(_x16){return _ref13.apply(this,arguments);};}(),[]);var _collectBankAccountForPayment=(0,_react.useCallback)(function(){var _ref14=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.collectBankAccountForPayment)(clientSecret,params);});return function(_x17,_x18){return _ref14.apply(this,arguments);};}(),[]);var _collectBankAccountForSetup=(0,_react.useCallback)(function(){var _ref15=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.collectBankAccountForSetup)(clientSecret,params);});return function(_x19,_x20){return _ref15.apply(this,arguments);};}(),[]);var _verifyMicrodepositsForPayment=(0,_react.useCallback)(function(){var _ref16=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.verifyMicrodepositsForPayment)(clientSecret,params);});return function(_x21,_x22){return _ref16.apply(this,arguments);};}(),[]);var _verifyMicrodepositsForSetup=(0,_react.useCallback)(function(){var _ref17=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.verifyMicrodepositsForSetup)(clientSecret,params);});return function(_x23,_x24){return _ref17.apply(this,arguments);};}(),[]);var _canAddCardToWallet=(0,_react.useCallback)(function(){var _ref18=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.canAddCardToWallet)(params);});return function(_x25){return _ref18.apply(this,arguments);};}(),[]);var _collectBankAccountToken=(0,_react.useCallback)(function(){var _ref19=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.collectBankAccountToken)(clientSecret,params);});return function(_x26,_x27){return _ref19.apply(this,arguments);};}(),[]);var _collectFinancialConnectionsAccounts=(0,_react.useCallback)(function(){var _ref20=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.collectFinancialConnectionsAccounts)(clientSecret,params);});return function(_x28,_x29){return _ref20.apply(this,arguments);};}(),[]);var _resetPaymentSheetCustomer=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.resetPaymentSheetCustomer)();}),[]);var _isPlatformPaySupported=(0,_react.useCallback)(function(){var _ref22=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.isPlatformPaySupported)(params);});return function(_x30){return _ref22.apply(this,arguments);};}(),[]);var _confirmPlatformPaySetupIntent=(0,_react.useCallback)(function(){var _ref23=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.confirmPlatformPaySetupIntent)(clientSecret,params);});return function(_x31,_x32){return _ref23.apply(this,arguments);};}(),[]);var _confirmPlatformPayPayment=(0,_react.useCallback)(function(){var _ref24=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.confirmPlatformPayPayment)(clientSecret,params);});return function(_x33,_x34){return _ref24.apply(this,arguments);};}(),[]);var _dismissPlatformPay=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.dismissPlatformPay)();}),[]);var _createPlatformPayPaymentMethod=(0,_react.useCallback)(function(){var _ref26=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.createPlatformPayPaymentMethod)(params);});return function(_x35){return _ref26.apply(this,arguments);};}(),[]);var _createPlatformPayToken=(0,_react.useCallback)(function(){var _ref27=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.createPlatformPayToken)(params);});return function(_x36){return _ref27.apply(this,arguments);};}(),[]);var _updatePlatformPaySheet=(0,_react.useCallback)(function(){var _ref28=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.updatePlatformPaySheet)(params);});return function(_x37){return _ref28.apply(this,arguments);};}(),[]);var _openPlatformPaySetup=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.openPlatformPaySetup)();}),[]);return{retrievePaymentIntent:_retrievePaymentIntent,retrieveSetupIntent:_retrieveSetupIntent,confirmPayment:_confirmPayment,createPaymentMethod:_createPaymentMethod,handleNextAction:_handleNextAction,handleNextActionForSetup:_handleNextActionForSetup,confirmSetupIntent:_confirmSetupIntent,createTokenForCVCUpdate:_createTokenForCVCUpdate,handleURLCallback:_handleURLCallback,confirmPaymentSheetPayment:_confirmPaymentSheetPayment,presentPaymentSheet:_presentPaymentSheet,initPaymentSheet:_initPaymentSheet,createToken:_createToken,collectBankAccountForPayment:_collectBankAccountForPayment,collectBankAccountForSetup:_collectBankAccountForSetup,verifyMicrodepositsForPayment:_verifyMicrodepositsForPayment,verifyMicrodepositsForSetup:_verifyMicrodepositsForSetup,canAddCardToWallet:_canAddCardToWallet,collectBankAccountToken:_collectBankAccountToken,collectFinancialConnectionsAccounts:_collectFinancialConnectionsAccounts,resetPaymentSheetCustomer:_resetPaymentSheetCustomer,isPlatformPaySupported:_isPlatformPaySupported,confirmPlatformPaySetupIntent:_confirmPlatformPaySetupIntent,confirmPlatformPayPayment:_confirmPlatformPayPayment,dismissPlatformPay:_dismissPlatformPay,createPlatformPayPaymentMethod:_createPlatformPayPaymentMethod,createPlatformPayToken:_createPlatformPayToken,updatePlatformPaySheet:_updatePlatformPaySheet,openPlatformPaySetup:_openPlatformPaySetup};}
2
2
  //# sourceMappingURL=useStripe.js.map