@stripe/stripe-react-native 0.22.1 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +1 -0
- package/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt +21 -9
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +4 -2
- package/android/src/main/res/layout/googlepay_mark_button.xml +0 -2
- package/ios/ApplePayViewController.swift +23 -15
- package/ios/Mappers.swift +9 -9
- package/ios/PaymentMethodFactory.swift +1 -1
- package/ios/StripeSdk.m +1 -0
- package/ios/StripeSdk.swift +8 -5
- package/ios/Tests/ApplePayUtilsTests.swift +0 -1
- package/jest/mock.js +6 -0
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/hooks/useApplePay.js +1 -1
- package/lib/commonjs/hooks/useApplePay.js.map +1 -1
- package/lib/commonjs/hooks/usePlatformPay.js +1 -1
- package/lib/commonjs/hooks/usePlatformPay.js.map +1 -1
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/PlatformPay.js.map +1 -1
- package/lib/commonjs/types/PushProvisioning.js.map +1 -1
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/NativeStripeSdk.js.map +1 -1
- package/lib/module/components/AddToWalletButton.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/hooks/useApplePay.js +1 -1
- package/lib/module/hooks/useApplePay.js.map +1 -1
- package/lib/module/hooks/usePlatformPay.js +1 -1
- package/lib/module/hooks/usePlatformPay.js.map +1 -1
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/module/types/PlatformPay.js.map +1 -1
- package/lib/module/types/PushProvisioning.js.map +1 -1
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/src/NativeStripeSdk.d.ts +1 -1
- package/lib/typescript/src/components/AddToWalletButton.d.ts +1 -1
- package/lib/typescript/src/functions.d.ts +8 -2
- package/lib/typescript/src/hooks/usePlatformPay.d.ts +6 -0
- package/lib/typescript/src/hooks/useStripe.d.ts +1 -0
- package/lib/typescript/src/index.d.ts +22 -11
- package/lib/typescript/src/types/PaymentSheet.d.ts +1 -1
- package/lib/typescript/src/types/PlatformPay.d.ts +6 -1
- package/lib/typescript/src/types/PushProvisioning.d.ts +1 -1
- package/lib/typescript/src/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/NativeStripeSdk.tsx +3 -2
- package/src/components/AddToWalletButton.tsx +1 -1
- package/src/functions.ts +35 -4
- package/src/hooks/useApplePay.tsx +1 -2
- package/src/hooks/usePlatformPay.tsx +19 -0
- package/src/hooks/useStripe.tsx +11 -0
- package/src/index.tsx +22 -36
- package/src/types/PaymentSheet.ts +1 -1
- package/src/types/PlatformPay.ts +9 -1
- package/src/types/PushProvisioning.ts +1 -1
- package/src/types/index.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["APPLE_PAY_NOT_SUPPORTED_MESSAGE","createPaymentMethod","params","options","NativeStripeSdk","paymentMethod","error","createToken","type","country","toLowerCase","routingNumber","MissingRoutingNumber","token","retrievePaymentIntent","clientSecret","paymentIntent","retrieveSetupIntent","setupIntent","confirmPayment","paymentIntentClientSecret","isApplePaySupported","isiOS","presentApplePay","code","ApplePayError","Canceled","message","updateApplePaySummaryItems","summaryItems","errorAddressFields","confirmApplePayPayment","handleNextAction","returnURL","Platform","OS","createError","confirmSetupIntent","createTokenForCVCUpdate","cvc","tokenId","handleURLCallback","url","stripeHandled","verifyMicrodepositsForPayment","verifyMicrodeposits","verifyMicrodepositsForSetup","initPaymentSheet","paymentOption","presentPaymentSheet","confirmPaymentSheetPayment","resetPaymentSheetCustomer","isGooglePaySupported","isAndroid","initGooglePay","presentGooglePay","createGooglePayPaymentMethod","openApplePaySetup","collectBankAccountForPayment","collectBankAccount","collectBankAccountForSetup","collectBankAccountToken","session","collectFinancialConnectionsAccounts","canAddCardToWallet","canAddCard","details","isCardInWallet","isInWallet","Constants","getConstants","isPlatformPaySupported","confirmPlatformPaySetupIntent","confirmPlatformPay","confirmPlatformPayPayment","dismissPlatformPay","didDismiss","createPlatformPayPaymentMethod","updatePlatformPaySheet","applePay","cartItems","shippingMethods","errors","openPlatformPaySetup"],"sources":["functions.ts"],"sourcesContent":["import { isAndroid, isiOS, createError } from './helpers';\nimport { MissingRoutingNumber } from './types/Errors';\nimport NativeStripeSdk from './NativeStripeSdk';\nimport {\n ApplePay,\n ApplePayError,\n ApplePayResult,\n PlatformPayError,\n ConfirmPaymentResult,\n ConfirmPaymentSheetPaymentResult,\n SetupIntent,\n PaymentIntent,\n ConfirmSetupIntentResult,\n CreatePaymentMethodResult,\n CreateTokenForCVCUpdateResult,\n CreateTokenResult,\n GooglePayInitResult,\n HandleNextActionResult,\n InitPaymentSheetResult,\n PaymentMethod,\n PaymentSheet,\n PayWithGooglePayResult,\n PresentPaymentSheetResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n StripeError,\n GooglePay,\n CreateGooglePayPaymentMethodResult,\n OpenApplePaySetupResult,\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 { Platform } from 'react-native';\n\nconst APPLE_PAY_NOT_SUPPORTED_MESSAGE =\n 'Apple pay is not supported on this device';\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/** @deprecated Use `isPlatformPaySupported` instead. */\nexport const isApplePaySupported = async (): Promise<boolean> => {\n return isiOS && (await NativeStripeSdk.isApplePaySupported());\n};\n\n/** @deprecated Use `confirmPlatformPaySetupIntent`, `confirmPlatformPayPayment`, or `createPlatformPayPaymentMethod` instead. */\nexport const presentApplePay = async (\n params: ApplePay.PresentParams\n): Promise<ApplePayResult> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: {\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n },\n };\n }\n\n try {\n const { paymentMethod, error } = await NativeStripeSdk.presentApplePay(\n params\n );\n if (error) {\n return {\n error,\n };\n }\n return { paymentMethod: paymentMethod! };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/** @deprecated Use `updatePlatformPaySheet` instead. */\nexport const updateApplePaySummaryItems = async (\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }> = []\n): Promise<{ error?: StripeError<ApplePayError> }> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: {\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n },\n };\n }\n\n try {\n await NativeStripeSdk.updateApplePaySummaryItems(\n summaryItems,\n errorAddressFields\n );\n\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/** @deprecated Use `confirmPlatformPaySetupIntent` or `confirmPlatformPayPayment` instead. */\nexport const confirmApplePayPayment = async (\n clientSecret: string\n): Promise<{ error?: StripeError<ApplePayError> }> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: {\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n },\n };\n }\n try {\n await NativeStripeSdk.confirmApplePayPayment(clientSecret);\n return {};\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\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\nexport const handleURLCallback = async (url: string): Promise<boolean> => {\n const stripeHandled = await NativeStripeSdk.handleURLCallback(url);\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\nexport const initPaymentSheet = async (\n params: PaymentSheet.SetupParams\n): Promise<InitPaymentSheetResult> => {\n try {\n const { paymentOption, error } = await NativeStripeSdk.initPaymentSheet(\n params\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentOption,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const presentPaymentSheet =\n async (): Promise<PresentPaymentSheetResult> => {\n try {\n const { paymentOption, error } =\n await NativeStripeSdk.presentPaymentSheet();\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\n/** @deprecated Use `isPlatformPaySupported` instead. */\nexport const isGooglePaySupported = async (\n params?: GooglePay.IsSupportedParams\n): Promise<boolean> => {\n return (\n isAndroid && (await NativeStripeSdk.isGooglePaySupported(params ?? {}))\n );\n};\n\n/** @deprecated Use `confirmPlatformPaySetupIntent`, `confirmPlatformPayPayment`, or `createPlatformPayPaymentMethod` instead. */\nexport const initGooglePay = async (\n params: GooglePay.InitParams\n): Promise<GooglePayInitResult> => {\n try {\n const { error } = await NativeStripeSdk.initGooglePay(params);\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/** @deprecated Use `confirmPlatformPaySetupIntent`, `confirmPlatformPayPayment`, or `createPlatformPayPaymentMethod` instead. */\nexport const presentGooglePay = async (\n params: GooglePay.PresentParams\n): Promise<PayWithGooglePayResult> => {\n try {\n const { error } = await NativeStripeSdk.presentGooglePay(params);\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/** @deprecated Use `createPlatformPayPaymentMethod` instead. */\nexport const createGooglePayPaymentMethod = async (\n params: GooglePay.CreatePaymentMethodParams\n): Promise<CreateGooglePayPaymentMethodResult> => {\n try {\n const { error, paymentMethod } =\n await NativeStripeSdk.createGooglePayPaymentMethod(params);\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\n/** @deprecated Use `openNativePaySetup` instead. */\nexport const openApplePaySetup = async (): Promise<OpenApplePaySetupResult> => {\n try {\n const { error } = await NativeStripeSdk.openApplePaySetup();\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\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) and [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 both `paymentMethod` and `token` fields.\n */\nexport const createPlatformPayPaymentMethod = async (\n params: PlatformPay.PaymentMethodParams\n): Promise<PlatformPay.PaymentMethodResult> => {\n try {\n const { error, paymentMethod, token } =\n await NativeStripeSdk.createPlatformPayPaymentMethod(params);\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentMethod: paymentMethod!,\n token: token!,\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":"s2CAAA,kCACA,sCACA,0EACA,8BAsCA,yCAEA,GAAMA,gCAA+B,CACnC,2CAA2C,CAEtC,GAAMC,oBAAmB,oDAAG,UACjCC,MAAkC,CAEK,IADvCC,QAAoC,2DAAG,CAAC,CAAC,CAEzC,GAAI,CACF,+BAAuCC,yBAAe,CAACH,mBAAmB,CACxEC,MAAM,CACNC,OAAO,CACR,CAHOE,aAAa,uBAAbA,aAAa,CAAEC,KAAK,uBAALA,KAAK,CAI5B,GAAIA,KAAK,CAAE,CACT,MAAO,CACLA,KAAK,CAALA,KACF,CAAC,CACH,CACA,MAAO,CACLD,aAAa,CAAEA,aACjB,CAAC,CACH,CAAE,MAAOC,KAAU,CAAE,CACnB,MAAO,CACLA,KAAK,CAALA,KACF,CAAC,CACH,CACF,CAAC,iBAtBYL,oBAAmB,4CAsB/B,CAAC,gDAEK,GAAMM,YAAW,qDAAG,UACzBL,MAA0B,CACK,qBAC/B,GACEA,MAAM,CAACM,IAAI,GAAK,aAAa,EAC7B,kBAAAN,MAAM,CAACO,OAAO,eAAd,gBAAgBC,WAAW,EAAE,IAAK,IAAI,EACtC,CAACR,MAAM,CAACS,aAAa,CACrB,CACA,MAAO,CACLL,KAAK,CAAEM,4BACT,CAAC,CACH,CAEA,GAAI,CACF,gCAA+BR,yBAAe,CAACG,WAAW,CAACL,MAAM,CAAC,CAA1DW,KAAK,wBAALA,KAAK,CAAEP,KAAK,wBAALA,KAAK,CAEpB,GAAIA,KAAK,CAAE,CACT,MAAO,CACLA,KAAK,CAALA,KACF,CAAC,CACH,CACA,MAAO,CACLO,KAAK,CAAEA,KACT,CAAC,CACH,CAAE,MAAOP,KAAU,CAAE,CACnB,MAAO,CACLA,KAAK,CAALA,KACF,CAAC,CACH,CACF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,eAAe,CAC/B/E,MAAM,CAAC6E,QAAQ,CAACG,MAAM,CACvB,CAED,MAAO,CAAC,CAAC,CACX,CAAE,MAAO5E,KAAU,CAAE,CACnB,MAAO,CACLA,KAAK,CAALA,KACF,CAAC,CACH,CACF,CAAC,iBA1BYwE,uBAAsB,gDA0BlC,CAAC,sDAOK,GAAMK,qBAAoB,sDAAG,WAA2B,CAC7D,GAAIjD,qBAAQ,CAACC,EAAE,GAAK,KAAK,CAAE,CACzB,KAAM/B,yBAAe,CAACqD,iBAAiB,EAAE,CAC3C,CACF,CAAC,iBAJY0B,qBAAoB,4CAIhC,CAAC"}
|
|
1
|
+
{"version":3,"names":["APPLE_PAY_NOT_SUPPORTED_MESSAGE","createPaymentMethod","params","options","NativeStripeSdk","paymentMethod","error","createToken","type","country","toLowerCase","routingNumber","MissingRoutingNumber","token","retrievePaymentIntent","clientSecret","paymentIntent","retrieveSetupIntent","setupIntent","confirmPayment","paymentIntentClientSecret","isApplePaySupported","isiOS","presentApplePay","code","ApplePayError","Canceled","message","updateApplePaySummaryItems","summaryItems","errorAddressFields","confirmApplePayPayment","handleNextAction","returnURL","Platform","OS","createError","confirmSetupIntent","createTokenForCVCUpdate","cvc","tokenId","handleURLCallback","url","stripeHandled","verifyMicrodepositsForPayment","verifyMicrodeposits","verifyMicrodepositsForSetup","initPaymentSheet","paymentOption","presentPaymentSheet","confirmPaymentSheetPayment","resetPaymentSheetCustomer","isGooglePaySupported","isAndroid","initGooglePay","presentGooglePay","createGooglePayPaymentMethod","openApplePaySetup","collectBankAccountForPayment","collectBankAccount","collectBankAccountForSetup","collectBankAccountToken","session","collectFinancialConnectionsAccounts","canAddCardToWallet","canAddCard","details","isCardInWallet","isInWallet","Constants","getConstants","isPlatformPaySupported","confirmPlatformPaySetupIntent","confirmPlatformPay","confirmPlatformPayPayment","dismissPlatformPay","didDismiss","createPlatformPayPaymentMethod","createPlatformPayToken","updatePlatformPaySheet","applePay","cartItems","shippingMethods","errors","openPlatformPaySetup"],"sources":["functions.ts"],"sourcesContent":["import { isAndroid, isiOS, createError } from './helpers';\nimport { MissingRoutingNumber } from './types/Errors';\nimport NativeStripeSdk from './NativeStripeSdk';\nimport {\n ApplePay,\n ApplePayError,\n ApplePayResult,\n PlatformPayError,\n ConfirmPaymentResult,\n ConfirmPaymentSheetPaymentResult,\n SetupIntent,\n PaymentIntent,\n ConfirmSetupIntentResult,\n CreatePaymentMethodResult,\n CreateTokenForCVCUpdateResult,\n CreateTokenResult,\n GooglePayInitResult,\n HandleNextActionResult,\n InitPaymentSheetResult,\n PaymentMethod,\n PaymentSheet,\n PayWithGooglePayResult,\n PresentPaymentSheetResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n StripeError,\n GooglePay,\n CreateGooglePayPaymentMethodResult,\n OpenApplePaySetupResult,\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 { Platform } from 'react-native';\n\nconst APPLE_PAY_NOT_SUPPORTED_MESSAGE =\n 'Apple pay is not supported on this device';\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/** @deprecated Use `isPlatformPaySupported` instead. */\nexport const isApplePaySupported = async (): Promise<boolean> => {\n return isiOS && (await NativeStripeSdk.isApplePaySupported());\n};\n\n/** @deprecated Use `confirmPlatformPaySetupIntent`, `confirmPlatformPayPayment`, or `createPlatformPayPaymentMethod` instead. */\nexport const presentApplePay = async (\n params: ApplePay.PresentParams\n): Promise<ApplePayResult> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: {\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n },\n };\n }\n\n try {\n const { paymentMethod, error } = await NativeStripeSdk.presentApplePay(\n params\n );\n if (error) {\n return {\n error,\n };\n }\n return { paymentMethod: paymentMethod! };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/** @deprecated Use `updatePlatformPaySheet` instead. */\nexport const updateApplePaySummaryItems = async (\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }> = []\n): Promise<{ error?: StripeError<ApplePayError> }> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: {\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n },\n };\n }\n\n try {\n await NativeStripeSdk.updateApplePaySummaryItems(\n summaryItems,\n errorAddressFields\n );\n\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/** @deprecated Use `confirmPlatformPaySetupIntent` or `confirmPlatformPayPayment` instead. */\nexport const confirmApplePayPayment = async (\n clientSecret: string\n): Promise<{ error?: StripeError<ApplePayError> }> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: {\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n },\n };\n }\n try {\n await NativeStripeSdk.confirmApplePayPayment(clientSecret);\n return {};\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\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\nexport const handleURLCallback = async (url: string): Promise<boolean> => {\n const stripeHandled = await NativeStripeSdk.handleURLCallback(url);\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\nexport const initPaymentSheet = async (\n params: PaymentSheet.SetupParams\n): Promise<InitPaymentSheetResult> => {\n try {\n const { paymentOption, error } = await NativeStripeSdk.initPaymentSheet(\n params\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentOption,\n };\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\nexport const presentPaymentSheet =\n async (): Promise<PresentPaymentSheetResult> => {\n try {\n const { paymentOption, error } =\n await NativeStripeSdk.presentPaymentSheet();\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\n/** @deprecated Use `isPlatformPaySupported` instead. */\nexport const isGooglePaySupported = async (\n params?: GooglePay.IsSupportedParams\n): Promise<boolean> => {\n return (\n isAndroid && (await NativeStripeSdk.isGooglePaySupported(params ?? {}))\n );\n};\n\n/** @deprecated Use `confirmPlatformPaySetupIntent`, `confirmPlatformPayPayment`, or `createPlatformPayPaymentMethod` instead. */\nexport const initGooglePay = async (\n params: GooglePay.InitParams\n): Promise<GooglePayInitResult> => {\n try {\n const { error } = await NativeStripeSdk.initGooglePay(params);\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/** @deprecated Use `confirmPlatformPaySetupIntent`, `confirmPlatformPayPayment`, or `createPlatformPayPaymentMethod` instead. */\nexport const presentGooglePay = async (\n params: GooglePay.PresentParams\n): Promise<PayWithGooglePayResult> => {\n try {\n const { error } = await NativeStripeSdk.presentGooglePay(params);\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\n};\n\n/** @deprecated Use `createPlatformPayPaymentMethod` instead. */\nexport const createGooglePayPaymentMethod = async (\n params: GooglePay.CreatePaymentMethodParams\n): Promise<CreateGooglePayPaymentMethodResult> => {\n try {\n const { error, paymentMethod } =\n await NativeStripeSdk.createGooglePayPaymentMethod(params);\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\n/** @deprecated Use `openNativePaySetup` instead. */\nexport const openApplePaySetup = async (): Promise<OpenApplePaySetupResult> => {\n try {\n const { error } = await NativeStripeSdk.openApplePaySetup();\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error: any) {\n return {\n error,\n };\n }\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 } =\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 };\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 } =\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 };\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"],"mapp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,CAEK,CACJ,GAAIgC,qBAAQ,CAACC,EAAE,GAAK,KAAK,CAAE,CACzB,MAAO,CAAC,CAAC,CACX,CAEA,GAAI,CACF,KAAM/B,yBAAe,CAAC2E,sBAAsB,CAC1C7E,MAAM,CAAC8E,QAAQ,CAACC,SAAS,CACzB/E,MAAM,CAAC8E,QAAQ,CAACE,eAAe,CAC/BhF,MAAM,CAAC8E,QAAQ,CAACG,MAAM,CACvB,CAED,MAAO,CAAC,CAAC,CACX,CAAE,MAAO7E,KAAU,CAAE,CACnB,MAAO,CACLA,KAAK,CAALA,KACF,CAAC,CACH,CACF,CAAC,iBA1BYyE,uBAAsB,gDA0BlC,CAAC,sDAOK,GAAMK,qBAAoB,sDAAG,WAA2B,CAC7D,GAAIlD,qBAAQ,CAACC,EAAE,GAAK,KAAK,CAAE,CACzB,KAAM/B,yBAAe,CAACqD,iBAAiB,EAAE,CAC3C,CACF,CAAC,iBAJY2B,qBAAoB,4CAIhC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useApplePay=useApplePay;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _useStripe2=require("./useStripe");var _reactNative=require("react-native");var
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useApplePay=useApplePay;var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _useStripe2=require("./useStripe");var _reactNative=require("react-native");var SET_SHIPPING_METHOD_CALLBACK_NAME='onDidSetShippingMethod';var SET_SHIPPING_CONTACT_CALLBACK_NAME='onDidSetShippingContact';function useApplePay(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},onShippingMethodSelected=_ref.onShippingMethodSelected,onShippingContactSelected=_ref.onShippingContactSelected;var _useStripe=(0,_useStripe2.useStripe)(),isApplePaySupported=_useStripe.isApplePaySupported,_presentApplePay=_useStripe.presentApplePay,_confirmApplePayPayment=_useStripe.confirmApplePayPayment,updateApplePaySummaryItems=_useStripe.updateApplePaySummaryItems,_openApplePaySetup=_useStripe.openApplePaySetup;var _useState=(0,_react.useState)(null),_useState2=(0,_slicedToArray2.default)(_useState,2),items=_useState2[0],setItems=_useState2[1];var _useState3=(0,_react.useState)(false),_useState4=(0,_slicedToArray2.default)(_useState3,2),loading=_useState4[0],setLoading=_useState4[1];var onDidSetShippingMethod=(0,_react.useCallback)(function(result){if(onShippingMethodSelected){onShippingMethodSelected(result.shippingMethod,updateApplePaySummaryItems);}else{updateApplePaySummaryItems(items);}},[items,onShippingMethodSelected,updateApplePaySummaryItems]);var onDidSetShippingContact=(0,_react.useCallback)(function(result){if(onShippingContactSelected){onShippingContactSelected(result.shippingContact,updateApplePaySummaryItems);}else{updateApplePaySummaryItems(items);}},[items,onShippingContactSelected,updateApplePaySummaryItems]);(0,_react.useEffect)(function(){var eventEmitter=new _reactNative.NativeEventEmitter(_reactNative.NativeModules.StripeSdk);var didSetShippingMethodListener=eventEmitter.addListener(SET_SHIPPING_METHOD_CALLBACK_NAME,onDidSetShippingMethod);var didSetShippingContactListener=eventEmitter.addListener(SET_SHIPPING_CONTACT_CALLBACK_NAME,onDidSetShippingContact);return function(){didSetShippingMethodListener.remove();didSetShippingContactListener.remove();};},[onDidSetShippingContact,onDidSetShippingMethod]);var presentApplePay=(0,_react.useCallback)(function(){var _ref2=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);setItems(params.cartItems);var result=yield _presentApplePay(params);if(result.error){setItems(null);}setLoading(false);return result;});return function(_x){return _ref2.apply(this,arguments);};}(),[_presentApplePay]);var openApplePaySetup=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){setLoading(true);var result=yield _openApplePaySetup();setLoading(false);return result;}),[_openApplePaySetup]);var confirmApplePayPayment=(0,_react.useCallback)(function(){var _ref4=(0,_asyncToGenerator2.default)(function*(clientSecret){setLoading(true);var result=yield _confirmApplePayPayment(clientSecret);setItems(null);setLoading(false);return result;});return function(_x2){return _ref4.apply(this,arguments);};}(),[_confirmApplePayPayment]);return{loading:loading,presentApplePay:presentApplePay,confirmApplePayPayment:confirmApplePayPayment,isApplePaySupported:isApplePaySupported,openApplePaySetup:openApplePaySetup};}
|
|
2
2
|
//# sourceMappingURL=useApplePay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["SET_SHIPPING_METHOD_CALLBACK_NAME","SET_SHIPPING_CONTACT_CALLBACK_NAME","useApplePay","onShippingMethodSelected","onShippingContactSelected","useStripe","isApplePaySupported","_presentApplePay","presentApplePay","_confirmApplePayPayment","confirmApplePayPayment","updateApplePaySummaryItems","_openApplePaySetup","openApplePaySetup","useState","items","setItems","loading","setLoading","onDidSetShippingMethod","useCallback","result","shippingMethod","onDidSetShippingContact","shippingContact","useEffect","eventEmitter","NativeEventEmitter","NativeModules","StripeSdk","didSetShippingMethodListener","addListener","didSetShippingContactListener","remove","params","cartItems","error","clientSecret"],"sources":["useApplePay.tsx"],"sourcesContent":["import type { ApplePay, ApplePayError, StripeError } from '../types';\nimport { useCallback, useEffect, useState } from 'react';\nimport { useStripe } from './useStripe';\nimport { NativeEventEmitter, NativeModules } from 'react-native';\n\nexport interface Props {\n /**\n *\n * @example\n * ```ts\n * const { presentApplePay } = useApplePay({\n * onShippingMethodSelected: (shippingMethod, handler) => {\n * handler([\n * { label: 'Example item name 1', amount: '11.00' },\n * { label: 'Example item name 2', amount: '25.00' },\n * ]);\n * }\n * })\n * ```\n */\n onShippingMethodSelected?: (\n shippingMethod: ApplePay.ShippingMethod,\n handler: (summaryItems: ApplePay.CartSummaryItem[]) => Promise<{\n error?: StripeError<ApplePayError>;\n }>\n ) => void;\n /**\n *\n * @example\n * ```ts\n * const { presentApplePay } = useApplePay({\n * onShippingContactSelected: (shippingContact, handler) => {\n * handler([\n * { label: 'Example item name 1', amount: '11.00' },\n * { label: 'Example item name 2', amount: '25.00' },\n * ], [\n * { field: 'city', message: 'city error' },\n * ]);\n * }\n * })\n * ```\n */\n onShippingContactSelected?: (\n shippingContact: ApplePay.ShippingContact,\n handler: (\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields?: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }>\n ) => Promise<{\n error?: StripeError<ApplePayError>;\n }>\n ) => void;\n}\n\nconst SET_SHIPPING_METHOD_CALLBACK_NAME = 'onDidSetShippingMethod';\nconst SET_SHIPPING_CONTACT_CALLBACK_NAME = 'onDidSetShippingContact';\n\n/**\n * useApplePay hook\n */\nexport function useApplePay({\n onShippingMethodSelected,\n onShippingContactSelected,\n}: Props = {}) {\n const {\n isApplePaySupported,\n presentApplePay: _presentApplePay,\n confirmApplePayPayment: _confirmApplePayPayment,\n updateApplePaySummaryItems,\n openApplePaySetup: _openApplePaySetup,\n } = useStripe();\n const [items, setItems] = useState<ApplePay.CartSummaryItem[] | null>(null);\n const [loading, setLoading] = useState(false);\n\n const onDidSetShippingMethod = useCallback(\n (result: { shippingMethod: ApplePay.ShippingMethod }) => {\n if (onShippingMethodSelected) {\n onShippingMethodSelected(\n result.shippingMethod,\n updateApplePaySummaryItems\n );\n } else {\n updateApplePaySummaryItems(items as ApplePay.CartSummaryItem[]);\n }\n },\n [items, onShippingMethodSelected, updateApplePaySummaryItems]\n );\n\n const onDidSetShippingContact = useCallback(\n (result: { shippingContact: ApplePay.ShippingContact }) => {\n if (onShippingContactSelected) {\n onShippingContactSelected(\n result.shippingContact,\n updateApplePaySummaryItems\n );\n } else {\n updateApplePaySummaryItems(items as ApplePay.CartSummaryItem[]);\n }\n },\n [items, onShippingContactSelected, updateApplePaySummaryItems]\n );\n\n useEffect(() => {\n const eventEmitter = new NativeEventEmitter(NativeModules.StripeSdk);\n const didSetShippingMethodListener = eventEmitter.addListener(\n SET_SHIPPING_METHOD_CALLBACK_NAME,\n onDidSetShippingMethod\n );\n const didSetShippingContactListener = eventEmitter.addListener(\n SET_SHIPPING_CONTACT_CALLBACK_NAME,\n onDidSetShippingContact\n );\n\n return () => {\n didSetShippingMethodListener.remove();\n didSetShippingContactListener.remove();\n };\n }, [onDidSetShippingContact, onDidSetShippingMethod]);\n\n const presentApplePay = useCallback(\n async (params: ApplePay.PresentParams) => {\n setLoading(true);\n setItems(params.cartItems);\n const result = await _presentApplePay(params);\n if (result.error) {\n setItems(null);\n }\n setLoading(false);\n return result;\n },\n [_presentApplePay]\n );\n\n const openApplePaySetup = useCallback(async () => {\n setLoading(true);\n const result = await _openApplePaySetup();\n setLoading(false);\n return result;\n }, [_openApplePaySetup]);\n\n const confirmApplePayPayment = useCallback(\n async (clientSecret: string) => {\n setLoading(true);\n const result = await _confirmApplePayPayment(clientSecret);\n setItems(null);\n setLoading(false);\n return result;\n },\n [_confirmApplePayPayment]\n );\n\n return {\n loading,\n presentApplePay,\n confirmApplePayPayment,\n isApplePaySupported,\n openApplePaySetup,\n };\n}\n"],"mappings":"0WACA,4BACA,uCACA,yCAqDA,GAAMA,kCAAiC,CAAG,wBAAwB,CAClE,GAAMC,mCAAkC,CAAG,yBAAyB,CAK7D,QAASC,YAAW,EAGZ,oEAAJ,CAAC,CAAC,CAFXC,wBAAwB,MAAxBA,wBAAwB,CACxBC,yBAAyB,MAAzBA,yBAAyB,CAEzB,eAMI,GAAAC,qBAAS,GAAE,CALbC,mBAAmB,YAAnBA,mBAAmB,CACFC,gBAAgB,YAAjCC,eAAe,CACSC,uBAAuB,YAA/CC,sBAAsB,CACtBC,0BAA0B,YAA1BA,0BAA0B,CACPC,kBAAkB,YAArCC,iBAAiB,CAEnB,cAA0B,GAAAC,eAAQ,EAAoC,IAAI,CAAC,qDAApEC,KAAK,e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,CAACC,SAAS,CAAC,CAC1B,GAAMd,OAAM,MAASd,iBAAgB,CAAC2B,MAAM,CAAC,CAC7C,GAAIb,MAAM,CAACe,KAAK,CAAE,CAChBpB,QAAQ,CAAC,IAAI,CAAC,CAChB,CACAE,UAAU,CAAC,KAAK,CAAC,CACjB,MAAOG,OAAM,CACf,CAAC,+DACD,CAACd,gBAAgB,CAAC,CACnB,CAED,GAAMM,kBAAiB,CAAG,GAAAO,kBAAW,iCAAC,WAAY,CAChDF,UAAU,CAAC,IAAI,CAAC,CAChB,GAAMG,OAAM,MAAST,mBAAkB,EAAE,CACzCM,UAAU,CAAC,KAAK,CAAC,CACjB,MAAOG,OAAM,CACf,CAAC,EAAE,CAACT,kBAAkB,CAAC,CAAC,CAExB,GAAMF,uBAAsB,CAAG,GAAAU,kBAAW,sDACxC,UAAOiB,YAAoB,CAAK,CAC9BnB,UAAU,CAAC,IAAI,CAAC,CAChB,GAAMG,OAAM,MAASZ,wBAAuB,CAAC4B,YAAY,CAAC,CAC1DrB,QAAQ,CAAC,IAAI,CAAC,CACdE,UAAU,CAAC,KAAK,CAAC,CACjB,MAAOG,OAAM,CACf,CAAC,gEACD,CAACZ,uBAAuB,CAAC,CAC1B,CAED,MAAO,CACLQ,OAAO,CAAPA,OAAO,CACPT,eAAe,CAAfA,eAAe,CACfE,sBAAsB,CAAtBA,sBAAsB,CACtBJ,mBAAmB,CAAnBA,mBAAmB,CACnBO,iBAAiB,CAAjBA,iBACF,CAAC,CACH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.usePlatformPay=usePlatformPay;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 usePlatformPay(){var _useStripe=(0,_useStripe2.useStripe)(),isPlatformPaySupported=_useStripe.isPlatformPaySupported,confirmPlatformPaySetupIntent=_useStripe.confirmPlatformPaySetupIntent,confirmPlatformPayPayment=_useStripe.confirmPlatformPayPayment,createPlatformPayPaymentMethod=_useStripe.createPlatformPayPaymentMethod,dismissPlatformPay=_useStripe.dismissPlatformPay,updatePlatformPaySheet=_useStripe.updatePlatformPaySheet,canAddCardToWallet=_useStripe.canAddCardToWallet,openPlatformPaySetup=_useStripe.openPlatformPaySetup;var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var _isPlatformPaySupported=(0,_react.useCallback)(function(){var _ref=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);var result=yield isPlatformPaySupported(params);setLoading(false);return result;});return function(_x){return _ref.apply(this,arguments);};}(),[isPlatformPaySupported]);var _confirmPlatformPaySetupIntent=(0,_react.useCallback)(function(){var _ref2=(0,_asyncToGenerator2.default)(function*(clientSecret,params){setLoading(true);var result=yield confirmPlatformPaySetupIntent(clientSecret,params);setLoading(false);return result;});return function(_x2,_x3){return _ref2.apply(this,arguments);};}(),[confirmPlatformPaySetupIntent]);var _confirmPlatformPayPayment=(0,_react.useCallback)(function(){var _ref3=(0,_asyncToGenerator2.default)(function*(clientSecret,params){setLoading(true);var result=yield confirmPlatformPayPayment(clientSecret,params);setLoading(false);return result;});return function(_x4,_x5){return _ref3.apply(this,arguments);};}(),[confirmPlatformPayPayment]);var _createPlatformPayPaymentMethod=(0,_react.useCallback)(function(){var _ref4=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);var result=yield createPlatformPayPaymentMethod(params);setLoading(false);return result;});return function(_x6){return _ref4.apply(this,arguments);};}(),[createPlatformPayPaymentMethod]);var _dismissPlatformPay=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){setLoading(true);var result=yield dismissPlatformPay();setLoading(false);return result;}),[dismissPlatformPay]);var _updatePlatformPaySheet=(0,_react.useCallback)(function(){var
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.usePlatformPay=usePlatformPay;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 usePlatformPay(){var _useStripe=(0,_useStripe2.useStripe)(),isPlatformPaySupported=_useStripe.isPlatformPaySupported,confirmPlatformPaySetupIntent=_useStripe.confirmPlatformPaySetupIntent,confirmPlatformPayPayment=_useStripe.confirmPlatformPayPayment,createPlatformPayPaymentMethod=_useStripe.createPlatformPayPaymentMethod,createPlatformPayToken=_useStripe.createPlatformPayToken,dismissPlatformPay=_useStripe.dismissPlatformPay,updatePlatformPaySheet=_useStripe.updatePlatformPaySheet,canAddCardToWallet=_useStripe.canAddCardToWallet,openPlatformPaySetup=_useStripe.openPlatformPaySetup;var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var _isPlatformPaySupported=(0,_react.useCallback)(function(){var _ref=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);var result=yield isPlatformPaySupported(params);setLoading(false);return result;});return function(_x){return _ref.apply(this,arguments);};}(),[isPlatformPaySupported]);var _confirmPlatformPaySetupIntent=(0,_react.useCallback)(function(){var _ref2=(0,_asyncToGenerator2.default)(function*(clientSecret,params){setLoading(true);var result=yield confirmPlatformPaySetupIntent(clientSecret,params);setLoading(false);return result;});return function(_x2,_x3){return _ref2.apply(this,arguments);};}(),[confirmPlatformPaySetupIntent]);var _confirmPlatformPayPayment=(0,_react.useCallback)(function(){var _ref3=(0,_asyncToGenerator2.default)(function*(clientSecret,params){setLoading(true);var result=yield confirmPlatformPayPayment(clientSecret,params);setLoading(false);return result;});return function(_x4,_x5){return _ref3.apply(this,arguments);};}(),[confirmPlatformPayPayment]);var _createPlatformPayPaymentMethod=(0,_react.useCallback)(function(){var _ref4=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);var result=yield createPlatformPayPaymentMethod(params);setLoading(false);return result;});return function(_x6){return _ref4.apply(this,arguments);};}(),[createPlatformPayPaymentMethod]);var _createPlatformPayToken=(0,_react.useCallback)(function(){var _ref5=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);var result=yield createPlatformPayToken(params);setLoading(false);return result;});return function(_x7){return _ref5.apply(this,arguments);};}(),[createPlatformPayToken]);var _dismissPlatformPay=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){setLoading(true);var result=yield dismissPlatformPay();setLoading(false);return result;}),[dismissPlatformPay]);var _updatePlatformPaySheet=(0,_react.useCallback)(function(){var _ref7=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);var result=yield updatePlatformPaySheet(params);setLoading(false);return result;});return function(_x8){return _ref7.apply(this,arguments);};}(),[updatePlatformPaySheet]);var _canAddCardToWallet=(0,_react.useCallback)(function(){var _ref8=(0,_asyncToGenerator2.default)(function*(params){setLoading(true);var result=yield canAddCardToWallet(params);setLoading(false);return result;});return function(_x9){return _ref8.apply(this,arguments);};}(),[canAddCardToWallet]);var _openPlatformPaySetup=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return openPlatformPaySetup();}),[openPlatformPaySetup]);return{loading:loading,isPlatformPaySupported:_isPlatformPaySupported,confirmPlatformPaySetupIntent:_confirmPlatformPaySetupIntent,confirmPlatformPayPayment:_confirmPlatformPayPayment,createPlatformPayPaymentMethod:_createPlatformPayPaymentMethod,createPlatformPayToken:_createPlatformPayToken,dismissPlatformPay:_dismissPlatformPay,updatePlatformPaySheet:_updatePlatformPaySheet,canAddCardToWallet:_canAddCardToWallet,openPlatformPaySetup:_openPlatformPaySetup};}
|
|
2
2
|
//# sourceMappingURL=usePlatformPay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["usePlatformPay","useStripe","isPlatformPaySupported","confirmPlatformPaySetupIntent","confirmPlatformPayPayment","createPlatformPayPaymentMethod","dismissPlatformPay","updatePlatformPaySheet","canAddCardToWallet","openPlatformPaySetup","useState","loading","setLoading","_isPlatformPaySupported","useCallback","params","result","_confirmPlatformPaySetupIntent","clientSecret","_confirmPlatformPayPayment","_createPlatformPayPaymentMethod","_dismissPlatformPay","_updatePlatformPaySheet","_canAddCardToWallet","_openPlatformPaySetup"],"sources":["usePlatformPay.tsx"],"sourcesContent":["import { useCallback, useState } from 'react';\nimport type {\n PlatformPay,\n CanAddCardToWalletParams,\n CanAddCardToWalletResult,\n} from '../types';\nimport { useStripe } from './useStripe';\n\n/**\n * usePlatformPay hook. Access all Apple and Google Pay functionality with this hook.\n */\nexport function usePlatformPay() {\n const {\n isPlatformPaySupported,\n confirmPlatformPaySetupIntent,\n confirmPlatformPayPayment,\n createPlatformPayPaymentMethod,\n dismissPlatformPay,\n updatePlatformPaySheet,\n canAddCardToWallet,\n openPlatformPaySetup,\n } = useStripe();\n const [loading, setLoading] = useState(false);\n\n const _isPlatformPaySupported = useCallback(\n async (params?: { googlePay?: PlatformPay.IsGooglePaySupportedParams }) => {\n setLoading(true);\n\n const result = await isPlatformPaySupported(params);\n setLoading(false);\n\n return result;\n },\n [isPlatformPaySupported]\n );\n\n const _confirmPlatformPaySetupIntent = useCallback(\n async (clientSecret: string, params: PlatformPay.ConfirmParams) => {\n setLoading(true);\n\n const result = await confirmPlatformPaySetupIntent(clientSecret, params);\n setLoading(false);\n\n return result;\n },\n [confirmPlatformPaySetupIntent]\n );\n\n const _confirmPlatformPayPayment = useCallback(\n async (clientSecret: string, params: PlatformPay.ConfirmParams) => {\n setLoading(true);\n\n const result = await confirmPlatformPayPayment(clientSecret, params);\n setLoading(false);\n\n return result;\n },\n [confirmPlatformPayPayment]\n );\n\n const _createPlatformPayPaymentMethod = useCallback(\n async (params: PlatformPay.PaymentMethodParams) => {\n setLoading(true);\n\n const result = await createPlatformPayPaymentMethod(params);\n setLoading(false);\n\n return result;\n },\n [createPlatformPayPaymentMethod]\n );\n\n const _dismissPlatformPay = useCallback(async () => {\n setLoading(true);\n\n const result = await dismissPlatformPay();\n setLoading(false);\n\n return result;\n }, [dismissPlatformPay]);\n\n const _updatePlatformPaySheet = useCallback(\n async (params: {\n applePay: {\n cartItems: Array<PlatformPay.CartSummaryItem>;\n shippingMethods: Array<PlatformPay.ShippingMethod>;\n errors: Array<PlatformPay.ApplePaySheetError>;\n };\n }) => {\n setLoading(true);\n\n const result = await updatePlatformPaySheet(params);\n setLoading(false);\n\n return result;\n },\n [updatePlatformPaySheet]\n );\n\n const _canAddCardToWallet = useCallback(\n async (\n params: CanAddCardToWalletParams\n ): Promise<CanAddCardToWalletResult> => {\n setLoading(true);\n\n const result = await canAddCardToWallet(params);\n setLoading(false);\n\n return result;\n },\n [canAddCardToWallet]\n );\n\n const _openPlatformPaySetup = useCallback(async (): Promise<void> => {\n return openPlatformPaySetup();\n }, [openPlatformPaySetup]);\n\n return {\n /** Use this boolean to present a spinner or other similar loading screen. `true` if the SDK is currently processing, `false` if it is not. */\n loading,\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 */\n isPlatformPaySupported: _isPlatformPaySupported,\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 */\n confirmPlatformPaySetupIntent: _confirmPlatformPaySetupIntent,\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 */\n confirmPlatformPayPayment: _confirmPlatformPayPayment,\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) and [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 both `paymentMethod` and `token` fields.\n */\n createPlatformPayPaymentMethod: _createPlatformPayPaymentMethod,\n /**\n * Dismiss the Apple Pay sheet if it is open. iOS only, this is a no-op on Android.\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 */\n dismissPlatformPay: _dismissPlatformPay,\n /**\n * 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 cartItems An array of payment summary items to display in the Apple Pay sheet.\n * @param shippingMethods An array of shipping methods to display in the Apple Pay sheet.\n * @param 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 */\n updatePlatformPaySheet: _updatePlatformPaySheet,\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 */\n canAddCardToWallet: _canAddCardToWallet,\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 */\n openPlatformPaySetup: _openPlatformPaySetup,\n };\n}\n"],"mappings":"gXAAA,4BAMA,uCAKO,QAASA,eAAc,EAAG,CAC/B,eASI,GAAAC,qBAAS,GAAE,CARbC,sBAAsB,YAAtBA,sBAAsB,CACtBC,6BAA6B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AMvCd,oBAAoB,CAAEe,qBACxB,CAAC,CACH"}
|
|
1
|
+
{"version":3,"names":["usePlatformPay","useStripe","isPlatformPaySupported","confirmPlatformPaySetupIntent","confirmPlatformPayPayment","createPlatformPayPaymentMethod","createPlatformPayToken","dismissPlatformPay","updatePlatformPaySheet","canAddCardToWallet","openPlatformPaySetup","useState","loading","setLoading","_isPlatformPaySupported","useCallback","params","result","_confirmPlatformPaySetupIntent","clientSecret","_confirmPlatformPayPayment","_createPlatformPayPaymentMethod","_createPlatformPayToken","_dismissPlatformPay","_updatePlatformPaySheet","_canAddCardToWallet","_openPlatformPaySetup"],"sources":["usePlatformPay.tsx"],"sourcesContent":["import { useCallback, useState } from 'react';\nimport type {\n PlatformPay,\n CanAddCardToWalletParams,\n CanAddCardToWalletResult,\n} from '../types';\nimport { useStripe } from './useStripe';\n\n/**\n * usePlatformPay hook. Access all Apple and Google Pay functionality with this hook.\n */\nexport function usePlatformPay() {\n const {\n isPlatformPaySupported,\n confirmPlatformPaySetupIntent,\n confirmPlatformPayPayment,\n createPlatformPayPaymentMethod,\n createPlatformPayToken,\n dismissPlatformPay,\n updatePlatformPaySheet,\n canAddCardToWallet,\n openPlatformPaySetup,\n } = useStripe();\n const [loading, setLoading] = useState(false);\n\n const _isPlatformPaySupported = useCallback(\n async (params?: { googlePay?: PlatformPay.IsGooglePaySupportedParams }) => {\n setLoading(true);\n\n const result = await isPlatformPaySupported(params);\n setLoading(false);\n\n return result;\n },\n [isPlatformPaySupported]\n );\n\n const _confirmPlatformPaySetupIntent = useCallback(\n async (clientSecret: string, params: PlatformPay.ConfirmParams) => {\n setLoading(true);\n\n const result = await confirmPlatformPaySetupIntent(clientSecret, params);\n setLoading(false);\n\n return result;\n },\n [confirmPlatformPaySetupIntent]\n );\n\n const _confirmPlatformPayPayment = useCallback(\n async (clientSecret: string, params: PlatformPay.ConfirmParams) => {\n setLoading(true);\n\n const result = await confirmPlatformPayPayment(clientSecret, params);\n setLoading(false);\n\n return result;\n },\n [confirmPlatformPayPayment]\n );\n\n const _createPlatformPayPaymentMethod = useCallback(\n async (params: PlatformPay.PaymentMethodParams) => {\n setLoading(true);\n\n const result = await createPlatformPayPaymentMethod(params);\n setLoading(false);\n\n return result;\n },\n [createPlatformPayPaymentMethod]\n );\n\n const _createPlatformPayToken = useCallback(\n async (params: PlatformPay.PaymentMethodParams) => {\n setLoading(true);\n\n const result = await createPlatformPayToken(params);\n setLoading(false);\n\n return result;\n },\n [createPlatformPayToken]\n );\n\n const _dismissPlatformPay = useCallback(async () => {\n setLoading(true);\n\n const result = await dismissPlatformPay();\n setLoading(false);\n\n return result;\n }, [dismissPlatformPay]);\n\n const _updatePlatformPaySheet = useCallback(\n async (params: {\n applePay: {\n cartItems: Array<PlatformPay.CartSummaryItem>;\n shippingMethods: Array<PlatformPay.ShippingMethod>;\n errors: Array<PlatformPay.ApplePaySheetError>;\n };\n }) => {\n setLoading(true);\n\n const result = await updatePlatformPaySheet(params);\n setLoading(false);\n\n return result;\n },\n [updatePlatformPaySheet]\n );\n\n const _canAddCardToWallet = useCallback(\n async (\n params: CanAddCardToWalletParams\n ): Promise<CanAddCardToWalletResult> => {\n setLoading(true);\n\n const result = await canAddCardToWallet(params);\n setLoading(false);\n\n return result;\n },\n [canAddCardToWallet]\n );\n\n const _openPlatformPaySetup = useCallback(async (): Promise<void> => {\n return openPlatformPaySetup();\n }, [openPlatformPaySetup]);\n\n return {\n /** Use this boolean to present a spinner or other similar loading screen. `true` if the SDK is currently processing, `false` if it is not. */\n loading,\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 */\n isPlatformPaySupported: _isPlatformPaySupported,\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 */\n confirmPlatformPaySetupIntent: _confirmPlatformPaySetupIntent,\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 */\n confirmPlatformPayPayment: _confirmPlatformPayPayment,\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) and [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 both `paymentMethod` and `token` fields.\n */\n createPlatformPayPaymentMethod: _createPlatformPayPaymentMethod,\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 */\n createPlatformPayToken: _createPlatformPayToken,\n /**\n * Dismiss the Apple Pay sheet if it is open. iOS only, this is a no-op on Android.\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 */\n dismissPlatformPay: _dismissPlatformPay,\n /**\n * 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 cartItems An array of payment summary items to display in the Apple Pay sheet.\n * @param shippingMethods An array of shipping methods to display in the Apple Pay sheet.\n * @param 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 */\n updatePlatformPaySheet: _updatePlatformPaySheet,\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 */\n canAddCardToWallet: _canAddCardToWallet,\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 */\n openPlatformPaySetup: _openPlatformPaySetup,\n };\n}\n"],"mappings":"gXAAA,4BAMA,uCAKO,QAASA,eAAc,EAAG,CAC/B,eAUI,GAAAC,qBAAS,GAAE,CATbC,sBAAsB,YAAtBA,sBAAsB,CACtBC,6BAA6B,YAA7BA,6BAA6B,CAC7BC,yBAAyB,YAAzBA,yBAAyB,CACzBC,8BAA8B,YAA9BA,8BAA8B,CAC9BC,sBAAsB,YAAtBA,sBAAsB,CACtBC,kBAAkB,YAAlBA,kBAAkB,CAClBC,sBAAsB,YAAtBA,sBAAsB,CACtBC,kBAAkB,YAAlBA,kBAAkB,CAClBC,oBAAoB,YAApBA,oBAAoB,CAEtB,cAA8B,GAAAC,eAAQ,EAAC,KAAK,CAAC,qDAAtCC,OAAO,eAAEC,UAAU,eAE1B,GAAMC,wBAAuB,CAAG,GAAAC,kBAAW,qDACzC,UAAOC,MAA+D,CAAK,CACzEH,UAAU,CAAC,IAAI,CAAC,CAEhB,GAAMI,OAAM,MAASf,uBAAsB,CAACc,MAAM,CAAC,CACnDH,UAAU,CAAC,KAAK,CAAC,CAEjB,MAAOI,OAAM,CACf,CAAC,8DACD,CAACf,sBAAsB,CAAC,CACzB,CAED,GAAMgB,+BAA8B,CAAG,GAAAH,kBAAW,sDAChD,UAAOI,YAAoB,CAAEH,MAAiC,CAAK,CACjEH,UAAU,CAAC,IAAI,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MN,CAAK,CACJH,UAAU,CAAC,IAAI,CAAC,CAEhB,GAAMI,OAAM,MAAST,uBAAsB,CAACQ,MAAM,CAAC,CACnDH,UAAU,CAAC,KAAK,CAAC,CAEjB,MAAOI,OAAM,CACf,CAAC,gEACD,CAACT,sBAAsB,CAAC,CACzB,CAED,GAAMiB,oBAAmB,CAAG,GAAAV,kBAAW,sDACrC,UACEC,MAAgC,CACM,CACtCH,UAAU,CAAC,IAAI,CAAC,CAEhB,GAAMI,OAAM,MAASR,mBAAkB,CAACO,MAAM,CAAC,CAC/CH,UAAU,CAAC,KAAK,CAAC,CAEjB,MAAOI,OAAM,CACf,CAAC,gEACD,CAACR,kBAAkB,CAAC,CACrB,CAED,GAAMiB,sBAAqB,CAAG,GAAAX,kBAAW,iCAAC,WAA2B,CACnE,MAAOL,qBAAoB,EAAE,CAC/B,CAAC,EAAE,CAACA,oBAAoB,CAAC,CAAC,CAE1B,MAAO,CAELE,OAAO,CAAPA,OAAO,CAKPV,sBAAsB,CAAEY,uBAAuB,CAO/CX,6BAA6B,CAAEe,8BAA8B,CAO7Dd,yBAAyB,CAAEgB,0BAA0B,CAMrDf,8BAA8B,CAAEgB,+BAA+B,CAM/Df,sBAAsB,CAAEgB,uBAAuB,CAK/Cf,kBAAkB,CAAEgB,mBAAmB,CASvCf,sBAAsB,CAAEgB,uBAAuB,CAO/Cf,kBAAkB,CAAEgB,mBAAmB,CAMvCf,oBAAoB,CAAEgB,qBACxB,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 _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _helpers=require("../helpers");var _NativeStripeSdk=_interopRequireDefault(require("../NativeStripeSdk"));var _functions=require("../functions");function useStripe(){var _useState=(0,_react.useState)(null),_useState2=(0,_slicedToArray2.default)(_useState,2),isApplePaySupported=_useState2[0],setApplePaySupported=_useState2[1];(0,_react.useEffect)(function(){function checkApplePaySupport(){return _checkApplePaySupport.apply(this,arguments);}function _checkApplePaySupport(){_checkApplePaySupport=(0,_asyncToGenerator2.default)(function*(){var isSupported=_helpers.isiOS&&(yield _NativeStripeSdk.default.isApplePaySupported());setApplePaySupported(isSupported);});return _checkApplePaySupport.apply(this,arguments);}checkApplePaySupport();},[]);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 _presentApplePay=(0,_react.useCallback)(function(){var _ref6=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.presentApplePay)(params);});return function(_x7){return _ref6.apply(this,arguments);};}(),[]);var _updateApplePaySummaryItems=(0,_react.useCallback)(function(){var _ref7=(0,_asyncToGenerator2.default)(function*(summaryItems){var errorAddressFields=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];return(0,_functions.updateApplePaySummaryItems)(summaryItems,errorAddressFields);});return function(_x8){return _ref7.apply(this,arguments);};}(),[]);var _confirmApplePayPayment=(0,_react.useCallback)(function(){var _ref8=(0,_asyncToGenerator2.default)(function*(clientSecret){return(0,_functions.confirmApplePayPayment)(clientSecret);});return function(_x9){return _ref8.apply(this,arguments);};}(),[]);var _handleNextAction=(0,_react.useCallback)(function(){var _ref9=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,returnURL){return(0,_functions.handleNextAction)(paymentIntentClientSecret,returnURL);});return function(_x10,_x11){return _ref9.apply(this,arguments);};}(),[]);var _confirmSetupIntent=(0,_react.useCallback)(function(){var _ref10=(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(_x12,_x13){return _ref10.apply(this,arguments);};}(),[]);var _createTokenForCVCUpdate=(0,_react.useCallback)(function(){var _ref11=(0,_asyncToGenerator2.default)(function*(cvc){return(0,_functions.createTokenForCVCUpdate)(cvc);});return function(_x14){return _ref11.apply(this,arguments);};}(),[]);var _initPaymentSheet=(0,_react.useCallback)(function(){var _ref12=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.initPaymentSheet)(params);});return function(_x15){return _ref12.apply(this,arguments);};}(),[]);var _presentPaymentSheet=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.presentPaymentSheet)();}),[]);var _confirmPaymentSheetPayment=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.confirmPaymentSheetPayment)();}),[]);var _handleURLCallback=(0,_react.useCallback)(function(){var _ref15=(0,_asyncToGenerator2.default)(function*(url){return(0,_functions.handleURLCallback)(url);});return function(_x16){return _ref15.apply(this,arguments);};}(),[]);var _isGooglePaySupported=(0,_react.useCallback)(function(){var _ref16=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.isGooglePaySupported)(params);});return function(_x17){return _ref16.apply(this,arguments);};}(),[]);var _initGooglePay=(0,_react.useCallback)(function(){var _ref17=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.initGooglePay)(params);});return function(_x18){return _ref17.apply(this,arguments);};}(),[]);var _presentGooglePay=(0,_react.useCallback)(function(){var _ref18=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.presentGooglePay)(params);});return function(_x19){return _ref18.apply(this,arguments);};}(),[]);var _createGooglePayPaymentMethod=(0,_react.useCallback)(function(){var _ref19=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.createGooglePayPaymentMethod)(params);});return function(_x20){return _ref19.apply(this,arguments);};}(),[]);var _openApplePaySetup=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.openApplePaySetup)();}),[]);var _collectBankAccountForPayment=(0,_react.useCallback)(function(){var _ref21=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.collectBankAccountForPayment)(clientSecret,params);});return function(_x21,_x22){return _ref21.apply(this,arguments);};}(),[]);var _collectBankAccountForSetup=(0,_react.useCallback)(function(){var _ref22=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.collectBankAccountForSetup)(clientSecret,params);});return function(_x23,_x24){return _ref22.apply(this,arguments);};}(),[]);var _verifyMicrodepositsForPayment=(0,_react.useCallback)(function(){var _ref23=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.verifyMicrodepositsForPayment)(clientSecret,params);});return function(_x25,_x26){return _ref23.apply(this,arguments);};}(),[]);var _verifyMicrodepositsForSetup=(0,_react.useCallback)(function(){var _ref24=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.verifyMicrodepositsForSetup)(clientSecret,params);});return function(_x27,_x28){return _ref24.apply(this,arguments);};}(),[]);var _canAddCardToWallet=(0,_react.useCallback)(function(){var _ref25=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.canAddCardToWallet)(params);});return function(_x29){return _ref25.apply(this,arguments);};}(),[]);var _collectBankAccountToken=(0,_react.useCallback)(function(){var _ref26=(0,_asyncToGenerator2.default)(function*(clientSecret){return(0,_functions.collectBankAccountToken)(clientSecret);});return function(_x30){return _ref26.apply(this,arguments);};}(),[]);var _collectFinancialConnectionsAccounts=(0,_react.useCallback)(function(){var _ref27=(0,_asyncToGenerator2.default)(function*(clientSecret){return(0,_functions.collectFinancialConnectionsAccounts)(clientSecret);});return function(_x31){return _ref27.apply(this,arguments);};}(),[]);var _resetPaymentSheetCustomer=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.resetPaymentSheetCustomer)();}),[]);var _isPlatformPaySupported=(0,_react.useCallback)(function(){var _ref29=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.isPlatformPaySupported)(params);});return function(_x32){return _ref29.apply(this,arguments);};}(),[]);var _confirmPlatformPaySetupIntent=(0,_react.useCallback)(function(){var _ref30=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.confirmPlatformPaySetupIntent)(clientSecret,params);});return function(_x33,_x34){return _ref30.apply(this,arguments);};}(),[]);var _confirmPlatformPayPayment=(0,_react.useCallback)(function(){var _ref31=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.confirmPlatformPayPayment)(clientSecret,params);});return function(_x35,_x36){return _ref31.apply(this,arguments);};}(),[]);var _dismissPlatformPay=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.dismissPlatformPay)();}),[]);var _createPlatformPayPaymentMethod=(0,_react.useCallback)(function(){var _ref33=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.createPlatformPayPaymentMethod)(params);});return function(_x37){return _ref33.apply(this,arguments);};}(),[]);var _updatePlatformPaySheet=(0,_react.useCallback)(function(){var _ref34=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.updatePlatformPaySheet)(params);});return function(_x38){return _ref34.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,isApplePaySupported:isApplePaySupported,presentApplePay:_presentApplePay,confirmApplePayPayment:_confirmApplePayPayment,confirmSetupIntent:_confirmSetupIntent,createTokenForCVCUpdate:_createTokenForCVCUpdate,updateApplePaySummaryItems:_updateApplePaySummaryItems,handleURLCallback:_handleURLCallback,confirmPaymentSheetPayment:_confirmPaymentSheetPayment,presentPaymentSheet:_presentPaymentSheet,initPaymentSheet:_initPaymentSheet,createToken:_createToken,isGooglePaySupported:_isGooglePaySupported,initGooglePay:_initGooglePay,presentGooglePay:_presentGooglePay,createGooglePayPaymentMethod:_createGooglePayPaymentMethod,openApplePaySetup:_openApplePaySetup,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,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 _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _helpers=require("../helpers");var _NativeStripeSdk=_interopRequireDefault(require("../NativeStripeSdk"));var _functions=require("../functions");function useStripe(){var _useState=(0,_react.useState)(null),_useState2=(0,_slicedToArray2.default)(_useState,2),isApplePaySupported=_useState2[0],setApplePaySupported=_useState2[1];(0,_react.useEffect)(function(){function checkApplePaySupport(){return _checkApplePaySupport.apply(this,arguments);}function _checkApplePaySupport(){_checkApplePaySupport=(0,_asyncToGenerator2.default)(function*(){var isSupported=_helpers.isiOS&&(yield _NativeStripeSdk.default.isApplePaySupported());setApplePaySupported(isSupported);});return _checkApplePaySupport.apply(this,arguments);}checkApplePaySupport();},[]);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 _presentApplePay=(0,_react.useCallback)(function(){var _ref6=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.presentApplePay)(params);});return function(_x7){return _ref6.apply(this,arguments);};}(),[]);var _updateApplePaySummaryItems=(0,_react.useCallback)(function(){var _ref7=(0,_asyncToGenerator2.default)(function*(summaryItems){var errorAddressFields=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];return(0,_functions.updateApplePaySummaryItems)(summaryItems,errorAddressFields);});return function(_x8){return _ref7.apply(this,arguments);};}(),[]);var _confirmApplePayPayment=(0,_react.useCallback)(function(){var _ref8=(0,_asyncToGenerator2.default)(function*(clientSecret){return(0,_functions.confirmApplePayPayment)(clientSecret);});return function(_x9){return _ref8.apply(this,arguments);};}(),[]);var _handleNextAction=(0,_react.useCallback)(function(){var _ref9=(0,_asyncToGenerator2.default)(function*(paymentIntentClientSecret,returnURL){return(0,_functions.handleNextAction)(paymentIntentClientSecret,returnURL);});return function(_x10,_x11){return _ref9.apply(this,arguments);};}(),[]);var _confirmSetupIntent=(0,_react.useCallback)(function(){var _ref10=(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(_x12,_x13){return _ref10.apply(this,arguments);};}(),[]);var _createTokenForCVCUpdate=(0,_react.useCallback)(function(){var _ref11=(0,_asyncToGenerator2.default)(function*(cvc){return(0,_functions.createTokenForCVCUpdate)(cvc);});return function(_x14){return _ref11.apply(this,arguments);};}(),[]);var _initPaymentSheet=(0,_react.useCallback)(function(){var _ref12=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.initPaymentSheet)(params);});return function(_x15){return _ref12.apply(this,arguments);};}(),[]);var _presentPaymentSheet=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.presentPaymentSheet)();}),[]);var _confirmPaymentSheetPayment=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.confirmPaymentSheetPayment)();}),[]);var _handleURLCallback=(0,_react.useCallback)(function(){var _ref15=(0,_asyncToGenerator2.default)(function*(url){return(0,_functions.handleURLCallback)(url);});return function(_x16){return _ref15.apply(this,arguments);};}(),[]);var _isGooglePaySupported=(0,_react.useCallback)(function(){var _ref16=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.isGooglePaySupported)(params);});return function(_x17){return _ref16.apply(this,arguments);};}(),[]);var _initGooglePay=(0,_react.useCallback)(function(){var _ref17=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.initGooglePay)(params);});return function(_x18){return _ref17.apply(this,arguments);};}(),[]);var _presentGooglePay=(0,_react.useCallback)(function(){var _ref18=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.presentGooglePay)(params);});return function(_x19){return _ref18.apply(this,arguments);};}(),[]);var _createGooglePayPaymentMethod=(0,_react.useCallback)(function(){var _ref19=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.createGooglePayPaymentMethod)(params);});return function(_x20){return _ref19.apply(this,arguments);};}(),[]);var _openApplePaySetup=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.openApplePaySetup)();}),[]);var _collectBankAccountForPayment=(0,_react.useCallback)(function(){var _ref21=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.collectBankAccountForPayment)(clientSecret,params);});return function(_x21,_x22){return _ref21.apply(this,arguments);};}(),[]);var _collectBankAccountForSetup=(0,_react.useCallback)(function(){var _ref22=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.collectBankAccountForSetup)(clientSecret,params);});return function(_x23,_x24){return _ref22.apply(this,arguments);};}(),[]);var _verifyMicrodepositsForPayment=(0,_react.useCallback)(function(){var _ref23=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.verifyMicrodepositsForPayment)(clientSecret,params);});return function(_x25,_x26){return _ref23.apply(this,arguments);};}(),[]);var _verifyMicrodepositsForSetup=(0,_react.useCallback)(function(){var _ref24=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.verifyMicrodepositsForSetup)(clientSecret,params);});return function(_x27,_x28){return _ref24.apply(this,arguments);};}(),[]);var _canAddCardToWallet=(0,_react.useCallback)(function(){var _ref25=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.canAddCardToWallet)(params);});return function(_x29){return _ref25.apply(this,arguments);};}(),[]);var _collectBankAccountToken=(0,_react.useCallback)(function(){var _ref26=(0,_asyncToGenerator2.default)(function*(clientSecret){return(0,_functions.collectBankAccountToken)(clientSecret);});return function(_x30){return _ref26.apply(this,arguments);};}(),[]);var _collectFinancialConnectionsAccounts=(0,_react.useCallback)(function(){var _ref27=(0,_asyncToGenerator2.default)(function*(clientSecret){return(0,_functions.collectFinancialConnectionsAccounts)(clientSecret);});return function(_x31){return _ref27.apply(this,arguments);};}(),[]);var _resetPaymentSheetCustomer=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.resetPaymentSheetCustomer)();}),[]);var _isPlatformPaySupported=(0,_react.useCallback)(function(){var _ref29=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.isPlatformPaySupported)(params);});return function(_x32){return _ref29.apply(this,arguments);};}(),[]);var _confirmPlatformPaySetupIntent=(0,_react.useCallback)(function(){var _ref30=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.confirmPlatformPaySetupIntent)(clientSecret,params);});return function(_x33,_x34){return _ref30.apply(this,arguments);};}(),[]);var _confirmPlatformPayPayment=(0,_react.useCallback)(function(){var _ref31=(0,_asyncToGenerator2.default)(function*(clientSecret,params){return(0,_functions.confirmPlatformPayPayment)(clientSecret,params);});return function(_x35,_x36){return _ref31.apply(this,arguments);};}(),[]);var _dismissPlatformPay=(0,_react.useCallback)((0,_asyncToGenerator2.default)(function*(){return(0,_functions.dismissPlatformPay)();}),[]);var _createPlatformPayPaymentMethod=(0,_react.useCallback)(function(){var _ref33=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.createPlatformPayPaymentMethod)(params);});return function(_x37){return _ref33.apply(this,arguments);};}(),[]);var _createPlatformPayToken=(0,_react.useCallback)(function(){var _ref34=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.createPlatformPayToken)(params);});return function(_x38){return _ref34.apply(this,arguments);};}(),[]);var _updatePlatformPaySheet=(0,_react.useCallback)(function(){var _ref35=(0,_asyncToGenerator2.default)(function*(params){return(0,_functions.updatePlatformPaySheet)(params);});return function(_x39){return _ref35.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,isApplePaySupported:isApplePaySupported,presentApplePay:_presentApplePay,confirmApplePayPayment:_confirmApplePayPayment,confirmSetupIntent:_confirmSetupIntent,createTokenForCVCUpdate:_createTokenForCVCUpdate,updateApplePaySummaryItems:_updateApplePaySummaryItems,handleURLCallback:_handleURLCallback,confirmPaymentSheetPayment:_confirmPaymentSheetPayment,presentPaymentSheet:_presentPaymentSheet,initPaymentSheet:_initPaymentSheet,createToken:_createToken,isGooglePaySupported:_isGooglePaySupported,initGooglePay:_initGooglePay,presentGooglePay:_presentGooglePay,createGooglePayPaymentMethod:_createGooglePayPaymentMethod,openApplePaySetup:_openApplePaySetup,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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useStripe","useState","isApplePaySupported","setApplePaySupported","useEffect","checkApplePaySupport","isSupported","isiOS","NativeStripeSdk","_createPaymentMethod","useCallback","data","options","createPaymentMethod","_createToken","params","createToken","_retrievePaymentIntent","clientSecret","retrievePaymentIntent","_retrieveSetupIntent","retrieveSetupIntent","_confirmPayment","paymentIntentClientSecret","confirmPayment","_presentApplePay","presentApplePay","_updateApplePaySummaryItems","summaryItems","errorAddressFields","updateApplePaySummaryItems","_confirmApplePayPayment","confirmApplePayPayment","_handleNextAction","returnURL","handleNextAction","_confirmSetupIntent","confirmSetupIntent","_createTokenForCVCUpdate","cvc","createTokenForCVCUpdate","_initPaymentSheet","initPaymentSheet","_presentPaymentSheet","presentPaymentSheet","_confirmPaymentSheetPayment","confirmPaymentSheetPayment","_handleURLCallback","url","handleURLCallback","_isGooglePaySupported","isGooglePaySupported","_initGooglePay","initGooglePay","_presentGooglePay","presentGooglePay","_createGooglePayPaymentMethod","createGooglePayPaymentMethod","_openApplePaySetup","openApplePaySetup","_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","_updatePlatformPaySheet","updatePlatformPaySheet","_openPlatformPaySetup","openPlatformPaySetup"],"sources":["useStripe.tsx"],"sourcesContent":["import type {\n PaymentMethod,\n PaymentIntent,\n ApplePay,\n PaymentSheet,\n CreatePaymentMethodResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n ConfirmPaymentResult,\n HandleNextActionResult,\n ConfirmSetupIntentResult,\n CreateTokenForCVCUpdateResult,\n ApplePayResult,\n ApplePayError,\n StripeError,\n InitPaymentSheetResult,\n PresentPaymentSheetResult,\n ConfirmPaymentSheetPaymentResult,\n SetupIntent,\n CreateTokenResult,\n PayWithGooglePayResult,\n GooglePayInitResult,\n GooglePay,\n CreateGooglePayPaymentMethodResult,\n OpenApplePaySetupResult,\n Token,\n VerifyMicrodepositsParams,\n VerifyMicrodepositsForPaymentResult,\n VerifyMicrodepositsForSetupResult,\n CollectBankAccountForSetupResult,\n CollectBankAccountForPaymentResult,\n CanAddCardToWalletParams,\n CanAddCardToWalletResult,\n FinancialConnections,\n PlatformPay,\n PlatformPayError,\n} from '../types';\nimport { useCallback, useEffect, useState } from 'react';\nimport { isiOS } from '../helpers';\nimport NativeStripeSdk from '../NativeStripeSdk';\nimport {\n confirmPayment,\n createPaymentMethod,\n retrievePaymentIntent,\n retrieveSetupIntent,\n confirmApplePayPayment,\n confirmSetupIntent,\n createTokenForCVCUpdate,\n handleNextAction,\n handleURLCallback,\n presentApplePay,\n updateApplePaySummaryItems,\n initPaymentSheet,\n presentPaymentSheet,\n confirmPaymentSheetPayment,\n createToken,\n isGooglePaySupported,\n initGooglePay,\n createGooglePayPaymentMethod,\n presentGooglePay,\n openApplePaySetup,\n collectBankAccountForPayment,\n collectBankAccountForSetup,\n verifyMicrodepositsForPayment,\n verifyMicrodepositsForSetup,\n canAddCardToWallet,\n collectBankAccountToken,\n collectFinancialConnectionsAccounts,\n resetPaymentSheetCustomer,\n isPlatformPaySupported,\n confirmPlatformPaySetupIntent,\n confirmPlatformPayPayment,\n dismissPlatformPay,\n createPlatformPayPaymentMethod,\n updatePlatformPaySheet,\n openPlatformPaySetup,\n} from '../functions';\n\n/**\n * useStripe hook\n */\nexport function useStripe() {\n const [isApplePaySupported, setApplePaySupported] = useState<boolean | null>(\n null\n );\n\n useEffect(() => {\n async function checkApplePaySupport() {\n const isSupported =\n isiOS && (await NativeStripeSdk.isApplePaySupported());\n setApplePaySupported(isSupported);\n }\n\n checkApplePaySupport();\n }, []);\n\n const _createPaymentMethod = useCallback(\n async (\n data: PaymentMethod.CreateParams,\n options: PaymentMethod.CreateOptions = {}\n ): Promise<CreatePaymentMethodResult> => {\n return createPaymentMethod(data, options);\n },\n []\n );\n\n const _createToken = useCallback(\n async (params: Token.CreateParams): Promise<CreateTokenResult> => {\n return createToken(params);\n },\n []\n );\n\n const _retrievePaymentIntent = useCallback(\n async (clientSecret: string): Promise<RetrievePaymentIntentResult> => {\n return retrievePaymentIntent(clientSecret);\n },\n []\n );\n\n const _retrieveSetupIntent = useCallback(\n async (clientSecret: string): Promise<RetrieveSetupIntentResult> => {\n return retrieveSetupIntent(clientSecret);\n },\n []\n );\n\n const _confirmPayment = useCallback(\n async (\n paymentIntentClientSecret: string,\n data?: PaymentIntent.ConfirmParams,\n options: PaymentIntent.ConfirmOptions = {}\n ): Promise<ConfirmPaymentResult> => {\n return confirmPayment(paymentIntentClientSecret, data, options);\n },\n []\n );\n\n const _presentApplePay = useCallback(\n async (params: ApplePay.PresentParams): Promise<ApplePayResult> => {\n return presentApplePay(params);\n },\n []\n );\n\n const _updateApplePaySummaryItems = useCallback(\n async (\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }> = []\n ): Promise<{ error?: StripeError<ApplePayError> }> => {\n return updateApplePaySummaryItems(summaryItems, errorAddressFields);\n },\n []\n );\n\n const _confirmApplePayPayment = useCallback(\n async (\n clientSecret: string\n ): Promise<{ error?: StripeError<ApplePayError> }> => {\n return confirmApplePayPayment(clientSecret);\n },\n []\n );\n\n const _handleNextAction = useCallback(\n async (\n paymentIntentClientSecret: string,\n returnURL?: string\n ): Promise<HandleNextActionResult> => {\n return handleNextAction(paymentIntentClientSecret, returnURL);\n },\n []\n );\n\n const _confirmSetupIntent = useCallback(\n async (\n paymentIntentClientSecret: string,\n data: SetupIntent.ConfirmParams,\n options: SetupIntent.ConfirmOptions = {}\n ): Promise<ConfirmSetupIntentResult> => {\n return confirmSetupIntent(paymentIntentClientSecret, data, options);\n },\n []\n );\n\n const _createTokenForCVCUpdate = useCallback(\n async (cvc: string): Promise<CreateTokenForCVCUpdateResult> => {\n return createTokenForCVCUpdate(cvc);\n },\n []\n );\n\n const _initPaymentSheet = useCallback(\n async (\n params: PaymentSheet.SetupParams\n ): Promise<InitPaymentSheetResult> => {\n return initPaymentSheet(params);\n },\n []\n );\n\n const _presentPaymentSheet =\n useCallback(async (): Promise<PresentPaymentSheetResult> => {\n return presentPaymentSheet();\n }, []);\n\n const _confirmPaymentSheetPayment =\n useCallback(async (): Promise<ConfirmPaymentSheetPaymentResult> => {\n return confirmPaymentSheetPayment();\n }, []);\n\n const _handleURLCallback = useCallback(\n async (url: string): Promise<boolean> => {\n return handleURLCallback(url);\n },\n []\n );\n\n const _isGooglePaySupported = useCallback(\n async (params?: GooglePay.IsSupportedParams): Promise<boolean> => {\n return isGooglePaySupported(params);\n },\n []\n );\n\n const _initGooglePay = useCallback(\n async (params: GooglePay.InitParams): Promise<GooglePayInitResult> => {\n return initGooglePay(params);\n },\n []\n );\n\n const _presentGooglePay = useCallback(\n async (\n params: GooglePay.PresentParams\n ): Promise<PayWithGooglePayResult> => {\n return presentGooglePay(params);\n },\n []\n );\n\n const _createGooglePayPaymentMethod = useCallback(\n async (\n params: GooglePay.CreatePaymentMethodParams\n ): Promise<CreateGooglePayPaymentMethodResult> => {\n return createGooglePayPaymentMethod(params);\n },\n []\n );\n\n const _openApplePaySetup =\n useCallback(async (): Promise<OpenApplePaySetupResult> => {\n return openApplePaySetup();\n }, []);\n\n const _collectBankAccountForPayment = useCallback(\n async (\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n ): Promise<CollectBankAccountForPaymentResult> => {\n return collectBankAccountForPayment(clientSecret, params);\n },\n []\n );\n\n const _collectBankAccountForSetup = useCallback(\n async (\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n ): Promise<CollectBankAccountForSetupResult> => {\n return collectBankAccountForSetup(clientSecret, params);\n },\n []\n );\n\n const _verifyMicrodepositsForPayment = useCallback(\n async (\n clientSecret: string,\n params: VerifyMicrodepositsParams\n ): Promise<VerifyMicrodepositsForPaymentResult> => {\n return verifyMicrodepositsForPayment(clientSecret, params);\n },\n []\n );\n\n const _verifyMicrodepositsForSetup = useCallback(\n async (\n clientSecret: string,\n params: VerifyMicrodepositsParams\n ): Promise<VerifyMicrodepositsForSetupResult> => {\n return verifyMicrodepositsForSetup(clientSecret, params);\n },\n []\n );\n\n const _canAddCardToWallet = useCallback(\n async (\n params: CanAddCardToWalletParams\n ): Promise<CanAddCardToWalletResult> => {\n return canAddCardToWallet(params);\n },\n []\n );\n\n const _collectBankAccountToken = useCallback(\n async (clientSecret: string): Promise<FinancialConnections.TokenResult> => {\n return collectBankAccountToken(clientSecret);\n },\n []\n );\n\n const _collectFinancialConnectionsAccounts = useCallback(\n async (\n clientSecret: string\n ): Promise<FinancialConnections.SessionResult> => {\n return collectFinancialConnectionsAccounts(clientSecret);\n },\n []\n );\n\n const _resetPaymentSheetCustomer = useCallback(async (): Promise<null> => {\n return resetPaymentSheetCustomer();\n }, []);\n\n const _isPlatformPaySupported = useCallback(\n async (params?: {\n googlePay?: GooglePay.IsSupportedParams;\n }): Promise<boolean> => {\n return isPlatformPaySupported(params);\n },\n []\n );\n\n const _confirmPlatformPaySetupIntent = useCallback(\n async (\n clientSecret: string,\n params: PlatformPay.ConfirmParams\n ): Promise<PlatformPay.ConfirmSetupIntentResult> => {\n return confirmPlatformPaySetupIntent(clientSecret, params);\n },\n []\n );\n\n const _confirmPlatformPayPayment = useCallback(\n async (\n clientSecret: string,\n params: PlatformPay.ConfirmParams\n ): Promise<PlatformPay.ConfirmPaymentResult> => {\n return confirmPlatformPayPayment(clientSecret, params);\n },\n []\n );\n\n const _dismissPlatformPay = useCallback(async (): Promise<boolean> => {\n return dismissPlatformPay();\n }, []);\n\n const _createPlatformPayPaymentMethod = useCallback(\n async (\n params: PlatformPay.PaymentMethodParams\n ): Promise<PlatformPay.PaymentMethodResult> => {\n return createPlatformPayPaymentMethod(params);\n },\n []\n );\n\n const _updatePlatformPaySheet = useCallback(\n 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 return updatePlatformPaySheet(params);\n },\n []\n );\n\n const _openPlatformPaySetup = useCallback(async (): Promise<void> => {\n return openPlatformPaySetup();\n }, []);\n\n return {\n retrievePaymentIntent: _retrievePaymentIntent,\n retrieveSetupIntent: _retrieveSetupIntent,\n confirmPayment: _confirmPayment,\n createPaymentMethod: _createPaymentMethod,\n handleNextAction: _handleNextAction,\n isApplePaySupported: isApplePaySupported,\n presentApplePay: _presentApplePay,\n confirmApplePayPayment: _confirmApplePayPayment,\n confirmSetupIntent: _confirmSetupIntent,\n createTokenForCVCUpdate: _createTokenForCVCUpdate,\n updateApplePaySummaryItems: _updateApplePaySummaryItems,\n handleURLCallback: _handleURLCallback,\n confirmPaymentSheetPayment: _confirmPaymentSheetPayment,\n presentPaymentSheet: _presentPaymentSheet,\n initPaymentSheet: _initPaymentSheet,\n createToken: _createToken,\n isGooglePaySupported: _isGooglePaySupported,\n initGooglePay: _initGooglePay,\n presentGooglePay: _presentGooglePay,\n createGooglePayPaymentMethod: _createGooglePayPaymentMethod,\n openApplePaySetup: _openApplePaySetup,\n collectBankAccountForPayment: _collectBankAccountForPayment,\n collectBankAccountForSetup: _collectBankAccountForSetup,\n verifyMicrodepositsForPayment: _verifyMicrodepositsForPayment,\n verifyMicrodepositsForSetup: _verifyMicrodepositsForSetup,\n canAddCardToWallet: _canAddCardToWallet,\n collectBankAccountToken: _collectBankAccountToken,\n collectFinancialConnectionsAccounts: _collectFinancialConnectionsAccounts,\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 */\n resetPaymentSheetCustomer: _resetPaymentSheetCustomer,\n isPlatformPaySupported: _isPlatformPaySupported,\n confirmPlatformPaySetupIntent: _confirmPlatformPaySetupIntent,\n confirmPlatformPayPayment: _confirmPlatformPayPayment,\n dismissPlatformPay: _dismissPlatformPay,\n createPlatformPayPaymentMethod: _createPlatformPayPaymentMethod,\n updatePlatformPaySheet: _updatePlatformPaySheet,\n openPlatformPaySetup: _openPlatformPaySetup,\n };\n}\n"],"mappings":"sWAqCA,4BACA,mCACA,2EACA,uCAyCO,QAASA,UAAS,EAAG,CAC1B,cAAoD,GAAAC,eAAQ,EAC1D,IAAI,CACL,qDAFMC,mBAAmB,eAAEC,oBAAoB,eAIhD,GAAAC,gBAAS,EAAC,UAAM,SACCC,qBAAoB,6IAAnC,WAAsC,CACpC,GAAMC,YAAW,CACfC,cAAK,QAAWC,yBAAe,CAACN,mBAAmB,EAAE,CAAC,CACxDC,oBAAoB,CAACG,WAAW,CAAC,CACnC,CAAC,sDAEDD,oBAAoB,EAAE,CACxB,CAAC,CAAE,EAAE,CAAC,CAEN,GAAMI,qBAAoB,CAAG,GAAAC,kBAAW,qDACtC,UACEC,IAAgC,CAEO,IADvCC,QAAoC,2DAAG,CAAC,CAAC,CAEzC,MAAO,GAAAC,8BAAmB,EAACF,IAAI,CAAEC,OAAO,CAAC,CAC3C,CAA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yB,CAAED,0BAA0B,CACrDG,sBAAsB,CAAED,uBAAuB,CAC/CG,6BAA6B,CAAED,8BAA8B,CAC7DG,yBAAyB,CAAED,0BAA0B,CACrDG,kBAAkB,CAAED,mBAAmB,CACvCG,8BAA8B,CAAED,+BAA+B,CAC/DG,sBAAsB,CAAED,uBAAuB,CAC/CG,oBAAoB,CAAED,qBACxB,CAAC,CACH"}
|
|
1
|
+
{"version":3,"names":["useStripe","useState","isApplePaySupported","setApplePaySupported","useEffect","checkApplePaySupport","isSupported","isiOS","NativeStripeSdk","_createPaymentMethod","useCallback","data","options","createPaymentMethod","_createToken","params","createToken","_retrievePaymentIntent","clientSecret","retrievePaymentIntent","_retrieveSetupIntent","retrieveSetupIntent","_confirmPayment","paymentIntentClientSecret","confirmPayment","_presentApplePay","presentApplePay","_updateApplePaySummaryItems","summaryItems","errorAddressFields","updateApplePaySummaryItems","_confirmApplePayPayment","confirmApplePayPayment","_handleNextAction","returnURL","handleNextAction","_confirmSetupIntent","confirmSetupIntent","_createTokenForCVCUpdate","cvc","createTokenForCVCUpdate","_initPaymentSheet","initPaymentSheet","_presentPaymentSheet","presentPaymentSheet","_confirmPaymentSheetPayment","confirmPaymentSheetPayment","_handleURLCallback","url","handleURLCallback","_isGooglePaySupported","isGooglePaySupported","_initGooglePay","initGooglePay","_presentGooglePay","presentGooglePay","_createGooglePayPaymentMethod","createGooglePayPaymentMethod","_openApplePaySetup","openApplePaySetup","_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"],"sources":["useStripe.tsx"],"sourcesContent":["import type {\n PaymentMethod,\n PaymentIntent,\n ApplePay,\n PaymentSheet,\n CreatePaymentMethodResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n ConfirmPaymentResult,\n HandleNextActionResult,\n ConfirmSetupIntentResult,\n CreateTokenForCVCUpdateResult,\n ApplePayResult,\n ApplePayError,\n StripeError,\n InitPaymentSheetResult,\n PresentPaymentSheetResult,\n ConfirmPaymentSheetPaymentResult,\n SetupIntent,\n CreateTokenResult,\n PayWithGooglePayResult,\n GooglePayInitResult,\n GooglePay,\n CreateGooglePayPaymentMethodResult,\n OpenApplePaySetupResult,\n Token,\n VerifyMicrodepositsParams,\n VerifyMicrodepositsForPaymentResult,\n VerifyMicrodepositsForSetupResult,\n CollectBankAccountForSetupResult,\n CollectBankAccountForPaymentResult,\n CanAddCardToWalletParams,\n CanAddCardToWalletResult,\n FinancialConnections,\n PlatformPay,\n PlatformPayError,\n} from '../types';\nimport { useCallback, useEffect, useState } from 'react';\nimport { isiOS } from '../helpers';\nimport NativeStripeSdk from '../NativeStripeSdk';\nimport {\n confirmPayment,\n createPaymentMethod,\n retrievePaymentIntent,\n retrieveSetupIntent,\n confirmApplePayPayment,\n confirmSetupIntent,\n createTokenForCVCUpdate,\n handleNextAction,\n handleURLCallback,\n presentApplePay,\n updateApplePaySummaryItems,\n initPaymentSheet,\n presentPaymentSheet,\n confirmPaymentSheetPayment,\n createToken,\n isGooglePaySupported,\n initGooglePay,\n createGooglePayPaymentMethod,\n presentGooglePay,\n openApplePaySetup,\n collectBankAccountForPayment,\n collectBankAccountForSetup,\n verifyMicrodepositsForPayment,\n verifyMicrodepositsForSetup,\n canAddCardToWallet,\n collectBankAccountToken,\n collectFinancialConnectionsAccounts,\n resetPaymentSheetCustomer,\n isPlatformPaySupported,\n confirmPlatformPaySetupIntent,\n confirmPlatformPayPayment,\n dismissPlatformPay,\n createPlatformPayPaymentMethod,\n createPlatformPayToken,\n updatePlatformPaySheet,\n openPlatformPaySetup,\n} from '../functions';\n\n/**\n * useStripe hook\n */\nexport function useStripe() {\n const [isApplePaySupported, setApplePaySupported] = useState<boolean | null>(\n null\n );\n\n useEffect(() => {\n async function checkApplePaySupport() {\n const isSupported =\n isiOS && (await NativeStripeSdk.isApplePaySupported());\n setApplePaySupported(isSupported);\n }\n\n checkApplePaySupport();\n }, []);\n\n const _createPaymentMethod = useCallback(\n async (\n data: PaymentMethod.CreateParams,\n options: PaymentMethod.CreateOptions = {}\n ): Promise<CreatePaymentMethodResult> => {\n return createPaymentMethod(data, options);\n },\n []\n );\n\n const _createToken = useCallback(\n async (params: Token.CreateParams): Promise<CreateTokenResult> => {\n return createToken(params);\n },\n []\n );\n\n const _retrievePaymentIntent = useCallback(\n async (clientSecret: string): Promise<RetrievePaymentIntentResult> => {\n return retrievePaymentIntent(clientSecret);\n },\n []\n );\n\n const _retrieveSetupIntent = useCallback(\n async (clientSecret: string): Promise<RetrieveSetupIntentResult> => {\n return retrieveSetupIntent(clientSecret);\n },\n []\n );\n\n const _confirmPayment = useCallback(\n async (\n paymentIntentClientSecret: string,\n data?: PaymentIntent.ConfirmParams,\n options: PaymentIntent.ConfirmOptions = {}\n ): Promise<ConfirmPaymentResult> => {\n return confirmPayment(paymentIntentClientSecret, data, options);\n },\n []\n );\n\n const _presentApplePay = useCallback(\n async (params: ApplePay.PresentParams): Promise<ApplePayResult> => {\n return presentApplePay(params);\n },\n []\n );\n\n const _updateApplePaySummaryItems = useCallback(\n async (\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }> = []\n ): Promise<{ error?: StripeError<ApplePayError> }> => {\n return updateApplePaySummaryItems(summaryItems, errorAddressFields);\n },\n []\n );\n\n const _confirmApplePayPayment = useCallback(\n async (\n clientSecret: string\n ): Promise<{ error?: StripeError<ApplePayError> }> => {\n return confirmApplePayPayment(clientSecret);\n },\n []\n );\n\n const _handleNextAction = useCallback(\n async (\n paymentIntentClientSecret: string,\n returnURL?: string\n ): Promise<HandleNextActionResult> => {\n return handleNextAction(paymentIntentClientSecret, returnURL);\n },\n []\n );\n\n const _confirmSetupIntent = useCallback(\n async (\n paymentIntentClientSecret: string,\n data: SetupIntent.ConfirmParams,\n options: SetupIntent.ConfirmOptions = {}\n ): Promise<ConfirmSetupIntentResult> => {\n return confirmSetupIntent(paymentIntentClientSecret, data, options);\n },\n []\n );\n\n const _createTokenForCVCUpdate = useCallback(\n async (cvc: string): Promise<CreateTokenForCVCUpdateResult> => {\n return createTokenForCVCUpdate(cvc);\n },\n []\n );\n\n const _initPaymentSheet = useCallback(\n async (\n params: PaymentSheet.SetupParams\n ): Promise<InitPaymentSheetResult> => {\n return initPaymentSheet(params);\n },\n []\n );\n\n const _presentPaymentSheet =\n useCallback(async (): Promise<PresentPaymentSheetResult> => {\n return presentPaymentSheet();\n }, []);\n\n const _confirmPaymentSheetPayment =\n useCallback(async (): Promise<ConfirmPaymentSheetPaymentResult> => {\n return confirmPaymentSheetPayment();\n }, []);\n\n const _handleURLCallback = useCallback(\n async (url: string): Promise<boolean> => {\n return handleURLCallback(url);\n },\n []\n );\n\n const _isGooglePaySupported = useCallback(\n async (params?: GooglePay.IsSupportedParams): Promise<boolean> => {\n return isGooglePaySupported(params);\n },\n []\n );\n\n const _initGooglePay = useCallback(\n async (params: GooglePay.InitParams): Promise<GooglePayInitResult> => {\n return initGooglePay(params);\n },\n []\n );\n\n const _presentGooglePay = useCallback(\n async (\n params: GooglePay.PresentParams\n ): Promise<PayWithGooglePayResult> => {\n return presentGooglePay(params);\n },\n []\n );\n\n const _createGooglePayPaymentMethod = useCallback(\n async (\n params: GooglePay.CreatePaymentMethodParams\n ): Promise<CreateGooglePayPaymentMethodResult> => {\n return createGooglePayPaymentMethod(params);\n },\n []\n );\n\n const _openApplePaySetup =\n useCallback(async (): Promise<OpenApplePaySetupResult> => {\n return openApplePaySetup();\n }, []);\n\n const _collectBankAccountForPayment = useCallback(\n async (\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n ): Promise<CollectBankAccountForPaymentResult> => {\n return collectBankAccountForPayment(clientSecret, params);\n },\n []\n );\n\n const _collectBankAccountForSetup = useCallback(\n async (\n clientSecret: string,\n params: PaymentMethod.CollectBankAccountParams\n ): Promise<CollectBankAccountForSetupResult> => {\n return collectBankAccountForSetup(clientSecret, params);\n },\n []\n );\n\n const _verifyMicrodepositsForPayment = useCallback(\n async (\n clientSecret: string,\n params: VerifyMicrodepositsParams\n ): Promise<VerifyMicrodepositsForPaymentResult> => {\n return verifyMicrodepositsForPayment(clientSecret, params);\n },\n []\n );\n\n const _verifyMicrodepositsForSetup = useCallback(\n async (\n clientSecret: string,\n params: VerifyMicrodepositsParams\n ): Promise<VerifyMicrodepositsForSetupResult> => {\n return verifyMicrodepositsForSetup(clientSecret, params);\n },\n []\n );\n\n const _canAddCardToWallet = useCallback(\n async (\n params: CanAddCardToWalletParams\n ): Promise<CanAddCardToWalletResult> => {\n return canAddCardToWallet(params);\n },\n []\n );\n\n const _collectBankAccountToken = useCallback(\n async (clientSecret: string): Promise<FinancialConnections.TokenResult> => {\n return collectBankAccountToken(clientSecret);\n },\n []\n );\n\n const _collectFinancialConnectionsAccounts = useCallback(\n async (\n clientSecret: string\n ): Promise<FinancialConnections.SessionResult> => {\n return collectFinancialConnectionsAccounts(clientSecret);\n },\n []\n );\n\n const _resetPaymentSheetCustomer = useCallback(async (): Promise<null> => {\n return resetPaymentSheetCustomer();\n }, []);\n\n const _isPlatformPaySupported = useCallback(\n async (params?: {\n googlePay?: GooglePay.IsSupportedParams;\n }): Promise<boolean> => {\n return isPlatformPaySupported(params);\n },\n []\n );\n\n const _confirmPlatformPaySetupIntent = useCallback(\n async (\n clientSecret: string,\n params: PlatformPay.ConfirmParams\n ): Promise<PlatformPay.ConfirmSetupIntentResult> => {\n return confirmPlatformPaySetupIntent(clientSecret, params);\n },\n []\n );\n\n const _confirmPlatformPayPayment = useCallback(\n async (\n clientSecret: string,\n params: PlatformPay.ConfirmParams\n ): Promise<PlatformPay.ConfirmPaymentResult> => {\n return confirmPlatformPayPayment(clientSecret, params);\n },\n []\n );\n\n const _dismissPlatformPay = useCallback(async (): Promise<boolean> => {\n return dismissPlatformPay();\n }, []);\n\n const _createPlatformPayPaymentMethod = useCallback(\n async (\n params: PlatformPay.PaymentMethodParams\n ): Promise<PlatformPay.PaymentMethodResult> => {\n return createPlatformPayPaymentMethod(params);\n },\n []\n );\n\n const _createPlatformPayToken = useCallback(\n async (\n params: PlatformPay.PaymentMethodParams\n ): Promise<PlatformPay.TokenResult> => {\n return createPlatformPayToken(params);\n },\n []\n );\n\n const _updatePlatformPaySheet = useCallback(\n 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 return updatePlatformPaySheet(params);\n },\n []\n );\n\n const _openPlatformPaySetup = useCallback(async (): Promise<void> => {\n return openPlatformPaySetup();\n }, []);\n\n return {\n retrievePaymentIntent: _retrievePaymentIntent,\n retrieveSetupIntent: _retrieveSetupIntent,\n confirmPayment: _confirmPayment,\n createPaymentMethod: _createPaymentMethod,\n handleNextAction: _handleNextAction,\n isApplePaySupported: isApplePaySupported,\n presentApplePay: _presentApplePay,\n confirmApplePayPayment: _confirmApplePayPayment,\n confirmSetupIntent: _confirmSetupIntent,\n createTokenForCVCUpdate: _createTokenForCVCUpdate,\n updateApplePaySummaryItems: _updateApplePaySummaryItems,\n handleURLCallback: _handleURLCallback,\n confirmPaymentSheetPayment: _confirmPaymentSheetPayment,\n presentPaymentSheet: _presentPaymentSheet,\n initPaymentSheet: _initPaymentSheet,\n createToken: _createToken,\n isGooglePaySupported: _isGooglePaySupported,\n initGooglePay: _initGooglePay,\n presentGooglePay: _presentGooglePay,\n createGooglePayPaymentMethod: _createGooglePayPaymentMethod,\n openApplePaySetup: _openApplePaySetup,\n collectBankAccountForPayment: _collectBankAccountForPayment,\n collectBankAccountForSetup: _collectBankAccountForSetup,\n verifyMicrodepositsForPayment: _verifyMicrodepositsForPayment,\n verifyMicrodepositsForSetup: _verifyMicrodepositsForSetup,\n canAddCardToWallet: _canAddCardToWallet,\n collectBankAccountToken: _collectBankAccountToken,\n collectFinancialConnectionsAccounts: _collectFinancialConnectionsAccounts,\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 */\n resetPaymentSheetCustomer: _resetPaymentSheetCustomer,\n isPlatformPaySupported: _isPlatformPaySupported,\n confirmPlatformPaySetupIntent: _confirmPlatformPaySetupIntent,\n confirmPlatformPayPayment: _confirmPlatformPayPayment,\n dismissPlatformPay: _dismissPlatformPay,\n createPlatformPayPaymentMethod: _createPlatformPayPaymentMethod,\n createPlatformPayToken: _createPlatformPayToken,\n updatePlatformPaySheet: _updatePlatformPaySheet,\n openPlatformPaySetup: _openPlatformPaySetup,\n };\n}\n"],"mappings":"sWAqCA,4BACA,mCACA,2EACA,uCA0CO,QAASA,UAAS,EAAG,CAC1B,cAAoD,GAAAC,eAAQ,EAC1D,IAAI,CACL,qDAFMC,mBAAmB,eAAEC,oBAAoB,eAIhD,GAAAC,gBAAS,EAAC,UAAM,SACCC,qBAAoB,6IAAnC,WAAsC,CACpC,GAAMC,YAAW,CACfC,cAAK,QAAWC,yBAAe,CAACN,mBAAmB,EAAE,CAAC,CACxDC,oBAAoB,CAACG,WAAW,CAAC,CACnC,CAAC,sDAEDD,oBAAoB,EAAE,CACxB,CAAC,CAAE,EAAE,CAAC,CAEN,GAAMI,qBAAoB,CAAG,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AiB,CACnCG,4BAA4B,CAAED,6BAA6B,CAC3DG,iBAAiB,CAAED,kBAAkB,CACrCG,4BAA4B,CAAED,6BAA6B,CAC3DG,0BAA0B,CAAED,2BAA2B,CACvDG,6BAA6B,CAAED,8BAA8B,CAC7DG,2BAA2B,CAAED,4BAA4B,CACzDG,kBAAkB,CAAED,mBAAmB,CACvCG,uBAAuB,CAAED,wBAAwB,CACjDG,mCAAmC,CAAED,oCAAoC,CAMzEG,yBAAyB,CAAED,0BAA0B,CACrDG,sBAAsB,CAAED,uBAAuB,CAC/CG,6BAA6B,CAAED,8BAA8B,CAC7DG,yBAAyB,CAAED,0BAA0B,CACrDG,kBAAkB,CAAED,mBAAmB,CACvCG,8BAA8B,CAAED,+BAA+B,CAC/DG,sBAAsB,CAAED,uBAAuB,CAC/CG,sBAAsB,CAAED,uBAAuB,CAC/CG,oBAAoB,CAAED,qBACxB,CAAC,CACH"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={useConfirmPayment:true,useConfirmSetupIntent:true,useStripe:true,usePlatformPay:true,useApplePay:true,
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={useConfirmPayment:true,useConfirmSetupIntent:true,useStripe:true,usePlatformPay:true,useApplePay:true,usePaymentSheet:true,useGooglePay:true,useFinancialConnectionsSheet:true,initStripe:true,StripeProvider:true,CardField:true,CardForm:true,ApplePayButton:true,AuBECSDebitForm:true,StripeContainer:true,GooglePayButton:true,AddToWalletButton:true,AddressSheet:true,PlatformPayButton:true};Object.defineProperty(exports,"AddToWalletButton",{enumerable:true,get:function get(){return _AddToWalletButton.AddToWalletButton;}});Object.defineProperty(exports,"AddressSheet",{enumerable:true,get:function get(){return _AddressSheet.AddressSheet;}});Object.defineProperty(exports,"ApplePayButton",{enumerable:true,get:function get(){return _ApplePayButton.ApplePayButton;}});Object.defineProperty(exports,"AuBECSDebitForm",{enumerable:true,get:function get(){return _AuBECSDebitForm.AuBECSDebitForm;}});Object.defineProperty(exports,"CardField",{enumerable:true,get:function get(){return _CardField.CardField;}});Object.defineProperty(exports,"CardForm",{enumerable:true,get:function get(){return _CardForm.CardForm;}});Object.defineProperty(exports,"GooglePayButton",{enumerable:true,get:function get(){return _GooglePayButton.GooglePayButton;}});Object.defineProperty(exports,"PlatformPayButton",{enumerable:true,get:function get(){return _PlatformPayButton.PlatformPayButton;}});Object.defineProperty(exports,"StripeContainer",{enumerable:true,get:function get(){return _StripeContainer.StripeContainer;}});Object.defineProperty(exports,"StripeProvider",{enumerable:true,get:function get(){return _StripeProvider.StripeProvider;}});Object.defineProperty(exports,"initStripe",{enumerable:true,get:function get(){return _StripeProvider.initStripe;}});Object.defineProperty(exports,"useApplePay",{enumerable:true,get:function get(){return _useApplePay.useApplePay;}});Object.defineProperty(exports,"useConfirmPayment",{enumerable:true,get:function get(){return _useConfirmPayment.useConfirmPayment;}});Object.defineProperty(exports,"useConfirmSetupIntent",{enumerable:true,get:function get(){return _useConfirmSetupIntent.useConfirmSetupIntent;}});Object.defineProperty(exports,"useFinancialConnectionsSheet",{enumerable:true,get:function get(){return _useFinancialConnectionsSheet.useFinancialConnectionsSheet;}});Object.defineProperty(exports,"useGooglePay",{enumerable:true,get:function get(){return _useGooglePay.useGooglePay;}});Object.defineProperty(exports,"usePaymentSheet",{enumerable:true,get:function get(){return _usePaymentSheet.usePaymentSheet;}});Object.defineProperty(exports,"usePlatformPay",{enumerable:true,get:function get(){return _usePlatformPay.usePlatformPay;}});Object.defineProperty(exports,"useStripe",{enumerable:true,get:function get(){return _useStripe.useStripe;}});var _useConfirmPayment=require("./hooks/useConfirmPayment");var _useConfirmSetupIntent=require("./hooks/useConfirmSetupIntent");var _useStripe=require("./hooks/useStripe");var _usePlatformPay=require("./hooks/usePlatformPay");var _useApplePay=require("./hooks/useApplePay");var _usePaymentSheet=require("./hooks/usePaymentSheet");var _useGooglePay=require("./hooks/useGooglePay");var _useFinancialConnectionsSheet=require("./hooks/useFinancialConnectionsSheet");var _StripeProvider=require("./components/StripeProvider");var _CardField=require("./components/CardField");var _CardForm=require("./components/CardForm");var _ApplePayButton=require("./components/ApplePayButton");var _AuBECSDebitForm=require("./components/AuBECSDebitForm");var _StripeContainer=require("./components/StripeContainer");var _GooglePayButton=require("./components/GooglePayButton");var _AddToWalletButton=require("./components/AddToWalletButton");var _AddressSheet=require("./components/AddressSheet");var _PlatformPayButton=require("./components/PlatformPayButton");var _functions=require("./functions");Object.keys(_functions).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_functions[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _functions[key];}});});var _index=require("./types/index");Object.keys(_index).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_index[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _index[key];}});});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.tsx"],"sourcesContent":["// hooks\nexport { useConfirmPayment } from './hooks/useConfirmPayment';\nexport { useConfirmSetupIntent } from './hooks/useConfirmSetupIntent';\nexport { useStripe } from './hooks/useStripe';\nexport { usePlatformPay } from './hooks/usePlatformPay';\nexport { useApplePay
|
|
1
|
+
{"version":3,"names":[],"sources":["index.tsx"],"sourcesContent":["// hooks\nexport { useConfirmPayment } from './hooks/useConfirmPayment';\nexport { useConfirmSetupIntent } from './hooks/useConfirmSetupIntent';\nexport { useStripe } from './hooks/useStripe';\nexport { usePlatformPay } from './hooks/usePlatformPay';\nexport { useApplePay } from './hooks/useApplePay';\nexport type { Props as UseApplePayProps } from './hooks/useApplePay';\nexport { usePaymentSheet } from './hooks/usePaymentSheet';\nexport { useGooglePay } from './hooks/useGooglePay';\nexport { useFinancialConnectionsSheet } from './hooks/useFinancialConnectionsSheet';\n\n//components\nexport { initStripe, StripeProvider } from './components/StripeProvider';\nexport type { Props as StripeProviderProps } from './components/StripeProvider';\nexport { CardField } from './components/CardField';\nexport type { Props as CardFieldProps } from './components/CardField';\nexport { CardForm } from './components/CardForm';\nexport type { Props as CardFormProps } from './components/CardForm';\nexport { ApplePayButton } from './components/ApplePayButton';\nexport type { Props as ApplePayButtonProps } from './components/ApplePayButton';\nexport { AuBECSDebitForm } from './components/AuBECSDebitForm';\nexport type { Props as AuBECSDebitFormProps } from './components/AuBECSDebitForm';\nexport { StripeContainer } from './components/StripeContainer';\nexport type { Props as StripeContainerProps } from './components/StripeContainer';\nexport { GooglePayButton } from './components/GooglePayButton';\nexport type { Props as GooglePayButtonProps } from './components/GooglePayButton';\nexport { AddToWalletButton } from './components/AddToWalletButton';\nexport type { Props as AddToWalletButtonProps } from './components/AddToWalletButton';\nexport { AddressSheet } from './components/AddressSheet';\nexport type { Props as AddressSheetProps } from './components/AddressSheet';\nexport { PlatformPayButton } from './components/PlatformPayButton';\nexport type { Props as PlatformPayButtonProps } from './components/PlatformPayButton';\n\nexport * from './functions';\n\nexport * from './types/index';\n"],"mappings":"+yFACA,4DACA,oEACA,4CACA,sDACA,gDAEA,wDACA,kDACA,kFAGA,2DAEA,iDAEA,+CAEA,2DAEA,6DAEA,6DAEA,6DAEA,iEAEA,uDAEA,iEAGA,gWAEA"}
|