You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note how the IntentMode class requires currencyCode and amount, but the platform implementations expect amount and currencyCode to be nullable when reading them, and use that information to determine whether to configure the payment sheet for a PaymentIntent or SetupIntent:
RCTMakeAndLogError("Tried to call confirmHandler, but no callback was found. Please file an issue: https://github.com/stripe/stripe-react-native/issues",nil,nil)
val setupFutureUsage = mapToSetupFutureUse(modeParams.getString("setupFutureUsage"))
?:throwPaymentSheetException("You must provide a value to intentConfiguration.mode.setupFutureUsage")
PaymentSheet.IntentConfiguration.Mode.Setup(
currency = currencyCode,
setupFutureUse = setupFutureUsage
)
}
}
Both iOS and Android configure the payment sheet for a SetupIntent when amount is null. It is interesting (and perhaps a separate bug?) to note that while iOS allows currencyCode to be null on a PaymentIntent, Android does not.
Resolution
I think the easiest fix here would be to make IntentMode.amount a nullable field. Freezed does support union types, but that would get messy and would require updates to the individual platform implementations.
Hopefully this can get resolved quicky, because as of now there is no way to use a SetupIntent for a deferred payment in the manner described in the Stripe documentation. If you attempt to just specify a bogus amount, the payment sheet returns an error because it tries to fetch a PaymentIntent that doesn't exist:
The text was updated successfully, but these errors were encountered:
The Stripe docs describe how to collect payment details before creating an Intent, but the flutter platform interface doesn't properly implement the
IntentMode
enum:flutter_stripe/packages/stripe_platform_interface/lib/src/models/payment_sheet.dart
Lines 139 to 155 in 749a4d2
Note how the
IntentMode
class requirescurrencyCode
andamount
, but the platform implementations expectamount
andcurrencyCode
to be nullable when reading them, and use that information to determine whether to configure the payment sheet for aPaymentIntent
orSetupIntent
:flutter_stripe/packages/stripe_ios/ios/Classes/Stripe Sdk/StripeSdk+PaymentSheet.swift
Lines 217 to 253 in 749a4d2
flutter_stripe/packages/stripe_android/android/src/main/kotlin/com/reactnativestripesdk/PaymentSheetFragment.kt
Lines 409 to 428 in 749a4d2
Both iOS and Android configure the payment sheet for a
SetupIntent
whenamount
isnull
. It is interesting (and perhaps a separate bug?) to note that while iOS allowscurrencyCode
to benull
on aPaymentIntent
, Android does not.Resolution
I think the easiest fix here would be to make
IntentMode.amount
a nullable field. Freezed does support union types, but that would get messy and would require updates to the individual platform implementations.Hopefully this can get resolved quicky, because as of now there is no way to use a
SetupIntent
for a deferred payment in the manner described in the Stripe documentation. If you attempt to just specify a bogus amount, the payment sheet returns an error because it tries to fetch aPaymentIntent
that doesn't exist:The text was updated successfully, but these errors were encountered: