Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ezet committed Apr 25, 2020
1 parent 3ccdb14 commit cdb20b7
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions example/lib/setup_intent_with_sca.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:stripe_sdk/stripe_sdk.dart';
import 'package:stripe_sdk/stripe_sdk_ui.dart';

import 'locator.dart';
import 'network/network_service.dart';
Expand Down Expand Up @@ -40,15 +42,20 @@ class SetupIntentWithScaScreen extends StatelessWidget {
final Stripe stripe = Stripe.instance;
final NetworkService networkService = locator.get();
showProgressDialog(context);

final createSetupIntentResponse = await networkService.createSetupIntent();
var setupIntent =
await stripe.confirmSetupIntentWithPaymentMethod(createSetupIntentResponse.clientSecret, paymentMethod);

var setupIntent = await stripe.confirmSetupIntentWithPaymentMethod(createSetupIntentResponse.clientSecret, paymentMethod);
PaymentMethodStore store = Provider.of(context);
hideProgressDialog(context);

if (setupIntent['status'] == 'succeeded') {
Navigator.pop(context, true);
// await paymentMethods.refresh();

// A new method has been attached, so refresh the store.
// ignore: unawaited_futures
store.refresh();
} else {
// Something went wrong
Navigator.pop(context, false);
}
}
Expand Down

0 comments on commit cdb20b7

Please sign in to comment.