@stripe/stripe-react-native 0.23.2 → 0.24.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 +39 -9
- package/android/gradle.properties +2 -2
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +72 -16
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +19 -2
- package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +1 -1
- package/ios/ApplePayButtonManager.m +1 -0
- package/ios/ApplePayButtonView.swift +2 -0
- package/ios/ApplePayUtils.swift +116 -15
- package/ios/ApplePayViewController.swift +13 -0
- package/ios/Errors.swift +1 -0
- package/ios/StripeSdk+PaymentSheet.swift +166 -0
- package/ios/StripeSdk-Bridging-Header.h +1 -0
- package/ios/StripeSdk.m +17 -1
- package/ios/StripeSdk.swift +67 -134
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/components/PlatformPayButton.js +1 -1
- package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js.map +1 -1
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- package/lib/commonjs/types/Errors.js +1 -1
- package/lib/commonjs/types/Errors.js.map +1 -1
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/PlatformPay.js +1 -1
- package/lib/commonjs/types/PlatformPay.js.map +1 -1
- package/lib/commonjs/types/components/ApplePayButtonComponent.js.map +1 -1
- package/lib/module/NativeStripeSdk.js.map +1 -1
- package/lib/module/components/PlatformPayButton.js +1 -1
- package/lib/module/components/PlatformPayButton.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/hooks/usePaymentSheet.js +1 -1
- package/lib/module/hooks/usePaymentSheet.js.map +1 -1
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- package/lib/module/types/Errors.js +1 -1
- package/lib/module/types/Errors.js.map +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/module/types/PlatformPay.js +1 -1
- package/lib/module/types/PlatformPay.js.map +1 -1
- package/lib/module/types/components/ApplePayButtonComponent.js.map +1 -1
- package/lib/typescript/src/NativeStripeSdk.d.ts +3 -1
- package/lib/typescript/src/components/PlatformPayButton.d.ts +6 -1
- package/lib/typescript/src/functions.d.ts +1 -1
- package/lib/typescript/src/hooks/usePaymentSheet.d.ts +1 -1
- package/lib/typescript/src/hooks/useStripe.d.ts +1 -1
- package/lib/typescript/src/types/Errors.d.ts +2 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +17 -1
- package/lib/typescript/src/types/PlatformPay.d.ts +64 -1
- package/lib/typescript/src/types/components/ApplePayButtonComponent.d.ts +1 -0
- package/package.json +2 -2
- package/src/NativeStripeSdk.tsx +13 -1
- package/src/components/PlatformPayButton.tsx +31 -3
- package/src/functions.ts +34 -21
- package/src/hooks/usePaymentSheet.tsx +2 -2
- package/src/hooks/useStripe.tsx +8 -4
- package/src/types/Errors.ts +1 -0
- package/src/types/PaymentSheet.ts +33 -3
- package/src/types/PlatformPay.ts +72 -1
- package/src/types/components/ApplePayButtonComponent.ts +1 -0
- package/stripe-react-native.podspec +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ApplePaySheetErrorType","ContactField","InvalidShippingField","ApplePayMerchantCapability","ApplePayShippingType","BillingAddressFormat","ButtonType","ButtonStyle","PaymentType","IntervalUnit"],"sources":["PlatformPay.ts"],"sourcesContent":["import type { Result as Token } from './Token';\nimport type { Result as PaymentMethod } from './PaymentMethod';\nimport type { Result as PaymentIntent } from './PaymentIntent';\nimport type { Result as SetupIntent } from './SetupIntent';\nimport type { StripeError, PlatformPayError } from './Errors';\nimport type { ShippingContact as ApplePayShippingContact } from './ApplePay';\nimport type { IsSupportedParams } from './GooglePay';\n\nexport type ApplePaySheetError =\n | {\n errorType: ApplePaySheetErrorType.InvalidShippingAddress;\n field: InvalidShippingField;\n message?: string;\n }\n | {\n errorType:\n | ApplePaySheetErrorType.UnserviceableShippingAddress\n | ApplePaySheetErrorType.InvalidCouponCode\n | ApplePaySheetErrorType.ExpiredCouponCode;\n message?: string;\n };\n\nexport enum ApplePaySheetErrorType {\n InvalidShippingAddress = 'InvalidShippingAddress',\n UnserviceableShippingAddress = 'UnserviceableShippingAddress',\n InvalidCouponCode = 'InvalidCouponCode',\n ExpiredCouponCode = 'ExpiredCouponCode',\n}\n\nexport enum ContactField {\n EmailAddress = 'emailAddress',\n Name = 'name',\n PhoneNumber = 'phoneNumber',\n PhoneticName = 'phoneticName',\n PostalAddress = 'postalAddress',\n}\n\nexport enum InvalidShippingField {\n Street = 'street',\n City = 'city',\n SubAdministrativeArea = 'subAdministrativeArea',\n State = 'state',\n PostalCode = 'postalCode',\n Country = 'country',\n CountryCode = 'countryCode',\n SubLocality = 'subLocality',\n}\n\nexport type ApplePayBaseParams = {\n /** ISO 3166-1 alpha-2 country code where the transaction is processed. */\n merchantCountryCode: string;\n /** ISO 4217 alphabetic currency code. */\n currencyCode: string;\n /** The SDK accepts Amex, Mastercard, Visa, and Discover for Apple Pay by default. Set this property to enable other card networks, for example: [\"JCB\", \"barcode\", \"chinaUnionPay\"]. A full list of possible networks can be found at https://developer.apple.com/documentation/passkit/pkpaymentnetwork. */\n additionalEnabledNetworks?: Array<string>;\n /** The list of items that describe a purchase. For example: total, tax, discount, and grand total. */\n cartItems: Array<CartSummaryItem>;\n /** The list of fields that you need for a shipping contact in order to process the transaction. If provided, you must implement the PlatformPayButton component's `onShippingContactSelected` callback and call `updatePlatformPaySheet` from there.*/\n requiredShippingAddressFields?: Array<ContactField>;\n /** The list of fields that you need for a billing contact in order to process the transaction. */\n requiredBillingContactFields?: Array<ContactField>;\n /** An array of shipping method objects that describe the supported shipping methods. If provided, you must implement the PlatformPayButton component's `onShippingMethodSelected` callback and call `updatePlatformPaySheet` from there. */\n shippingMethods?: Array<ShippingMethod>;\n /** Set the payment capabilities you support. If set, 3DS is required. */\n merchantCapabilities?: Array<ApplePayMerchantCapability>;\n /** An optional value that indicates how to ship purchased items. Defaults to 'Shipping'.*/\n shippingType?: ApplePayShippingType;\n /** A list of two-letter ISO 3166 country codes for limiting payment to cards from specific countries or regions. */\n supportedCountries?: Array<string>;\n};\n\nexport type ApplePayPaymentMethodParams = {\n /** Set this value to true to display the coupon code field, or pass the 'couponCode' field to autofill with a coupon code. Defaults to false. If true, you must implement the PlatformPayButton component's `onCouponCodeEntered` callback and call `updatePlatformPaySheet` from there. */\n supportsCouponCode?: boolean;\n /** Set this value to autofill with a coupon code. If provided, you must implement the PlatformPayButton component's `onCouponCodeEntered` callback and call `updatePlatformPaySheet` from there. */\n couponCode?: string;\n};\n\nexport enum ApplePayMerchantCapability {\n /** Required. This value must be supplied. */\n Supports3DS = 'supports3DS',\n /** Optional. If present, only transactions that are categorized as credit cards are allowed. */\n SupportsCredit = 'supportsCredit',\n /** Optional. If present, only transactions that are categorized as debit cards are allowed. */\n SupportsDebit = 'supportsDebit',\n}\n\n/** A type that indicates how to ship purchased items. */\nexport enum ApplePayShippingType {\n /** Default. */\n Shipping = 'shipping',\n Delivery = 'delivery',\n StorePickup = 'storePickup',\n ServicePickup = 'servicePickup',\n}\n\nexport type GooglePayBaseParams = {\n /**\n * Set to true to run in a test environment with relaxed application / merchant requirements. This environment is suggested for early development and for easily testing SDK.\n - Does not require the application to be uploaded to the Google Play Store.\n - Does not require a Google Pay Developer Profile.\n - It uses production data, but at the end of the transaction you will receive a fake and non chargeable payment credential.\n - The user will see a warning message that the app is not recognized/verified.\n */\n testEnv: boolean;\n /** ISO 3166-1 alpha-2 country code where the transaction is processed. */\n merchantCountryCode: string;\n /** ISO 4217 alphabetic currency code. */\n currencyCode: string;\n /** Your merchant name, displayed in the Google Pay sheet. */\n merchantName?: string;\n /** Set to true to request an email address. Defaults to false. */\n isEmailRequired?: boolean;\n /** Set to false if you don't support credit cards. Defaults to true. */\n allowCreditCards?: boolean;\n /** If true, Google Pay is considered \"available\" if the customer's Google Pay wallet has an existing payment method. Defaults to false. */\n existingPaymentMethodRequired?: boolean;\n /** Describes the configuration for billing address collection in the Google Pay sheet. */\n billingAddressConfig?: {\n /** Set to true if billing address is required for payment. Defaults to false. */\n isRequired?: boolean;\n /** Set to true if phone number is required for payment. Defaults to false. */\n isPhoneNumberRequired?: boolean;\n /** Defines what address fields to collect. Defaults to BillingAddressFormat.Min */\n format?: BillingAddressFormat;\n };\n};\n\nexport type GooglePayPaymentMethodParams = {\n /** Total monetary value of the transaction. */\n amount: number;\n /** Describes the configuration for shipping address collection in the Google Pay sheet. */\n shippingAddressConfig?: {\n /** Set to true if shipping address is required for payment. Defaults to false. */\n isRequired?: boolean;\n /** Set to true if phone number is required for payment. Defaults to false. */\n isPhoneNumberRequired?: boolean;\n /** Set of ISO 3166-1 alpha-2 country code values of the countries where shipping is allowed. Defaults to all shipping address countries. */\n allowedCountryCodes?: Array<string>;\n };\n};\n\nexport enum BillingAddressFormat {\n /** Collect name, street address, locality, region, country code, and postal code. */\n Full = 'FULL',\n /** Collect name, country code, and postal code (default). */\n Min = 'MIN',\n}\n\nexport type PaymentMethodParams = {\n /** Defines Google Pay behavior. Android only. */\n googlePay?: GooglePayBaseParams & GooglePayPaymentMethodParams;\n /** Defines Apple Pay behavior. iOS only. */\n applePay?: ApplePayBaseParams & ApplePayPaymentMethodParams;\n};\n\nexport type ConfirmParams = {\n /** Defines Google Pay behavior. Android only. */\n googlePay?: GooglePayBaseParams;\n /** Defines Apple Pay behavior. iOS only. */\n applePay?: ApplePayBaseParams;\n};\n\nexport enum ButtonType {\n /** A button with the Apple Pay or Google Pay logo only, useful when an additional call to action isn't needed. */\n Default = 0,\n /** A button useful for product purchases. */\n Buy = 1,\n /** A button useful for booking trips, flights, or other experiences. */\n Book = 6,\n /** A button useful for purchase experiences that include other payment buttons that start with “Check out”. */\n Checkout = 5,\n /** A button used by approved nonprofit organization that lets people make donations. */\n Donate = 4,\n /** A button useful for placing orders for such as like meals or flowers. */\n Order = 11,\n /** A button useful for purchasing a subscription such as a gym membership or meal-kit delivery service. */\n Subscribe = 7,\n /** iOS only. A button useful for prompting the user to set up a card. */\n SetUp = 2,\n /** iOS only. A button useful for paying bills or invoices. */\n InStore = 3,\n /** iOS only. A button useful for adding money to a card, account, or payment system.*/\n Reload = 8,\n /** iOS only. A button useful for adding money to a card, account, or payment system. */\n AddMoney = 9,\n /** iOS only. A button useful for adding money to a card, account, or payment system. */\n TopUp = 10,\n /** iOS only. A button useful for renting items such as cars or scooters. */\n Rent = 12,\n /** iOS only. A button useful supporting people give money to projects, causes, organizations, and other entities.*/\n Support = 13,\n /** iOS only. A button useful to help people contribute money to projects, causes, organizations, and other entities. */\n Contribute = 14,\n /** iOS only. A button useful useful for letting people tip for goods or services. */\n Tip = 15,\n /** iOS only. A button useful for general purchases. */\n Continue = 16,\n /** Android only. A button useful for general payments. */\n Pay = 1000,\n /** Android only. A plain white button with the Google Pay logo. Use when you show Google Pay as a payment option in your payment flows. */\n GooglePayMark = 1001,\n}\n\n/** iOS only. */\nexport enum ButtonStyle {\n /** A white button with black lettering. */\n White = 0,\n /** A white button with black lettering and a black outline. */\n WhiteOutline = 1,\n /** A black button with white lettering. */\n Black = 2,\n /** Default. A button that automatically changes its appearance when the user switches between Light Mode and Dark Mode. */\n Automatic = 3,\n}\n\n/** iOS only. */\nexport type CartSummaryItem =\n | DeferredCartSummaryItem\n | ImmediateCartSummaryItem\n | RecurringCartSummaryItem;\n\n/** iOS only. */\nexport enum PaymentType {\n Deferred = 'Deferred',\n Immediate = 'Immediate',\n Recurring = 'Recurring',\n}\n\n/** iOS only. Use this type for a payment that occurs in the future, such as a pre-order. Only available on iOS 15 and up, otherwise falls back to ImmediateCartSummaryItem. */\nexport type DeferredCartSummaryItem = {\n paymentType: PaymentType.Deferred;\n /** The unix timestamp of the date, in the future, of the payment. Measured in seconds. */\n deferredDate: number;\n label: string;\n amount: string;\n};\n\n/** iOS only. Use this type for payments that will occur immediately. */\nexport type ImmediateCartSummaryItem = {\n paymentType: PaymentType.Immediate;\n /** When creating items for estimates or charges whose final value is not yet known, set this to true. */\n isPending?: boolean;\n label: string;\n amount: string;\n};\n\n/** iOS only. Use this type for payments that occur more than once, such as a subscription. Only available on iOS 15 and up, otherwise falls back to ImmediateCartSummaryItem.*/\nexport type RecurringCartSummaryItem = {\n paymentType: PaymentType.Recurring;\n /** The amount of time – in calendar units such as Day, Month, or Year – that represents a fraction of the total payment interval. For example, if you set the intervalUnit to 'Month' and intervalCount to 3, then the payment interval is three months.*/\n intervalUnit: IntervalUnit;\n /** The number of interval units that make up the total payment interval. For example, if you set the intervalUnit to 'Month' and intervalCount to 3, then the payment interval is three months.*/\n intervalCount: number;\n /** The unix timestamp of the start date. Measured in seconds. */\n startDate?: number;\n /** The unix timestamp of the end date. Measured in seconds. */\n endDate?: number;\n label: string;\n amount: string;\n};\n\n/** iOS only. */\nexport enum IntervalUnit {\n Minute = 'minute',\n Hour = 'hour',\n Day = 'day',\n Month = 'month',\n Year = 'year',\n}\n\n/** iOS only. */\nexport type ShippingMethod = {\n /** A short, localized description. */\n label: string;\n /** The cost associated with this shipping option. */\n amount: string;\n /** When creating items for estimates or charges whose final value is not yet known, set this to true. */\n isPending?: boolean;\n /** A unique identifier for the shipping method. */\n identifier: string;\n /** A user-readable description of the shipping method. For example “Ships in 24 hours.” Don't repeat the content of the 'label' property. */\n detail?: string;\n /** The unix timestamp of the start date of the expected range of delivery or shipping dates for a package, or the time range when an item is available for pickup. Measured in seconds. */\n startDate?: number;\n /** The unix timestamp of the end date of the expected range of delivery or shipping dates for a package, or the time range when an item is available for pickup. Measured in seconds. */\n endDate?: number;\n};\n\n/** iOS only. */\nexport type ShippingContact = ApplePayShippingContact;\n\n/** Android only. */\nexport type IsGooglePaySupportedParams = IsSupportedParams;\n\nexport type PaymentMethodResult =\n | {\n paymentMethod: PaymentMethod;\n error?: undefined;\n }\n | {\n paymentMethod?: undefined;\n error: StripeError<PlatformPayError>;\n };\n\nexport type TokenResult =\n | {\n token: Token;\n error?: undefined;\n }\n | {\n token?: undefined;\n error: StripeError<PlatformPayError>;\n };\n\nexport type ConfirmPaymentResult =\n | {\n paymentIntent: PaymentIntent;\n error?: StripeError<PlatformPayError>;\n }\n | {\n paymentIntent?: undefined;\n error: StripeError<PlatformPayError>;\n };\n\nexport type ConfirmSetupIntentResult =\n | {\n setupIntent: SetupIntent;\n error?: StripeError<PlatformPayError>;\n }\n | {\n setupIntent?: undefined;\n error: StripeError<PlatformPayError>;\n };\n"],"mappings":"iUAsBYA,uBAAsB,iEAAtBA,sBAAsB,EAAtBA,sBAAsB,oDAAtBA,sBAAsB,gEAAtBA,sBAAsB,0CAAtBA,sBAAsB,6CAAtBA,sBAAsB,kCAAtBA,sBAAsB,SAOtBC,aAAY,6CAAZA,YAAY,EAAZA,YAAY,gCAAZA,YAAY,gBAAZA,YAAY,8BAAZA,YAAY,gCAAZA,YAAY,qCAAZA,YAAY,wBAAZA,YAAY,SAQZC,qBAAoB,6DAApBA,oBAAoB,EAApBA,oBAAoB,oBAApBA,oBAAoB,gBAApBA,oBAAoB,kDAApBA,oBAAoB,kBAApBA,oBAAoB,4BAApBA,oBAAoB,sBAApBA,oBAAoB,8BAApBA,oBAAoB,iCAApBA,oBAAoB,gCAApBA,oBAAoB,SAyCpBC,2BAA0B,yEAA1BA,0BAA0B,EAA1BA,0BAA0B,8BAA1BA,0BAA0B,oCAA1BA,0BAA0B,qCAA1BA,0BAA0B,sCAA1BA,0BAA0B,SAU1BC,qBAAoB,6DAApBA,oBAAoB,EAApBA,oBAAoB,wBAApBA,oBAAoB,wBAApBA,oBAAoB,8BAApBA,oBAAoB,qCAApBA,oBAAoB,gCAApBA,oBAAoB,SAsDpBC,qBAAoB,6DAApBA,oBAAoB,EAApBA,oBAAoB,gBAApBA,oBAAoB,iBAApBA,oBAAoB,gCAApBA,oBAAoB,SAqBpBC,WAAU,yCAAVA,UAAU,EAAVA,UAAU,CAAVA,UAAU,yBAAVA,UAAU,CAAVA,UAAU,iBAAVA,UAAU,CAAVA,UAAU,mBAAVA,UAAU,CAAVA,UAAU,2BAAVA,UAAU,CAAVA,UAAU,uBAAVA,UAAU,CAAVA,UAAU,sBAAVA,UAAU,CAAVA,UAAU,6BAAVA,UAAU,CAAVA,UAAU,qBAAVA,UAAU,CAAVA,UAAU,yBAAVA,UAAU,CAAVA,UAAU,uBAAVA,UAAU,CAAVA,UAAU,2BAAVA,UAAU,CAAVA,UAAU,sBAAVA,UAAU,CAAVA,UAAU,oBAAVA,UAAU,CAAVA,UAAU,0BAAVA,UAAU,CAAVA,UAAU,gCAAVA,UAAU,CAAVA,UAAU,kBAAVA,UAAU,CAAVA,UAAU,4BAAVA,UAAU,CAAVA,UAAU,oBAAVA,UAAU,CAAVA,UAAU,2CAAVA,UAAU,sBAAVA,UAAU,SA0CVC,YAAW,2CAAXA,WAAW,EAAXA,WAAW,CAAXA,WAAW,qBAAXA,WAAW,CAAXA,WAAW,mCAAXA,WAAW,CAAXA,WAAW,qBAAXA,WAAW,CAAXA,WAAW,gCAAXA,WAAW,uBAAXA,WAAW,SAkBXC,YAAW,2CAAXA,WAAW,EAAXA,WAAW,wBAAXA,WAAW,0BAAXA,WAAW,6BAAXA,WAAW,uBAAXA,WAAW,SAwCXC,aAAY,6CAAZA,YAAY,EAAZA,YAAY,oBAAZA,YAAY,gBAAZA,YAAY,cAAZA,YAAY,kBAAZA,YAAY,mBAAZA,YAAY,wBAAZA,YAAY"}
|
|
1
|
+
{"version":3,"names":["ApplePaySheetErrorType","ContactField","InvalidShippingField","PaymentRequestType","ApplePayMerchantCapability","ApplePayShippingType","BillingAddressFormat","ButtonType","ButtonStyle","PaymentType","IntervalUnit"],"sources":["PlatformPay.ts"],"sourcesContent":["import type { Result as Token } from './Token';\nimport type { Result as PaymentMethod } from './PaymentMethod';\nimport type { Result as PaymentIntent } from './PaymentIntent';\nimport type { Result as SetupIntent } from './SetupIntent';\nimport type { StripeError, PlatformPayError } from './Errors';\nimport type { ShippingContact as ApplePayShippingContact } from './ApplePay';\nimport type { IsSupportedParams } from './GooglePay';\n\nexport type ApplePaySheetError =\n | {\n errorType: ApplePaySheetErrorType.InvalidShippingAddress;\n field: InvalidShippingField;\n message?: string;\n }\n | {\n errorType:\n | ApplePaySheetErrorType.UnserviceableShippingAddress\n | ApplePaySheetErrorType.InvalidCouponCode\n | ApplePaySheetErrorType.ExpiredCouponCode;\n message?: string;\n };\n\nexport enum ApplePaySheetErrorType {\n InvalidShippingAddress = 'InvalidShippingAddress',\n UnserviceableShippingAddress = 'UnserviceableShippingAddress',\n InvalidCouponCode = 'InvalidCouponCode',\n ExpiredCouponCode = 'ExpiredCouponCode',\n}\n\nexport enum ContactField {\n EmailAddress = 'emailAddress',\n Name = 'name',\n PhoneNumber = 'phoneNumber',\n PhoneticName = 'phoneticName',\n PostalAddress = 'postalAddress',\n}\n\nexport enum InvalidShippingField {\n Street = 'street',\n City = 'city',\n SubAdministrativeArea = 'subAdministrativeArea',\n State = 'state',\n PostalCode = 'postalCode',\n Country = 'country',\n CountryCode = 'countryCode',\n SubLocality = 'subLocality',\n}\n\nexport type ApplePayBaseParams = {\n /** ISO 3166-1 alpha-2 country code where the transaction is processed. */\n merchantCountryCode: string;\n /** ISO 4217 alphabetic currency code. */\n currencyCode: string;\n /** The SDK accepts Amex, Mastercard, Visa, and Discover for Apple Pay by default. Set this property to enable other card networks, for example: [\"JCB\", \"barcode\", \"chinaUnionPay\"]. A full list of possible networks can be found at https://developer.apple.com/documentation/passkit/pkpaymentnetwork. */\n additionalEnabledNetworks?: Array<string>;\n /** The list of items that describe a purchase. For example: total, tax, discount, and grand total. */\n cartItems: Array<CartSummaryItem>;\n /** The list of fields that you need for a shipping contact in order to process the transaction. If provided, you must implement the PlatformPayButton component's `onShippingContactSelected` callback and call `updatePlatformPaySheet` from there.*/\n requiredShippingAddressFields?: Array<ContactField>;\n /** The list of fields that you need for a billing contact in order to process the transaction. */\n requiredBillingContactFields?: Array<ContactField>;\n /** An array of shipping method objects that describe the supported shipping methods. If provided, you must implement the PlatformPayButton component's `onShippingMethodSelected` callback and call `updatePlatformPaySheet` from there. */\n shippingMethods?: Array<ShippingMethod>;\n /** Set the payment capabilities you support. If set, 3DS is required. */\n merchantCapabilities?: Array<ApplePayMerchantCapability>;\n /** An optional value that indicates how to ship purchased items. Defaults to 'Shipping'.*/\n shippingType?: ApplePayShippingType;\n /** A list of two-letter ISO 3166 country codes for limiting payment to cards from specific countries or regions. */\n supportedCountries?: Array<string>;\n};\n\nexport type ApplePayConfirmParams = {\n /** A typical request is for a one-time payment. To support different types of payment requests, include a PaymentRequestType. Only supported on iOS 16 and up. */\n request?:\n | RecurringPaymentRequest\n | AutomaticReloadPaymentRequest\n | MultiMerchantRequest;\n};\n\nexport enum PaymentRequestType {\n Recurring = 'Recurring',\n AutomaticReload = 'AutomaticReload',\n MultiMerchant = 'MultiMerchant',\n}\n\n/** Use this for a recurring payment, typically a subscription. */\nexport type RecurringPaymentRequest = {\n type: PaymentRequestType.Recurring;\n /** A description that you provide of the recurring payment and that Apple Pay displays to the user in the sheet. */\n description: string;\n /** A URL to a web page where the user can update or delete the payment method for the recurring payment. */\n managementUrl: string;\n /** The regular billing cycle for the payment, including start and end dates, an interval, and an interval count. */\n billing: RecurringCartSummaryItem;\n /** Same as the billing property, but use this if the purchase has a trial period. */\n trialBilling?: RecurringCartSummaryItem;\n /** A localized billing agreement that the sheet displays to the user before the user authorizes the payment. */\n billingAgreement?: string;\n /** A URL you provide to receive life-cycle notifications from the Apple Pay servers about the Apple Pay merchant token for the recurring payment.\n * For more information about handling merchant token life-cycle notifications, see Receiving and handling merchant token notifications.\n */\n tokenNotificationURL?: string;\n};\n\n/** Use this for an automatic reload or refill payment, such as a store card top-up. */\nexport type AutomaticReloadPaymentRequest = {\n type: PaymentRequestType.AutomaticReload;\n /** A description that you provide of the recurring payment and that Apple Pay displays to the user in the sheet. */\n description: string;\n /** A URL to a web page where the user can update or delete the payment method for the recurring payment. */\n managementUrl: string;\n /** A short, localized description of the item. */\n label: string;\n /** This is the amount that is automatically applied to the account when the account balance drops below the threshold amount. */\n reloadAmount: string;\n /** The balance an account reaches before you apply the automatic reload amount. */\n thresholdAmount: string;\n /** A localized billing agreement that the sheet displays to the user before the user authorizes the payment. */\n billingAgreement?: string;\n /** A URL you provide to receive life-cycle notifications from the Apple Pay servers about the Apple Pay merchant token for the recurring payment.\n * For more information about handling merchant token life-cycle notifications, see Receiving and handling merchant token notifications.\n */\n tokenNotificationURL?: string;\n};\n\n/** Use this to indicate payments for multiple merchants. */\nexport type MultiMerchantRequest = {\n type: PaymentRequestType.MultiMerchant;\n merchants: Array<{\n /** The Apple Pay merchant identifier. */\n merchantIdentifier: string;\n /** An external identifier for the merchant. */\n externalIdentifier: string;\n /** The merchant’s display name that the Apple Pay server associates with the payment token. */\n merchantName: string;\n /** The merchant’s top-level domain that the Apple Pay server associates with the payment token. */\n merchantDomain?: string;\n /** The amount to authorize for the payment token. */\n amount: string;\n }>;\n};\n\nexport type ApplePayPaymentMethodParams = {\n /** Set this value to true to display the coupon code field, or pass the 'couponCode' field to autofill with a coupon code. Defaults to false. If true, you must implement the PlatformPayButton component's `onCouponCodeEntered` callback and call `updatePlatformPaySheet` from there. */\n supportsCouponCode?: boolean;\n /** Set this value to autofill with a coupon code. If provided, you must implement the PlatformPayButton component's `onCouponCodeEntered` callback and call `updatePlatformPaySheet` from there. */\n couponCode?: string;\n};\n\nexport enum ApplePayMerchantCapability {\n /** Required. This value must be supplied. */\n Supports3DS = 'supports3DS',\n /** Optional. If present, only transactions that are categorized as credit cards are allowed. */\n SupportsCredit = 'supportsCredit',\n /** Optional. If present, only transactions that are categorized as debit cards are allowed. */\n SupportsDebit = 'supportsDebit',\n}\n\n/** A type that indicates how to ship purchased items. */\nexport enum ApplePayShippingType {\n /** Default. */\n Shipping = 'shipping',\n Delivery = 'delivery',\n StorePickup = 'storePickup',\n ServicePickup = 'servicePickup',\n}\n\nexport type GooglePayBaseParams = {\n /**\n * Set to true to run in a test environment with relaxed application / merchant requirements. This environment is suggested for early development and for easily testing SDK.\n - Does not require the application to be uploaded to the Google Play Store.\n - Does not require a Google Pay Developer Profile.\n - It uses production data, but at the end of the transaction you will receive a fake and non chargeable payment credential.\n - The user will see a warning message that the app is not recognized/verified.\n */\n testEnv: boolean;\n /** ISO 3166-1 alpha-2 country code where the transaction is processed. */\n merchantCountryCode: string;\n /** ISO 4217 alphabetic currency code. */\n currencyCode: string;\n /** Your merchant name, displayed in the Google Pay sheet. */\n merchantName?: string;\n /** Set to true to request an email address. Defaults to false. */\n isEmailRequired?: boolean;\n /** Set to false if you don't support credit cards. Defaults to true. */\n allowCreditCards?: boolean;\n /** If true, Google Pay is considered \"available\" if the customer's Google Pay wallet has an existing payment method. Defaults to false. */\n existingPaymentMethodRequired?: boolean;\n /** Describes the configuration for billing address collection in the Google Pay sheet. */\n billingAddressConfig?: {\n /** Set to true if billing address is required for payment. Defaults to false. */\n isRequired?: boolean;\n /** Set to true if phone number is required for payment. Defaults to false. */\n isPhoneNumberRequired?: boolean;\n /** Defines what address fields to collect. Defaults to BillingAddressFormat.Min */\n format?: BillingAddressFormat;\n };\n};\n\nexport type GooglePayPaymentMethodParams = {\n /** Total monetary value of the transaction. */\n amount: number;\n /** Describes the configuration for shipping address collection in the Google Pay sheet. */\n shippingAddressConfig?: {\n /** Set to true if shipping address is required for payment. Defaults to false. */\n isRequired?: boolean;\n /** Set to true if phone number is required for payment. Defaults to false. */\n isPhoneNumberRequired?: boolean;\n /** Set of ISO 3166-1 alpha-2 country code values of the countries where shipping is allowed. Defaults to all shipping address countries. */\n allowedCountryCodes?: Array<string>;\n };\n};\n\nexport enum BillingAddressFormat {\n /** Collect name, street address, locality, region, country code, and postal code. */\n Full = 'FULL',\n /** Collect name, country code, and postal code (default). */\n Min = 'MIN',\n}\n\nexport type PaymentMethodParams = {\n /** Defines Google Pay behavior. Android only. */\n googlePay?: GooglePayBaseParams & GooglePayPaymentMethodParams;\n /** Defines Apple Pay behavior. iOS only. */\n applePay?: ApplePayBaseParams & ApplePayPaymentMethodParams;\n};\n\nexport type ConfirmParams = {\n /** Defines Google Pay behavior. Android only. */\n googlePay?: GooglePayBaseParams;\n /** Defines Apple Pay behavior. iOS only. */\n applePay?: ApplePayBaseParams & ApplePayConfirmParams;\n};\n\nexport enum ButtonType {\n /** A button with the Apple Pay or Google Pay logo only, useful when an additional call to action isn't needed. */\n Default = 0,\n /** A button useful for product purchases. */\n Buy = 1,\n /** A button useful for booking trips, flights, or other experiences. */\n Book = 6,\n /** A button useful for purchase experiences that include other payment buttons that start with “Check out”. */\n Checkout = 5,\n /** A button used by approved nonprofit organization that lets people make donations. */\n Donate = 4,\n /** A button useful for placing orders for such as like meals or flowers. */\n Order = 11,\n /** A button useful for purchasing a subscription such as a gym membership or meal-kit delivery service. */\n Subscribe = 7,\n /** iOS only. A button useful for prompting the user to set up a card. */\n SetUp = 2,\n /** iOS only. A button useful for paying bills or invoices. */\n InStore = 3,\n /** iOS only. A button useful for adding money to a card, account, or payment system.*/\n Reload = 8,\n /** iOS only. A button useful for adding money to a card, account, or payment system. */\n AddMoney = 9,\n /** iOS only. A button useful for adding money to a card, account, or payment system. */\n TopUp = 10,\n /** iOS only. A button useful for renting items such as cars or scooters. */\n Rent = 12,\n /** iOS only. A button useful supporting people give money to projects, causes, organizations, and other entities.*/\n Support = 13,\n /** iOS only. A button useful to help people contribute money to projects, causes, organizations, and other entities. */\n Contribute = 14,\n /** iOS only. A button useful useful for letting people tip for goods or services. */\n Tip = 15,\n /** iOS only. A button useful for general purchases. */\n Continue = 16,\n /** Android only. A button useful for general payments. */\n Pay = 1000,\n /** Android only. A plain white button with the Google Pay logo. Use when you show Google Pay as a payment option in your payment flows. */\n GooglePayMark = 1001,\n}\n\n/** iOS only. */\nexport enum ButtonStyle {\n /** A white button with black lettering. */\n White = 0,\n /** A white button with black lettering and a black outline. */\n WhiteOutline = 1,\n /** A black button with white lettering. */\n Black = 2,\n /** Default. A button that automatically changes its appearance when the user switches between Light Mode and Dark Mode. */\n Automatic = 3,\n}\n\n/** iOS only. */\nexport type CartSummaryItem =\n | DeferredCartSummaryItem\n | ImmediateCartSummaryItem\n | RecurringCartSummaryItem;\n\n/** iOS only. */\nexport enum PaymentType {\n Deferred = 'Deferred',\n Immediate = 'Immediate',\n Recurring = 'Recurring',\n}\n\n/** iOS only. Use this type for a payment that occurs in the future, such as a pre-order. Only available on iOS 15 and up, otherwise falls back to ImmediateCartSummaryItem. */\nexport type DeferredCartSummaryItem = {\n paymentType: PaymentType.Deferred;\n /** The unix timestamp of the date, in the future, of the payment. Measured in seconds. */\n deferredDate: number;\n label: string;\n amount: string;\n};\n\n/** iOS only. Use this type for payments that will occur immediately. */\nexport type ImmediateCartSummaryItem = {\n paymentType: PaymentType.Immediate;\n /** When creating items for estimates or charges whose final value is not yet known, set this to true. */\n isPending?: boolean;\n label: string;\n amount: string;\n};\n\n/** iOS only. Use this type for payments that occur more than once, such as a subscription. Only available on iOS 15 and up, otherwise falls back to ImmediateCartSummaryItem.*/\nexport type RecurringCartSummaryItem = {\n paymentType: PaymentType.Recurring;\n /** The amount of time – in calendar units such as Day, Month, or Year – that represents a fraction of the total payment interval. For example, if you set the intervalUnit to 'Month' and intervalCount to 3, then the payment interval is three months.*/\n intervalUnit: IntervalUnit;\n /** The number of interval units that make up the total payment interval. For example, if you set the intervalUnit to 'Month' and intervalCount to 3, then the payment interval is three months.*/\n intervalCount: number;\n /** The unix timestamp of the start date. Measured in seconds. */\n startDate?: number;\n /** The unix timestamp of the end date. Measured in seconds. */\n endDate?: number;\n label: string;\n amount: string;\n};\n\n/** iOS only. */\nexport enum IntervalUnit {\n Minute = 'minute',\n Hour = 'hour',\n Day = 'day',\n Month = 'month',\n Year = 'year',\n}\n\n/** iOS only. */\nexport type ShippingMethod = {\n /** A short, localized description. */\n label: string;\n /** The cost associated with this shipping option. */\n amount: string;\n /** When creating items for estimates or charges whose final value is not yet known, set this to true. */\n isPending?: boolean;\n /** A unique identifier for the shipping method. */\n identifier: string;\n /** A user-readable description of the shipping method. For example “Ships in 24 hours.” Don't repeat the content of the 'label' property. */\n detail?: string;\n /** The unix timestamp of the start date of the expected range of delivery or shipping dates for a package, or the time range when an item is available for pickup. Measured in seconds. */\n startDate?: number;\n /** The unix timestamp of the end date of the expected range of delivery or shipping dates for a package, or the time range when an item is available for pickup. Measured in seconds. */\n endDate?: number;\n};\n\n/** iOS only. */\nexport type ShippingContact = ApplePayShippingContact;\n\n/** Android only. */\nexport type IsGooglePaySupportedParams = IsSupportedParams;\n\nexport type PaymentMethodResult =\n | {\n paymentMethod: PaymentMethod;\n error?: undefined;\n }\n | {\n paymentMethod?: undefined;\n error: StripeError<PlatformPayError>;\n };\n\nexport type TokenResult =\n | {\n token: Token;\n error?: undefined;\n }\n | {\n token?: undefined;\n error: StripeError<PlatformPayError>;\n };\n\nexport type ConfirmPaymentResult =\n | {\n paymentIntent: PaymentIntent;\n error?: StripeError<PlatformPayError>;\n }\n | {\n paymentIntent?: undefined;\n error: StripeError<PlatformPayError>;\n };\n\nexport type ConfirmSetupIntentResult =\n | {\n setupIntent: SetupIntent;\n error?: StripeError<PlatformPayError>;\n }\n | {\n setupIntent?: undefined;\n error: StripeError<PlatformPayError>;\n };\n"],"mappings":"4VAsBYA,uBAAsB,iEAAtBA,sBAAsB,EAAtBA,sBAAsB,oDAAtBA,sBAAsB,gEAAtBA,sBAAsB,0CAAtBA,sBAAsB,6CAAtBA,sBAAsB,kCAAtBA,sBAAsB,SAOtBC,aAAY,6CAAZA,YAAY,EAAZA,YAAY,gCAAZA,YAAY,gBAAZA,YAAY,8BAAZA,YAAY,gCAAZA,YAAY,qCAAZA,YAAY,wBAAZA,YAAY,SAQZC,qBAAoB,6DAApBA,oBAAoB,EAApBA,oBAAoB,oBAApBA,oBAAoB,gBAApBA,oBAAoB,kDAApBA,oBAAoB,kBAApBA,oBAAoB,4BAApBA,oBAAoB,sBAApBA,oBAAoB,8BAApBA,oBAAoB,iCAApBA,oBAAoB,gCAApBA,oBAAoB,SA0CpBC,mBAAkB,yDAAlBA,kBAAkB,EAAlBA,kBAAkB,0BAAlBA,kBAAkB,sCAAlBA,kBAAkB,qCAAlBA,kBAAkB,8BAAlBA,kBAAkB,SAsElBC,2BAA0B,yEAA1BA,0BAA0B,EAA1BA,0BAA0B,8BAA1BA,0BAA0B,oCAA1BA,0BAA0B,qCAA1BA,0BAA0B,sCAA1BA,0BAA0B,SAU1BC,qBAAoB,6DAApBA,oBAAoB,EAApBA,oBAAoB,wBAApBA,oBAAoB,wBAApBA,oBAAoB,8BAApBA,oBAAoB,qCAApBA,oBAAoB,gCAApBA,oBAAoB,SAsDpBC,qBAAoB,6DAApBA,oBAAoB,EAApBA,oBAAoB,gBAApBA,oBAAoB,iBAApBA,oBAAoB,gCAApBA,oBAAoB,SAqBpBC,WAAU,yCAAVA,UAAU,EAAVA,UAAU,CAAVA,UAAU,yBAAVA,UAAU,CAAVA,UAAU,iBAAVA,UAAU,CAAVA,UAAU,mBAAVA,UAAU,CAAVA,UAAU,2BAAVA,UAAU,CAAVA,UAAU,uBAAVA,UAAU,CAAVA,UAAU,sBAAVA,UAAU,CAAVA,UAAU,6BAAVA,UAAU,CAAVA,UAAU,qBAAVA,UAAU,CAAVA,UAAU,yBAAVA,UAAU,CAAVA,UAAU,uBAAVA,UAAU,CAAVA,UAAU,2BAAVA,UAAU,CAAVA,UAAU,sBAAVA,UAAU,CAAVA,UAAU,oBAAVA,UAAU,CAAVA,UAAU,0BAAVA,UAAU,CAAVA,UAAU,gCAAVA,UAAU,CAAVA,UAAU,kBAAVA,UAAU,CAAVA,UAAU,4BAAVA,UAAU,CAAVA,UAAU,oBAAVA,UAAU,CAAVA,UAAU,2CAAVA,UAAU,sBAAVA,UAAU,SA0CVC,YAAW,2CAAXA,WAAW,EAAXA,WAAW,CAAXA,WAAW,qBAAXA,WAAW,CAAXA,WAAW,mCAAXA,WAAW,CAAXA,WAAW,qBAAXA,WAAW,CAAXA,WAAW,gCAAXA,WAAW,uBAAXA,WAAW,SAkBXC,YAAW,2CAAXA,WAAW,EAAXA,WAAW,wBAAXA,WAAW,0BAAXA,WAAW,6BAAXA,WAAW,uBAAXA,WAAW,SAwCXC,aAAY,6CAAZA,YAAY,EAAZA,YAAY,oBAAZA,YAAY,gBAAZA,YAAY,cAAZA,YAAY,kBAAZA,YAAY,mBAAZA,YAAY,wBAAZA,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["ApplePayButtonComponent.ts"],"sourcesContent":["import type { StyleProp, ViewStyle, NativeSyntheticEvent } from 'react-native';\nimport type { ShippingMethod, ShippingContact } from '../PlatformPay';\nexport interface NativeProps {\n style?: StyleProp<ViewStyle>;\n disabled?: boolean;\n type?: number;\n buttonStyle?: number;\n borderRadius?: number;\n onPressAction?(): void;\n onShippingMethodSelectedAction?: (\n value: NativeSyntheticEvent<{\n shippingMethod: ShippingMethod;\n }>\n ) => void;\n onShippingContactSelectedAction?: (\n value: NativeSyntheticEvent<{\n shippingContact: ShippingContact;\n }>\n ) => void;\n onCouponCodeEnteredAction?: (\n value: NativeSyntheticEvent<{\n couponCode: string;\n }>\n ) => void;\n}\n\nexport type Type =\n | 'plain'\n | 'buy'\n | 'setUp'\n | 'inStore'\n | 'donate'\n | 'checkout'\n | 'book'\n | 'subscribe'\n | 'reload'\n | 'addMoney'\n | 'topUp'\n | 'order'\n | 'rent'\n | 'support'\n | 'contribute'\n | 'tip'\n | 'continue';\n\nexport type Style = 'white' | 'whiteOutline' | 'black' | 'automatic';\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["ApplePayButtonComponent.ts"],"sourcesContent":["import type { StyleProp, ViewStyle, NativeSyntheticEvent } from 'react-native';\nimport type { ShippingMethod, ShippingContact } from '../PlatformPay';\nexport interface NativeProps {\n style?: StyleProp<ViewStyle>;\n disabled?: boolean;\n type?: number;\n buttonStyle?: number;\n borderRadius?: number;\n onPressAction?(): void;\n onShippingMethodSelectedAction?: (\n value: NativeSyntheticEvent<{\n shippingMethod: ShippingMethod;\n }>\n ) => void;\n onShippingContactSelectedAction?: (\n value: NativeSyntheticEvent<{\n shippingContact: ShippingContact;\n }>\n ) => void;\n onCouponCodeEnteredAction?: (\n value: NativeSyntheticEvent<{\n couponCode: string;\n }>\n ) => void;\n onOrderTrackingAction?: () => void;\n}\n\nexport type Type =\n | 'plain'\n | 'buy'\n | 'setUp'\n | 'inStore'\n | 'donate'\n | 'checkout'\n | 'book'\n | 'subscribe'\n | 'reload'\n | 'addMoney'\n | 'topUp'\n | 'order'\n | 'rent'\n | 'support'\n | 'contribute'\n | 'tip'\n | 'continue';\n\nexport type Style = 'white' | 'whiteOutline' | 'black' | 'automatic';\n"],"mappings":""}
|
|
@@ -15,7 +15,8 @@ declare type NativeStripeSdkType = {
|
|
|
15
15
|
retrievePaymentIntent(clientSecret: string): Promise<RetrievePaymentIntentResult>;
|
|
16
16
|
retrieveSetupIntent(clientSecret: string): Promise<RetrieveSetupIntentResult>;
|
|
17
17
|
initPaymentSheet(params: PaymentSheet.SetupParams): Promise<InitPaymentSheetResult>;
|
|
18
|
-
|
|
18
|
+
initPaymentSheetWithOrderTracking(params: PaymentSheet.SetupParams, callback?: () => void): Promise<InitPaymentSheetResult>;
|
|
19
|
+
presentPaymentSheet(options: PaymentSheet.PresentOptions): Promise<PresentPaymentSheetResult>;
|
|
19
20
|
confirmPaymentSheetPayment(): Promise<ConfirmPaymentSheetPaymentResult>;
|
|
20
21
|
createTokenForCVCUpdate(cvc: string): Promise<CreateTokenForCVCUpdateResult>;
|
|
21
22
|
handleURLCallback(url: string): Promise<boolean>;
|
|
@@ -47,6 +48,7 @@ declare type NativeStripeSdkType = {
|
|
|
47
48
|
dismissPlatformPay(): Promise<boolean>;
|
|
48
49
|
updatePlatformPaySheet(summaryItems: Array<ApplePay.CartSummaryItem>, shippingMethods: Array<ApplePay.ShippingMethod>, errors: Array<PlatformPay.ApplePaySheetError>): Promise<void>;
|
|
49
50
|
confirmPlatformPay(clientSecret: string, params: PlatformPay.ConfirmParams, isPaymentIntent: boolean): Promise<PlatformPay.ConfirmPaymentResult | PlatformPay.ConfirmSetupIntentResult>;
|
|
51
|
+
configureOrderTracking(orderTypeIdentifier: string, orderIdentifier: string, webServiceUrl: string, authenticationToken: string): Promise<void>;
|
|
50
52
|
};
|
|
51
53
|
declare const _default: NativeStripeSdkType;
|
|
52
54
|
export default _default;
|
|
@@ -41,6 +41,11 @@ export interface Props extends AccessibilityProps {
|
|
|
41
41
|
onCouponCodeEntered?: (event: {
|
|
42
42
|
couponCode: string;
|
|
43
43
|
}) => void;
|
|
44
|
+
/** Callback function for setting the order details (retrieved from your server) to give users the
|
|
45
|
+
* ability to track and manage their purchases in Wallet. Stripe calls your implementation after the
|
|
46
|
+
* payment is complete, but before iOS dismisses the Apple Pay sheet. You must call the `completion`
|
|
47
|
+
* function, or else the Apple Pay sheet will hang.*/
|
|
48
|
+
setOrderTracking?: (completion: (orderIdentifier: string, orderTypeIdentifier: string, authenticationToken: string, webServiceUrl: string) => void) => void;
|
|
44
49
|
testID?: string;
|
|
45
50
|
style?: StyleProp<ViewStyle>;
|
|
46
51
|
}
|
|
@@ -62,4 +67,4 @@ export interface Props extends AccessibilityProps {
|
|
|
62
67
|
* @returns JSX.Element
|
|
63
68
|
* @category ReactComponents
|
|
64
69
|
*/
|
|
65
|
-
export declare function PlatformPayButton({ type, appearance, onPress, disabled, borderRadius, onShippingMethodSelected, onShippingContactSelected, onCouponCodeEntered, ...props }: Props): JSX.Element;
|
|
70
|
+
export declare function PlatformPayButton({ type, appearance, onPress, disabled, borderRadius, onShippingMethodSelected, onShippingContactSelected, onCouponCodeEntered, setOrderTracking, style, ...props }: Props): JSX.Element;
|
|
@@ -40,7 +40,7 @@ export declare const handleURLCallback: (url: string) => Promise<boolean>;
|
|
|
40
40
|
export declare const verifyMicrodepositsForPayment: (clientSecret: string, params: VerifyMicrodepositsParams) => Promise<VerifyMicrodepositsForPaymentResult>;
|
|
41
41
|
export declare const verifyMicrodepositsForSetup: (clientSecret: string, params: VerifyMicrodepositsParams) => Promise<VerifyMicrodepositsForSetupResult>;
|
|
42
42
|
export declare const initPaymentSheet: (params: PaymentSheet.SetupParams) => Promise<InitPaymentSheetResult>;
|
|
43
|
-
export declare const presentPaymentSheet: () => Promise<PresentPaymentSheetResult>;
|
|
43
|
+
export declare const presentPaymentSheet: (options?: PaymentSheet.PresentOptions) => Promise<PresentPaymentSheetResult>;
|
|
44
44
|
export declare const confirmPaymentSheetPayment: () => Promise<ConfirmPaymentSheetPaymentResult>;
|
|
45
45
|
/**
|
|
46
46
|
* You must call this method when the user logs out from your app. This will ensure that
|
|
@@ -5,7 +5,7 @@ import type { PaymentSheet } from '../types';
|
|
|
5
5
|
export declare function usePaymentSheet(): {
|
|
6
6
|
loading: boolean;
|
|
7
7
|
initPaymentSheet: (params: PaymentSheet.SetupParams) => Promise<import("../types").InitPaymentSheetResult>;
|
|
8
|
-
presentPaymentSheet: () => Promise<import("../types").PresentPaymentSheetResult>;
|
|
8
|
+
presentPaymentSheet: (options?: PaymentSheet.PresentOptions | undefined) => Promise<import("../types").PresentPaymentSheetResult>;
|
|
9
9
|
confirmPaymentSheetPayment: () => Promise<import("../types").ConfirmPaymentSheetPaymentResult>;
|
|
10
10
|
/**
|
|
11
11
|
* You must call this method when the user logs out from your app. This will ensure that
|
|
@@ -23,7 +23,7 @@ export declare function useStripe(): {
|
|
|
23
23
|
}>;
|
|
24
24
|
handleURLCallback: (url: string) => Promise<boolean>;
|
|
25
25
|
confirmPaymentSheetPayment: () => Promise<ConfirmPaymentSheetPaymentResult>;
|
|
26
|
-
presentPaymentSheet: () => Promise<PresentPaymentSheetResult>;
|
|
26
|
+
presentPaymentSheet: (options?: PaymentSheet.PresentOptions | undefined) => Promise<PresentPaymentSheetResult>;
|
|
27
27
|
initPaymentSheet: (params: PaymentSheet.SetupParams) => Promise<InitPaymentSheetResult>;
|
|
28
28
|
createToken: (params: Token.CreateParams) => Promise<CreateTokenResult>;
|
|
29
29
|
isGooglePaySupported: (params?: GooglePay.IsSupportedParams | undefined) => Promise<boolean>;
|
|
@@ -32,7 +32,8 @@ export declare enum ApplePayError {
|
|
|
32
32
|
}
|
|
33
33
|
export declare enum PaymentSheetError {
|
|
34
34
|
Failed = "Failed",
|
|
35
|
-
Canceled = "Canceled"
|
|
35
|
+
Canceled = "Canceled",
|
|
36
|
+
Timeout = "Timeout"
|
|
36
37
|
}
|
|
37
38
|
export declare type ErrorType = 'api_connection_error' | 'api_error' | 'authentication_error' | 'card_error' | 'idempotency_error' | 'invalid_request_error' | 'rate_limit_error';
|
|
38
39
|
export interface StripeError<T> {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BillingDetails, AddressDetails } from './Common';
|
|
2
2
|
import type { CartSummaryItem } from './ApplePay';
|
|
3
|
+
import type { ButtonType, RecurringPaymentRequest, AutomaticReloadPaymentRequest, MultiMerchantRequest } from './PlatformPay';
|
|
3
4
|
export declare type SetupParams = ClientSecretParams & {
|
|
4
5
|
/** Your customer-facing business name. On Android, this is required and cannot be an empty string. */
|
|
5
6
|
merchantDisplayName: string;
|
|
@@ -52,7 +53,16 @@ export declare type ApplePayParams = {
|
|
|
52
53
|
/**
|
|
53
54
|
* An array of CartSummaryItem item objects that summarize the amount of the payment. If you're using a SetupIntent
|
|
54
55
|
* for a recurring payment, you should set this to display the amount you intend to charge. */
|
|
55
|
-
|
|
56
|
+
cartItems?: CartSummaryItem[];
|
|
57
|
+
/** Sets the text displayed by the call to action button in the Apple Pay sheet. */
|
|
58
|
+
buttonType?: ButtonType;
|
|
59
|
+
/** A typical request is for a one-time payment. To support different types of payment requests, include a PaymentRequestType. Only supported on iOS 16 and up. */
|
|
60
|
+
request?: RecurringPaymentRequest | AutomaticReloadPaymentRequest | MultiMerchantRequest;
|
|
61
|
+
/** Callback function for setting the order details (retrieved from your server) to give users the
|
|
62
|
+
* ability to track and manage their purchases in Wallet. Stripe calls your implementation after the
|
|
63
|
+
* payment is complete, but before iOS dismisses the Apple Pay sheet. You must call the `completion`
|
|
64
|
+
* function, or else the Apple Pay sheet will hang. */
|
|
65
|
+
setOrderTracking?: (completion: (orderIdentifier: string, orderTypeIdentifier: string, authenticationToken: string, webServiceUrl: string) => void) => void;
|
|
56
66
|
};
|
|
57
67
|
export declare type GooglePayParams = {
|
|
58
68
|
/** The two-letter ISO 3166 code of the country of your business, e.g. "US" */
|
|
@@ -218,4 +228,10 @@ export interface PaymentOption {
|
|
|
218
228
|
label: string;
|
|
219
229
|
image: string;
|
|
220
230
|
}
|
|
231
|
+
export declare type PresentOptions = {
|
|
232
|
+
/** The number of milliseconds (after presenting) before the Payment Sheet closes automatically, at which point
|
|
233
|
+
*`presentPaymentSheet` will resolve with an `error.code` of `PaymentSheetError.Timeout`. The default is no timeout.
|
|
234
|
+
*/
|
|
235
|
+
timeout?: number;
|
|
236
|
+
};
|
|
221
237
|
export {};
|
|
@@ -58,6 +58,69 @@ export declare type ApplePayBaseParams = {
|
|
|
58
58
|
/** A list of two-letter ISO 3166 country codes for limiting payment to cards from specific countries or regions. */
|
|
59
59
|
supportedCountries?: Array<string>;
|
|
60
60
|
};
|
|
61
|
+
export declare type ApplePayConfirmParams = {
|
|
62
|
+
/** A typical request is for a one-time payment. To support different types of payment requests, include a PaymentRequestType. Only supported on iOS 16 and up. */
|
|
63
|
+
request?: RecurringPaymentRequest | AutomaticReloadPaymentRequest | MultiMerchantRequest;
|
|
64
|
+
};
|
|
65
|
+
export declare enum PaymentRequestType {
|
|
66
|
+
Recurring = "Recurring",
|
|
67
|
+
AutomaticReload = "AutomaticReload",
|
|
68
|
+
MultiMerchant = "MultiMerchant"
|
|
69
|
+
}
|
|
70
|
+
/** Use this for a recurring payment, typically a subscription. */
|
|
71
|
+
export declare type RecurringPaymentRequest = {
|
|
72
|
+
type: PaymentRequestType.Recurring;
|
|
73
|
+
/** A description that you provide of the recurring payment and that Apple Pay displays to the user in the sheet. */
|
|
74
|
+
description: string;
|
|
75
|
+
/** A URL to a web page where the user can update or delete the payment method for the recurring payment. */
|
|
76
|
+
managementUrl: string;
|
|
77
|
+
/** The regular billing cycle for the payment, including start and end dates, an interval, and an interval count. */
|
|
78
|
+
billing: RecurringCartSummaryItem;
|
|
79
|
+
/** Same as the billing property, but use this if the purchase has a trial period. */
|
|
80
|
+
trialBilling?: RecurringCartSummaryItem;
|
|
81
|
+
/** A localized billing agreement that the sheet displays to the user before the user authorizes the payment. */
|
|
82
|
+
billingAgreement?: string;
|
|
83
|
+
/** A URL you provide to receive life-cycle notifications from the Apple Pay servers about the Apple Pay merchant token for the recurring payment.
|
|
84
|
+
* For more information about handling merchant token life-cycle notifications, see Receiving and handling merchant token notifications.
|
|
85
|
+
*/
|
|
86
|
+
tokenNotificationURL?: string;
|
|
87
|
+
};
|
|
88
|
+
/** Use this for an automatic reload or refill payment, such as a store card top-up. */
|
|
89
|
+
export declare type AutomaticReloadPaymentRequest = {
|
|
90
|
+
type: PaymentRequestType.AutomaticReload;
|
|
91
|
+
/** A description that you provide of the recurring payment and that Apple Pay displays to the user in the sheet. */
|
|
92
|
+
description: string;
|
|
93
|
+
/** A URL to a web page where the user can update or delete the payment method for the recurring payment. */
|
|
94
|
+
managementUrl: string;
|
|
95
|
+
/** A short, localized description of the item. */
|
|
96
|
+
label: string;
|
|
97
|
+
/** This is the amount that is automatically applied to the account when the account balance drops below the threshold amount. */
|
|
98
|
+
reloadAmount: string;
|
|
99
|
+
/** The balance an account reaches before you apply the automatic reload amount. */
|
|
100
|
+
thresholdAmount: string;
|
|
101
|
+
/** A localized billing agreement that the sheet displays to the user before the user authorizes the payment. */
|
|
102
|
+
billingAgreement?: string;
|
|
103
|
+
/** A URL you provide to receive life-cycle notifications from the Apple Pay servers about the Apple Pay merchant token for the recurring payment.
|
|
104
|
+
* For more information about handling merchant token life-cycle notifications, see Receiving and handling merchant token notifications.
|
|
105
|
+
*/
|
|
106
|
+
tokenNotificationURL?: string;
|
|
107
|
+
};
|
|
108
|
+
/** Use this to indicate payments for multiple merchants. */
|
|
109
|
+
export declare type MultiMerchantRequest = {
|
|
110
|
+
type: PaymentRequestType.MultiMerchant;
|
|
111
|
+
merchants: Array<{
|
|
112
|
+
/** The Apple Pay merchant identifier. */
|
|
113
|
+
merchantIdentifier: string;
|
|
114
|
+
/** An external identifier for the merchant. */
|
|
115
|
+
externalIdentifier: string;
|
|
116
|
+
/** The merchant’s display name that the Apple Pay server associates with the payment token. */
|
|
117
|
+
merchantName: string;
|
|
118
|
+
/** The merchant’s top-level domain that the Apple Pay server associates with the payment token. */
|
|
119
|
+
merchantDomain?: string;
|
|
120
|
+
/** The amount to authorize for the payment token. */
|
|
121
|
+
amount: string;
|
|
122
|
+
}>;
|
|
123
|
+
};
|
|
61
124
|
export declare type ApplePayPaymentMethodParams = {
|
|
62
125
|
/** Set this value to true to display the coupon code field, or pass the 'couponCode' field to autofill with a coupon code. Defaults to false. If true, you must implement the PlatformPayButton component's `onCouponCodeEntered` callback and call `updatePlatformPaySheet` from there. */
|
|
63
126
|
supportsCouponCode?: boolean;
|
|
@@ -140,7 +203,7 @@ export declare type ConfirmParams = {
|
|
|
140
203
|
/** Defines Google Pay behavior. Android only. */
|
|
141
204
|
googlePay?: GooglePayBaseParams;
|
|
142
205
|
/** Defines Apple Pay behavior. iOS only. */
|
|
143
|
-
applePay?: ApplePayBaseParams;
|
|
206
|
+
applePay?: ApplePayBaseParams & ApplePayConfirmParams;
|
|
144
207
|
};
|
|
145
208
|
export declare enum ButtonType {
|
|
146
209
|
/** A button with the Apple Pay or Google Pay logo only, useful when an additional call to action isn't needed. */
|
|
@@ -16,6 +16,7 @@ export interface NativeProps {
|
|
|
16
16
|
onCouponCodeEnteredAction?: (value: NativeSyntheticEvent<{
|
|
17
17
|
couponCode: string;
|
|
18
18
|
}>) => void;
|
|
19
|
+
onOrderTrackingAction?: () => void;
|
|
19
20
|
}
|
|
20
21
|
export declare type Type = 'plain' | 'buy' | 'setUp' | 'inStore' | 'donate' | 'checkout' | 'book' | 'subscribe' | 'reload' | 'addMoney' | 'topUp' | 'order' | 'rent' | 'support' | 'contribute' | 'tip' | 'continue';
|
|
21
22
|
export declare type Style = 'white' | 'whiteOutline' | 'black' | 'automatic';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stripe/stripe-react-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"author": "Stripe",
|
|
5
5
|
"description": "Stripe SDK for React Native",
|
|
6
6
|
"main": "lib/commonjs/index",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"metro-react-native-babel-preset": "^0.70.3",
|
|
58
58
|
"prettier": "^2.0.5",
|
|
59
59
|
"react": "18.0.0",
|
|
60
|
-
"react-native": "0.69.
|
|
60
|
+
"react-native": "0.69.7",
|
|
61
61
|
"ts-node": "^9.1.1",
|
|
62
62
|
"typedoc": "^0.22.12",
|
|
63
63
|
"typescript": "~4.4.4"
|
package/src/NativeStripeSdk.tsx
CHANGED
|
@@ -69,7 +69,13 @@ type NativeStripeSdkType = {
|
|
|
69
69
|
initPaymentSheet(
|
|
70
70
|
params: PaymentSheet.SetupParams
|
|
71
71
|
): Promise<InitPaymentSheetResult>;
|
|
72
|
-
|
|
72
|
+
initPaymentSheetWithOrderTracking(
|
|
73
|
+
params: PaymentSheet.SetupParams,
|
|
74
|
+
callback?: () => void
|
|
75
|
+
): Promise<InitPaymentSheetResult>;
|
|
76
|
+
presentPaymentSheet(
|
|
77
|
+
options: PaymentSheet.PresentOptions
|
|
78
|
+
): Promise<PresentPaymentSheetResult>;
|
|
73
79
|
confirmPaymentSheetPayment(): Promise<ConfirmPaymentSheetPaymentResult>;
|
|
74
80
|
createTokenForCVCUpdate(cvc: string): Promise<CreateTokenForCVCUpdateResult>;
|
|
75
81
|
handleURLCallback(url: string): Promise<boolean>;
|
|
@@ -127,6 +133,12 @@ type NativeStripeSdkType = {
|
|
|
127
133
|
): Promise<
|
|
128
134
|
PlatformPay.ConfirmPaymentResult | PlatformPay.ConfirmSetupIntentResult
|
|
129
135
|
>;
|
|
136
|
+
configureOrderTracking(
|
|
137
|
+
orderTypeIdentifier: string,
|
|
138
|
+
orderIdentifier: string,
|
|
139
|
+
webServiceUrl: string,
|
|
140
|
+
authenticationToken: string
|
|
141
|
+
): Promise<void>;
|
|
130
142
|
};
|
|
131
143
|
|
|
132
144
|
const { StripeSdk } = NativeModules;
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
Platform,
|
|
9
9
|
NativeSyntheticEvent,
|
|
10
10
|
} from 'react-native';
|
|
11
|
+
import NativeStripeSdk from '../NativeStripeSdk';
|
|
11
12
|
import {
|
|
12
13
|
ButtonType,
|
|
13
14
|
ButtonStyle,
|
|
@@ -56,6 +57,18 @@ export interface Props extends AccessibilityProps {
|
|
|
56
57
|
* Apple Pay sheet will hang and the payment flow will automatically cancel.
|
|
57
58
|
*/
|
|
58
59
|
onCouponCodeEntered?: (event: { couponCode: string }) => void;
|
|
60
|
+
/** Callback function for setting the order details (retrieved from your server) to give users the
|
|
61
|
+
* ability to track and manage their purchases in Wallet. Stripe calls your implementation after the
|
|
62
|
+
* payment is complete, but before iOS dismisses the Apple Pay sheet. You must call the `completion`
|
|
63
|
+
* function, or else the Apple Pay sheet will hang.*/
|
|
64
|
+
setOrderTracking?: (
|
|
65
|
+
completion: (
|
|
66
|
+
orderIdentifier: string,
|
|
67
|
+
orderTypeIdentifier: string,
|
|
68
|
+
authenticationToken: string,
|
|
69
|
+
webServiceUrl: string
|
|
70
|
+
) => void
|
|
71
|
+
) => void;
|
|
59
72
|
testID?: string;
|
|
60
73
|
style?: StyleProp<ViewStyle>;
|
|
61
74
|
}
|
|
@@ -87,6 +100,8 @@ export function PlatformPayButton({
|
|
|
87
100
|
onShippingMethodSelected,
|
|
88
101
|
onShippingContactSelected,
|
|
89
102
|
onCouponCodeEntered,
|
|
103
|
+
setOrderTracking,
|
|
104
|
+
style,
|
|
90
105
|
...props
|
|
91
106
|
}: Props) {
|
|
92
107
|
const shippingMethodCallback = onShippingMethodSelected
|
|
@@ -119,12 +134,18 @@ export function PlatformPayButton({
|
|
|
119
134
|
}
|
|
120
135
|
: undefined;
|
|
121
136
|
|
|
137
|
+
const orderTrackingCallback = setOrderTracking
|
|
138
|
+
? () => {
|
|
139
|
+
setOrderTracking(NativeStripeSdk.configureOrderTracking);
|
|
140
|
+
}
|
|
141
|
+
: undefined;
|
|
142
|
+
|
|
122
143
|
return (
|
|
123
144
|
<TouchableOpacity
|
|
124
145
|
disabled={disabled}
|
|
125
146
|
activeOpacity={disabled ? 0.3 : 1}
|
|
126
147
|
onPress={onPress}
|
|
127
|
-
style={disabled ? styles.disabled : styles.notDisabled}
|
|
148
|
+
style={[disabled ? styles.disabled : styles.notDisabled, style]}
|
|
128
149
|
>
|
|
129
150
|
{Platform.OS === 'ios' ? (
|
|
130
151
|
<ApplePayButtonNative
|
|
@@ -135,10 +156,16 @@ export function PlatformPayButton({
|
|
|
135
156
|
onShippingMethodSelectedAction={shippingMethodCallback}
|
|
136
157
|
onShippingContactSelectedAction={shippingContactCallback}
|
|
137
158
|
onCouponCodeEnteredAction={couponCodeCallback}
|
|
159
|
+
onOrderTrackingAction={orderTrackingCallback}
|
|
160
|
+
style={styles.nativeButtonStyle}
|
|
138
161
|
{...props}
|
|
139
162
|
/>
|
|
140
163
|
) : (
|
|
141
|
-
<GooglePayButtonNative
|
|
164
|
+
<GooglePayButtonNative
|
|
165
|
+
type={type}
|
|
166
|
+
style={styles.nativeButtonStyle}
|
|
167
|
+
{...props}
|
|
168
|
+
/>
|
|
142
169
|
)}
|
|
143
170
|
</TouchableOpacity>
|
|
144
171
|
);
|
|
@@ -147,9 +174,10 @@ export function PlatformPayButton({
|
|
|
147
174
|
const styles = StyleSheet.create({
|
|
148
175
|
disabled: {
|
|
149
176
|
flex: 0,
|
|
150
|
-
opacity: 0.
|
|
177
|
+
opacity: 0.4,
|
|
151
178
|
},
|
|
152
179
|
notDisabled: {
|
|
153
180
|
flex: 0,
|
|
154
181
|
},
|
|
182
|
+
nativeButtonStyle: { flex: 1 },
|
|
155
183
|
});
|
package/src/functions.ts
CHANGED
|
@@ -405,17 +405,28 @@ export const verifyMicrodepositsForSetup = async (
|
|
|
405
405
|
export const initPaymentSheet = async (
|
|
406
406
|
params: PaymentSheet.SetupParams
|
|
407
407
|
): Promise<InitPaymentSheetResult> => {
|
|
408
|
+
let result;
|
|
409
|
+
|
|
410
|
+
const setOrderTracking = params?.applePay?.setOrderTracking;
|
|
408
411
|
try {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
412
|
+
if (setOrderTracking && Platform.OS === 'ios') {
|
|
413
|
+
result = await NativeStripeSdk.initPaymentSheetWithOrderTracking(
|
|
414
|
+
params,
|
|
415
|
+
() => {
|
|
416
|
+
setOrderTracking(NativeStripeSdk.configureOrderTracking);
|
|
417
|
+
}
|
|
418
|
+
);
|
|
419
|
+
} else {
|
|
420
|
+
result = await NativeStripeSdk.initPaymentSheet(params);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
if (result.error) {
|
|
413
424
|
return {
|
|
414
|
-
error,
|
|
425
|
+
error: result.error,
|
|
415
426
|
};
|
|
416
427
|
}
|
|
417
428
|
return {
|
|
418
|
-
paymentOption,
|
|
429
|
+
paymentOption: result.paymentOption,
|
|
419
430
|
};
|
|
420
431
|
} catch (error: any) {
|
|
421
432
|
return {
|
|
@@ -424,25 +435,27 @@ export const initPaymentSheet = async (
|
|
|
424
435
|
}
|
|
425
436
|
};
|
|
426
437
|
|
|
427
|
-
export const presentPaymentSheet =
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
return {
|
|
438
|
-
paymentOption: paymentOption!,
|
|
439
|
-
};
|
|
440
|
-
} catch (error: any) {
|
|
438
|
+
export const presentPaymentSheet = async (
|
|
439
|
+
options: PaymentSheet.PresentOptions = {}
|
|
440
|
+
): Promise<PresentPaymentSheetResult> => {
|
|
441
|
+
try {
|
|
442
|
+
const { paymentOption, error } = await NativeStripeSdk.presentPaymentSheet(
|
|
443
|
+
options
|
|
444
|
+
);
|
|
445
|
+
if (error) {
|
|
441
446
|
return {
|
|
442
447
|
error,
|
|
443
448
|
};
|
|
444
449
|
}
|
|
445
|
-
|
|
450
|
+
return {
|
|
451
|
+
paymentOption: paymentOption!,
|
|
452
|
+
};
|
|
453
|
+
} catch (error: any) {
|
|
454
|
+
return {
|
|
455
|
+
error,
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
};
|
|
446
459
|
|
|
447
460
|
export const confirmPaymentSheetPayment =
|
|
448
461
|
async (): Promise<ConfirmPaymentSheetPaymentResult> => {
|
|
@@ -21,9 +21,9 @@ export function usePaymentSheet() {
|
|
|
21
21
|
return result;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
const presentPaymentSheet = async () => {
|
|
24
|
+
const presentPaymentSheet = async (options?: PaymentSheet.PresentOptions) => {
|
|
25
25
|
setLoading(true);
|
|
26
|
-
const result = await presentPaymentSheetNative();
|
|
26
|
+
const result = await presentPaymentSheetNative(options);
|
|
27
27
|
setLoading(false);
|
|
28
28
|
return result;
|
|
29
29
|
};
|
package/src/hooks/useStripe.tsx
CHANGED
|
@@ -203,10 +203,14 @@ export function useStripe() {
|
|
|
203
203
|
[]
|
|
204
204
|
);
|
|
205
205
|
|
|
206
|
-
const _presentPaymentSheet =
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
206
|
+
const _presentPaymentSheet = useCallback(
|
|
207
|
+
async (
|
|
208
|
+
options?: PaymentSheet.PresentOptions
|
|
209
|
+
): Promise<PresentPaymentSheetResult> => {
|
|
210
|
+
return presentPaymentSheet(options);
|
|
211
|
+
},
|
|
212
|
+
[]
|
|
213
|
+
);
|
|
210
214
|
|
|
211
215
|
const _confirmPaymentSheetPayment =
|
|
212
216
|
useCallback(async (): Promise<ConfirmPaymentSheetPaymentResult> => {
|
package/src/types/Errors.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { BillingDetails, AddressDetails } from './Common';
|
|
2
2
|
import type { CartSummaryItem } from './ApplePay';
|
|
3
|
+
import type {
|
|
4
|
+
ButtonType,
|
|
5
|
+
RecurringPaymentRequest,
|
|
6
|
+
AutomaticReloadPaymentRequest,
|
|
7
|
+
MultiMerchantRequest,
|
|
8
|
+
} from './PlatformPay';
|
|
3
9
|
|
|
4
10
|
export type SetupParams = ClientSecretParams & {
|
|
5
11
|
/** Your customer-facing business name. On Android, this is required and cannot be an empty string. */
|
|
@@ -57,9 +63,26 @@ export type ApplePayParams = {
|
|
|
57
63
|
/**
|
|
58
64
|
* An array of CartSummaryItem item objects that summarize the amount of the payment. If you're using a SetupIntent
|
|
59
65
|
* for a recurring payment, you should set this to display the amount you intend to charge. */
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
cartItems?: CartSummaryItem[];
|
|
67
|
+
/** Sets the text displayed by the call to action button in the Apple Pay sheet. */
|
|
68
|
+
buttonType?: ButtonType;
|
|
69
|
+
/** A typical request is for a one-time payment. To support different types of payment requests, include a PaymentRequestType. Only supported on iOS 16 and up. */
|
|
70
|
+
request?:
|
|
71
|
+
| RecurringPaymentRequest
|
|
72
|
+
| AutomaticReloadPaymentRequest
|
|
73
|
+
| MultiMerchantRequest;
|
|
74
|
+
/** Callback function for setting the order details (retrieved from your server) to give users the
|
|
75
|
+
* ability to track and manage their purchases in Wallet. Stripe calls your implementation after the
|
|
76
|
+
* payment is complete, but before iOS dismisses the Apple Pay sheet. You must call the `completion`
|
|
77
|
+
* function, or else the Apple Pay sheet will hang. */
|
|
78
|
+
setOrderTracking?: (
|
|
79
|
+
completion: (
|
|
80
|
+
orderIdentifier: string,
|
|
81
|
+
orderTypeIdentifier: string,
|
|
82
|
+
authenticationToken: string,
|
|
83
|
+
webServiceUrl: string
|
|
84
|
+
) => void
|
|
85
|
+
) => void;
|
|
63
86
|
};
|
|
64
87
|
|
|
65
88
|
export type GooglePayParams = {
|
|
@@ -232,3 +255,10 @@ export interface PaymentOption {
|
|
|
232
255
|
label: string;
|
|
233
256
|
image: string;
|
|
234
257
|
}
|
|
258
|
+
|
|
259
|
+
export type PresentOptions = {
|
|
260
|
+
/** The number of milliseconds (after presenting) before the Payment Sheet closes automatically, at which point
|
|
261
|
+
*`presentPaymentSheet` will resolve with an `error.code` of `PaymentSheetError.Timeout`. The default is no timeout.
|
|
262
|
+
*/
|
|
263
|
+
timeout?: number;
|
|
264
|
+
};
|