Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm Trying to implement Card saving for later use #151

Closed
Softmatech opened this issue Jun 16, 2021 · 2 comments
Closed

I'm Trying to implement Card saving for later use #151

Softmatech opened this issue Jun 16, 2021 · 2 comments

Comments

@Softmatech
Copy link

I implement the card register like it is on the example enter (card number, expiry date, and CVC) and on saving, it shows this message on the log and looks at how the result appears at this video,
https://user-images.githubusercontent.com/29921959/122156864-d8c14500-ce37-11eb-841c-c338d288e511.mov

`static Future handlePayPress(BuildContext context,CardFieldInputDetails _card, String _email) async {
if (_card == null) {
return null;
}
setSettings();
try {
// 1. Create setup intent on backend
final clientSecret = await _createSetupIntentOnBackend(context,_email);
print("SECRET==================== $clientSecret");
// 3. Confirm setup intent
final setupIntentResult = await Stripe.instance.confirmSetupIntent(clientSecret, PaymentMethodParams.card(setupFutureUsage: PaymentIntentsFutureUsage.OffSession));
log('Setup Intent created $setupIntentResult');
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'Success: Setup intent created. Intent status: $setupIntentResult',
),
),
);
return setupIntentResult;

} catch (error, s) {
log('Error while saving payment', error: error, stackTrace: s);
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text('Error code: $error')));
}
}`

@jonasbark
Copy link
Member

What's the full stack trace of the exception? Can you provide a minimal reproducible example?

@Softmatech
Copy link
Author

Softmatech commented Jun 16, 2021

@jonasbark
image

Error while saving payment
PlatformException(Failed, There was an unexpected error -- try again in a few seconds, null, null)
#0 JSONMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:155:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18)

#2 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:358:43)

#3 MethodChannelStripe.confirmSetupIntent (package:stripe_platform_interface/src/method_channel_stripe.dart:98:20)

#4 Stripe.confirmSetupIntent (package:flutter_stripe/src/stripe.dart:228:27)

#5 StripeHelper.handlePayPress (package:caritas/commons/stripe.dart:91:33)

#6 getCardForm.. (package:caritas/commons/helper.dart:438:54)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants