flutter_stripe
flutter_stripe copied to clipboard
confirmSetupIntent throws error with google pay cardFromToken and valid client secret
Hi, thanks for any help with this.
confirmSetupIntent
fails only in android using google pay token. Google pay works all the way through with payment intents with same card, just not with setup intents.
To Reproduce
// acquire valid payment result from google pay:
var token = paymentResult['paymentMethodData']['tokenizationData']['token'];
final tokenJson = Map.castFrom(json.decode(token));
tokenId = tokenJson['id'];
}
final params = PaymentMethodParams.cardFromToken(
token: tokenId,
setupFutureUsage: PaymentIntentsFutureUsage.OnSession);
// Free trial, capture intent for future billing
final response = await createSetupIntent(customerId);
final clientSecret = response['clientSecret'];
// THIS FAILS WITH GOOGLE PAY TOKEN BUT WORKS WITH APPLE PAY TOKEN
final setupIntentResult = await Stripe.instance.confirmSetupIntent(
clientSecret,
params,
}
Expected behavior This should work just like with acquiring an Apple Pay token like we do via:
token = await Stripe.instance.createApplePayToken(paymentResult);
The error thrown in Stripe.instance.confirmSetupIntent is "Card Details not complete"
The same card works fine in android with confirmPayment when there's an immediate charge, just not as a setup intent (for a free trial for a subscription for instance). I would use a payment intent, but it won't let me confirm a payment intent with zero charge.
There's no google pay setup intent in the example, and it will fail with same error if I were to change the setup future payment screen to use google pay.
Thanks for submitting the issue, there is an error confirmed where the createdSetupIntent does not support tokenized cards right now
We will update it as soon as it is fixed on the official repo https://github.com/stripe/stripe-react-native/issues/643
Hi is there any update on this @jamesblasco ?
any update?
This is now fixed by https://github.com/stripe/stripe-react-native/pull/931 in version 0.9.0
of the React Native Stripe implementation. All we need now is a new release of flutter_stripe
synced to this new version to close out this issue.
@jamesblasco @remonh87 @jonasbark 🙏
I've posted a PR just for this fix: https://github.com/flutter-stripe/flutter_stripe/pull/714
If you're impatient you can reference my fork, I'll leave it up for a few weeks:
dependency_overrides:
stripe_android:
git:
url: https://github.com/daveols/flutter_stripe
ref: android-confirm-setup-intent-hotfix
path: packages/stripe_android
This is available in the latest stripe sdk 5.0.0