diff --git a/CHANGELOG.md b/CHANGELOG.md index 869e4db43..2fb5ab031 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,27 @@ ## Unreleased +**Features** + +- Added the `amount` and `label` params to `initPaymentSheet`'s `googlePay` field configuration. Use this to diplay the amount for setup intents. +- Added the `amount` and `label` params `createPlatformPayPaymentMethod`, `confirmPlatformPayPayment`, and `confirmPlatformPaySetupIntent`. +- PaymentSheet now supports the following payment methods on both iOS and Android (previously some of the following were iOS only) for SetupIntents and PaymentIntents with setup for future usage: + - Alipay + - BECS Direct Debit + - Cash App Pay + - iDEAL + - SEPA + - Sofort + - Bancontact + - BLIK + - Boleto + - Revolut Pay + - OXXO (PaymentIntents only) + - Konbini (PaymentIntents only) +- PaymentSheet now supports the following payment methods on iOS only for SetupIntents and PaymentIntents with setup for future usage: + - PayNow + - PromptPay + ## 0.32.0 - 2023-09-15 **Features** diff --git a/android/gradle.properties b/android/gradle.properties index 48d9a41c1..4348d8aea 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,3 +1,3 @@ StripeSdk_kotlinVersion=1.8.0 # Keep StripeSdk_stripeVersion in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/android/gradle.properties -StripeSdk_stripeVersion=20.29.+ +StripeSdk_stripeVersion=20.31.+ diff --git a/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherFragment.kt b/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherFragment.kt index 6fa090ff9..54a249a01 100644 --- a/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherFragment.kt +++ b/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherFragment.kt @@ -24,6 +24,8 @@ class GooglePayLauncherFragment : Fragment() { private lateinit var mode: Mode private lateinit var configuration: GooglePayLauncher.Config private lateinit var currencyCode: String + private var amount: Int? = null + private var label: String? = null private lateinit var callback: (result: GooglePayLauncher.Result?, error: WritableMap?) -> Unit override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, @@ -47,6 +49,8 @@ class GooglePayLauncherFragment : Fragment() { this.mode = mode this.callback = callback this.currencyCode = googlePayParams.getString("currencyCode") ?: "USD" + this.amount = googlePayParams.getInt("amount") + this.label = googlePayParams.getString("label") this.configuration = GooglePayLauncher.Config( environment = if (googlePayParams.getBoolean("testEnv")) GooglePayEnvironment.Test else GooglePayEnvironment.Production, merchantCountryCode = googlePayParams.getString("merchantCountryCode").orEmpty(), @@ -89,10 +93,10 @@ class GooglePayLauncherFragment : Fragment() { if (isReady) { when (mode) { Mode.ForSetup -> { - launcher.presentForSetupIntent(clientSecret, currencyCode) + launcher.presentForSetupIntent(clientSecret, currencyCode, amount?.toLong(), label) } Mode.ForPayment -> { - launcher.presentForPaymentIntent(clientSecret) + launcher.presentForPaymentIntent(clientSecret, label) } } } else { diff --git a/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt b/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt index f8f572909..dcbb738ca 100644 --- a/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt +++ b/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt @@ -80,12 +80,14 @@ class GooglePayRequestHelper { val countryCode = params.getString("merchantCountryCode").orEmpty() val currencyCode = params.getString("currencyCode") ?: "USD" val amount = params.getInt("amount") + val label = params.getString("label") return GooglePayJsonFactory.TransactionInfo( currencyCode = currencyCode, totalPriceStatus = GooglePayJsonFactory.TransactionInfo.TotalPriceStatus.Estimated, countryCode = countryCode, totalPrice = amount, + totalPriceLabel = label, checkoutOption = GooglePayJsonFactory.TransactionInfo.CheckoutOption.Default ) } diff --git a/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt b/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt index f7224101c..114d9b29e 100644 --- a/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +++ b/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt @@ -282,6 +282,8 @@ class PaymentLauncherFragment( private fun isNextActionSuccessState(nextAction: StripeIntent.NextActionType?): Boolean { return when (nextAction) { StripeIntent.NextActionType.DisplayOxxoDetails, + StripeIntent.NextActionType.DisplayBoletoDetails, + StripeIntent.NextActionType.DisplayKonbiniDetails, StripeIntent.NextActionType.VerifyWithMicrodeposits -> true StripeIntent.NextActionType.RedirectToUrl, StripeIntent.NextActionType.UseStripeSdk, diff --git a/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt b/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt index a52b65021..b6da5681e 100644 --- a/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +++ b/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt @@ -354,11 +354,15 @@ class PaymentSheetFragment( val countryCode = params.getString("merchantCountryCode").orEmpty() val currencyCode = params.getString("currencyCode").orEmpty() val testEnv = params.getBoolean("testEnv") + val amount = params.getString("amount")?.toLongOrNull() + val label = params.getString("label") return PaymentSheet.GooglePayConfiguration( environment = if (testEnv) PaymentSheet.GooglePayConfiguration.Environment.Test else PaymentSheet.GooglePayConfiguration.Environment.Production, countryCode = countryCode, - currencyCode = currencyCode + currencyCode = currencyCode, + amount = amount, + label = label ) } diff --git a/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt b/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt index c4e8e129c..1bcb0314a 100644 --- a/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +++ b/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt @@ -490,6 +490,18 @@ internal fun mapNextAction(type: NextActionType?, data: NextActionData?): Writab NextActionType.CashAppRedirect, NextActionType.BlikAuthorize, NextActionType.UseStripeSdk, NextActionType.UpiAwaitNotification, null -> { return null } + NextActionType.DisplayBoletoDetails -> { + (data as? NextActionData.DisplayBoletoDetails)?.let { + nextActionMap.putString("type", "boletoVoucher") + nextActionMap.putString("voucherURL", it.hostedVoucherUrl) + } + } + NextActionType.DisplayKonbiniDetails -> { + (data as? NextActionData.DisplayKonbiniDetails)?.let { + nextActionMap.putString("type", "konbiniVoucher") + nextActionMap.putString("voucherURL", it.hostedVoucherUrl) + } + } } return nextActionMap } diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index ae56d0780..d8cabfed5 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -368,50 +368,50 @@ PODS: - React-Core - React-RCTImage - SocketRocket (0.6.0) - - Stripe (23.15.0): - - StripeApplePay (= 23.15.0) - - StripeCore (= 23.15.0) - - StripePayments (= 23.15.0) - - StripePaymentsUI (= 23.15.0) - - StripeUICore (= 23.15.0) - - stripe-react-native (0.30.0): + - Stripe (23.16.0): + - StripeApplePay (= 23.16.0) + - StripeCore (= 23.16.0) + - StripePayments (= 23.16.0) + - StripePaymentsUI (= 23.16.0) + - StripeUICore (= 23.16.0) + - stripe-react-native (0.32.0): - React-Core - - Stripe (~> 23.15.0) - - StripeApplePay (~> 23.15.0) - - StripeFinancialConnections (~> 23.15.0) - - StripePayments (~> 23.15.0) - - StripePaymentSheet (~> 23.15.0) - - StripePaymentsUI (~> 23.15.0) - - stripe-react-native/Tests (0.30.0): + - Stripe (~> 23.16.0) + - StripeApplePay (~> 23.16.0) + - StripeFinancialConnections (~> 23.16.0) + - StripePayments (~> 23.16.0) + - StripePaymentSheet (~> 23.16.0) + - StripePaymentsUI (~> 23.16.0) + - stripe-react-native/Tests (0.32.0): - React-Core - - Stripe (~> 23.15.0) - - StripeApplePay (~> 23.15.0) - - StripeFinancialConnections (~> 23.15.0) - - StripePayments (~> 23.15.0) - - StripePaymentSheet (~> 23.15.0) - - StripePaymentsUI (~> 23.15.0) - - StripeApplePay (23.15.0): - - StripeCore (= 23.15.0) - - StripeCore (23.15.0) - - StripeFinancialConnections (23.15.0): - - StripeCore (= 23.15.0) - - StripeUICore (= 23.15.0) - - StripePayments (23.15.0): - - StripeCore (= 23.15.0) - - StripePayments/Stripe3DS2 (= 23.15.0) - - StripePayments/Stripe3DS2 (23.15.0): - - StripeCore (= 23.15.0) - - StripePaymentSheet (23.15.0): - - StripeApplePay (= 23.15.0) - - StripeCore (= 23.15.0) - - StripePayments (= 23.15.0) - - StripePaymentsUI (= 23.15.0) - - StripePaymentsUI (23.15.0): - - StripeCore (= 23.15.0) - - StripePayments (= 23.15.0) - - StripeUICore (= 23.15.0) - - StripeUICore (23.15.0): - - StripeCore (= 23.15.0) + - Stripe (~> 23.16.0) + - StripeApplePay (~> 23.16.0) + - StripeFinancialConnections (~> 23.16.0) + - StripePayments (~> 23.16.0) + - StripePaymentSheet (~> 23.16.0) + - StripePaymentsUI (~> 23.16.0) + - StripeApplePay (23.16.0): + - StripeCore (= 23.16.0) + - StripeCore (23.16.0) + - StripeFinancialConnections (23.16.0): + - StripeCore (= 23.16.0) + - StripeUICore (= 23.16.0) + - StripePayments (23.16.0): + - StripeCore (= 23.16.0) + - StripePayments/Stripe3DS2 (= 23.16.0) + - StripePayments/Stripe3DS2 (23.16.0): + - StripeCore (= 23.16.0) + - StripePaymentSheet (23.16.0): + - StripeApplePay (= 23.16.0) + - StripeCore (= 23.16.0) + - StripePayments (= 23.16.0) + - StripePaymentsUI (= 23.16.0) + - StripePaymentsUI (23.16.0): + - StripeCore (= 23.16.0) + - StripePayments (= 23.16.0) + - StripeUICore (= 23.16.0) + - StripeUICore (23.16.0): + - StripeCore (= 23.16.0) - Yoga (1.14.0) - YogaKit (1.18.1): - Yoga (~> 1.14) @@ -636,15 +636,15 @@ SPEC CHECKSUMS: RNCPicker: 0bf8ef8f7800524f32d2bb2a8bcadd53eda0ecd1 RNScreens: 34cc502acf1b916c582c60003dc3089fa01dc66d SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 - Stripe: 04a77d66ea24646b438079d64e28e856408a3966 - stripe-react-native: aaee952dff969febd66f6f5d6b7326adb729b827 - StripeApplePay: 25018ddbd381d23c4a6afe776c6495b6690e2036 - StripeCore: d18d981490314b875319020fb25055e528677dcc - StripeFinancialConnections: 93ec77db4be974f71e6af6c530a28fedc8e66dfc - StripePayments: 3c0bf055692bcbc420779bd2e2119e5b6049c8b9 - StripePaymentSheet: 12fb5829063dc6f1ad178eb4787b6d85e4b6155f - StripePaymentsUI: 0c9413c07110770da2abc0ebd5766470374e3565 - StripeUICore: c85381f005c7ee585ec4032858fc22baa7bae4ec + Stripe: fcab417424a45d995aa1e62a39bc942233b61ba3 + stripe-react-native: 91be4dfebcbc1fbf20d8a33167b6527eea3ce6c3 + StripeApplePay: 81de266a964b3ad02fb25e8b22fd8c235d2916a8 + StripeCore: ac141047bca25f5ae945a1cbdd00a90b0d08c616 + StripeFinancialConnections: d7a452e4bed1195d8978ee4f6c0ba2f82c89fdf4 + StripePayments: 5804cb9b02cca488042e5cf8cf57a86a5080006b + StripePaymentSheet: 06ea6bbf49be869769c46bf31be4fbc3e23b5b19 + StripePaymentsUI: 24a0349ae8c7e8c7402086703720fe06c52ddea0 + StripeUICore: ce85e040a22bf0335061d14973d37757528b3d2d Yoga: 0b84a956f7393ef1f37f3bb213c516184e4a689d YogaKit: f782866e155069a2cca2517aafea43200b01fd5a diff --git a/ios/Mappers.swift b/ios/Mappers.swift index f37191fce..88880cab4 100644 --- a/ios/Mappers.swift +++ b/ios/Mappers.swift @@ -451,14 +451,16 @@ class Mappers { "voucherURL": it.oxxoDisplayDetails?.hostedVoucherURL.absoluteString ?? NSNull(), "voucherNumber": it.oxxoDisplayDetails?.number ?? NSNull(), ] -// TODO: Not supported on Android -// case .boletoDisplayDetails: -// return [ -// "type": "boletoVoucher", -// "expiration": it.boletoDisplayDetails?.expiresAt.timeIntervalSince1970.description ?? NSNull(), -// "voucherURL": it.boletoDisplayDetails?.hostedVoucherURL.absoluteString ?? NSNull(), -// "voucherNumber": it.boletoDisplayDetails?.number ?? NSNull(), -// ] + case .boletoDisplayDetails: + return [ + "type": "boletoVoucher", + "voucherURL": it.boletoDisplayDetails?.hostedVoucherURL.absoluteString ?? NSNull(), + ] + case .konbiniDisplayDetails: + return [ + "type": "konbiniVoucher", + "voucherURL": it.konbiniDisplayDetails?.hostedVoucherURL.absoluteString ?? NSNull(), + ] default: // .useStripeSDK, .BLIKAuthorize, .unknown return nil } diff --git a/src/types/NextAction.ts b/src/types/NextAction.ts index 0e14263af..91fe27de3 100644 --- a/src/types/NextAction.ts +++ b/src/types/NextAction.ts @@ -31,9 +31,12 @@ export type AlipayRedirectAction = { export type BoletoVoucherAction = { type: 'boletoVoucher'; - expiration: number; voucherURL: string; - voucherNumber: string; +}; + +export type KonbiniVoucherAction = { + type: 'konbiniVoucher'; + voucherURL: string; }; export type OxxoVoucherAction = { diff --git a/src/types/PaymentSheet.ts b/src/types/PaymentSheet.ts index 18e1bb03f..878388128 100644 --- a/src/types/PaymentSheet.ts +++ b/src/types/PaymentSheet.ts @@ -106,6 +106,10 @@ export type GooglePayParams = { currencyCode?: string; /** Whether or not to use the Google Pay test environment. Set to `true` until you have applied for and been granted access to the Production environment. */ testEnv?: boolean; + /** An optional label to display with the amount. Google Pay may or may not display this label depending on its own internal logic. Defaults to a generic label if none is provided. */ + label?: string; + /** An optional amount to display for setup intents. Google Pay may or may not display this amount depending on its own internal logic. Defaults to 0 if none is provided. */ + amount?: string; }; /** diff --git a/src/types/PlatformPay.ts b/src/types/PlatformPay.ts index 2dd1fb0d3..1cf9edbf3 100644 --- a/src/types/PlatformPay.ts +++ b/src/types/PlatformPay.ts @@ -193,11 +193,13 @@ export type GooglePayBaseParams = { /** Defines what address fields to collect. Defaults to BillingAddressFormat.Min */ format?: BillingAddressFormat; }; + /** An optional label to display with the amount. Google Pay may or may not display this label depending on its own internal logic. Defaults to a generic label if none is provided. */ + label?: string; + /** An optional amount to display for setup intents. Google Pay may or may not display this amount depending on its own internal logic. Defaults to 0 if none is provided. */ + amount?: number; }; export type GooglePayPaymentMethodParams = { - /** Total monetary value of the transaction. */ - amount: number; /** Describes the configuration for shipping address collection in the Google Pay sheet. */ shippingAddressConfig?: { /** Set to true if shipping address is required for payment. Defaults to false. */ diff --git a/stripe-react-native.podspec b/stripe-react-native.podspec index b93e5a015..82252758f 100644 --- a/stripe-react-native.podspec +++ b/stripe-react-native.podspec @@ -2,7 +2,7 @@ require 'json' package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) # Keep stripe_version in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/stripe-identity-react-native.podspec -stripe_version = '~> 23.15.0' +stripe_version = '~> 23.16.0' Pod::Spec.new do |s| s.name = 'stripe-react-native'